tor-browser

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

test_border_radius_hit_testing.html (4953B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=595652
      5 -->
      6 <head>
      7  <title>Test for Bug 595652</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body onload="run()">
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595652">Mozilla Bug 595652</a>
     13 <iframe src="border_radius_hit_testing_iframe.html" id="iframe" height="600" width="500" style="border:none"></iframe>
     14 <pre id="test">
     15 <script type="application/javascript">
     16 
     17 /** Test for Bug 595652 */
     18 
     19 SimpleTest.waitForExplicitFinish();
     20 
     21 function run() {
     22  var iframe = document.getElementById("iframe");
     23  
     24  var doc = iframe.contentDocument;
     25 
     26  var container = doc.body;
     27  var one = doc.getElementById("one");
     28  var two = doc.getElementById("two").firstChild;
     29 
     30  //container.addEventListener("click", function(event) { alert(event.clientX + "," + event.clientY) }, false);
     31 
     32  function check(x, y, expected_element, description)
     33  {
     34 is(doc.elementFromPoint(x, y), expected_element,
     35    "point (" + x + ", " + y + "): " + description);
     36  }
     37 
     38  check(42, 6, container, "outside top left corner of #one");
     39  check(11, 21, container, "outside top left corner of #one");
     40  check(476, 10, container, "outside top right corner of #one");
     41  check(495, 28, container, "outside top right corner of #one");
     42  check(483, 197, container, "outside bottom right corner of #one");
     43  check(497, 175, container, "outside bottom right corner of #one");
     44  check(29, 182, container, "outside bottom left corner of #one");
     45  check(73, 198, container, "outside bottom left corner of #one");
     46 
     47  check(95, 2, one, "inside top left corner of #one (curved quadrant)");
     48  check(16, 27, one, "inside top left corner of #one (curved quadrant)");
     49  check(87, 37, one, "inside top left corner of #one (curved quadrant)");
     50  check(465, 10, one, "inside top right corner of #one (curved quadrant)");
     51  check(489, 33, one, "inside top right corner of #one (curved quadrant)");
     52  check(443, 56, one, "inside top right corner of #one (curved quadrant)");
     53  check(493, 167, one, "inside bottom right corner of #one (curved quadrant)");
     54  check(476, 188, one, "inside bottom right corner of #one (curved quadrant)");
     55  check(462, 144, one, "inside bottom right corner of #one (curved quadrant)");
     56  check(74, 186, one, "inside bottom left corner of #one (curved quadrant)");
     57  check(16, 153, one, "inside bottom left corner of #one (curved quadrant)");
     58  check(112, 124, one, "inside bottom left corner of #one (curved quadrant)");
     59 
     60  check(250, 1, one, "along top edge of #one");
     61  check(250, 199, one, "along bottom edge of #one");
     62  check(1, 100, one, "along left edge of #one");
     63  check(499, 100, one, "along right edge of #one");
     64  check(250, 100, one, "in center of #one");
     65 
     66  check(2, 52, one, "inside top left corner of #one (left edge, outside ellipse)");
     67  check(82, 52, one, "inside top left corner of #one (left edge, inside ellipse)");
     68 
     69  check(42, 306, container, "outside top left corner of #two");
     70  check(11, 321, container, "outside top left corner of #two");
     71  check(476, 310, container, "outside top right corner of #two");
     72  check(495, 328, container, "outside top right corner of #two");
     73  check(483, 497, container, "outside bottom right corner of #two");
     74  check(497, 475, container, "outside bottom right corner of #two");
     75  check(29, 482, container, "outside bottom left corner of #two");
     76  check(73, 498, container, "outside bottom left corner of #two");
     77 
     78  check(95, 302, two, "inside top left corner of #two (curved quadrant)");
     79  check(16, 327, two, "inside top left corner of #two (curved quadrant)");
     80  check(87, 337, two, "inside top left corner of #two (curved quadrant)");
     81  check(465, 310, two, "inside top right corner of #two (curved quadrant)");
     82  check(489, 333, two, "inside top right corner of #two (curved quadrant)");
     83  check(443, 356, two, "inside top right corner of #two (curved quadrant)");
     84  check(493, 467, two, "inside bottom right corner of #two (curved quadrant)");
     85  check(476, 488, two, "inside bottom right corner of #two (curved quadrant)");
     86  check(462, 444, two, "inside bottom right corner of #two (curved quadrant)");
     87  check(74, 486, two, "inside bottom left corner of #two (curved quadrant)");
     88  check(16, 453, two, "inside bottom left corner of #two (curved quadrant)");
     89  check(112, 424, two, "inside bottom left corner of #two (curved quadrant)");
     90 
     91  check(250, 301, two, "along top edge of #two");
     92  check(250, 499, two, "along bottom edge of #two");
     93  check(1, 400, two, "along left edge of #two");
     94  check(499, 400, two, "along right edge of #two");
     95  check(250, 400, two, "in center of #two");
     96 
     97  check(2, 352, two, "inside top left corner of #two (left edge, outside ellipse)");
     98  check(82, 352, two, "inside top left corner of #two (left edge, inside ellipse)");
     99 
    100  SimpleTest.finish();
    101 }
    102 
    103 </script>
    104 </pre>
    105 </body>
    106 </html>