tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_pointer-events-2.xhtml (2115B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=500174
      4 -->
      5 <head>
      6  <title>Test Pointer Events</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body onload="run()">
     11 <script class="testbody" type="text/javascript">
     12 <![CDATA[
     13 
     14 SimpleTest.waitForExplicitFinish();
     15 
     16 function run() {
     17  pass();
     18 
     19  document.getElementById("circle").setAttribute("clip-path", "#(unknown)");
     20 
     21  pass();
     22 
     23  SimpleTest.finish();
     24 }
     25 
     26 function pass() {
     27  let div = document.getElementById("div");
     28  // Get the coords of the origin of the SVG canvas:
     29  let originX = div.offsetLeft;
     30  let originY = div.offsetTop;
     31  let circle = document.getElementById("circle");
     32  let path = document.getElementById('path');
     33 
     34  let elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
     35  is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
     36 
     37  elementFromPoint = document.elementFromPoint(originX + 205, originY + 55);
     38  is(elementFromPoint, circle, "Over foreignObject, outside clip path");
     39 
     40  elementFromPoint = document.elementFromPoint(originX + 225, originY + 75);
     41  is(elementFromPoint, path, 'Over foreignObject, inside clip path');
     42 }
     43 
     44 ]]>
     45 </script>
     46 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500174">Mozilla Bug 500174</a>
     47 <p id="display"></p>
     48 <div id="content">
     49 
     50  <div width="100%" height="1" id="div">
     51  </div>
     52  <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" id="svg">
     53    <defs>
     54      <clipPath id="clip">
     55        <rect x="220" y="50" width="30" height="30"/>
     56      </clipPath>
     57    </defs>
     58    <rect id="bad" width="100%" height="100%" fill="blue"/>
     59    <circle id="circle" cx="50%" cy="50%" r="500" stroke-width="500" fill="none" pointer-events="all"/>
     60    <foreignObject id="fo" x="200" y="50" width="50" height="50" clip-path="url(#clip)">
     61      <svg>
     62        <path id="path" d="M0,0 H50 V50 H0 Z" fill="green"/>
     63      </svg>
     64    </foreignObject>
     65  </svg>
     66 
     67 </div>
     68 <pre id="test">
     69 </pre>
     70 </body>
     71 </html>