tor-browser

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

helper_hittest_iframe_perspective-2.html (1962B)


      1 <head>
      2  <meta name="viewport" content="width=device-width; initial-scale=1.0">
      3  <title>Test that events are delivered to the correct document near an iframe inide a perspective transform</title>
      4  <script src="apz_test_native_event_utils.js"></script>
      5  <script src="apz_test_utils.js"></script>
      6  <script src="/tests/SimpleTest/paint_listener.js"></script>
      7  <style>
      8    div {
      9      position: absolute;
     10    }
     11    .outer {
     12      left: 300px;
     13      top: 300px;
     14      transform: translate3d(0px, 0px, -500px) perspective(500px);
     15    }
     16    .inner {
     17      left: -100px;
     18      top: -100px;
     19    }
     20    iframe {
     21      border: 0;
     22    }
     23  </style>
     24 </head>
     25 <body>
     26  <div class="outer">
     27    <div class="inner">
     28      <iframe id="iframe" width="300px" height="200px" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
     29    </div>
     30  </div>
     31  <script type="application/javascript">
     32 async function test() {
     33  // Wait for iframe to receive content transforms.
     34  await SpecialPowers.spawn(iframe, [], async () => {
     35    await SpecialPowers.contentTransformsReceived(content.window);
     36  });
     37 
     38  let eventPromise = new Promise(resolve => {
     39    window.addEventListener("message", event => {
     40      let data = JSON.parse(event.data);
     41      if ("type" in data && data.type == "got-mouse-down") {
     42        ok(false, "Child document should not have received mouse-down");
     43        resolve();
     44      }
     45    });
     46 
     47    window.addEventListener("mousedown", () => {
     48      ok(true, "Parent document should have received mouse-down");
     49      resolve();
     50    });
     51  });
     52 
     53  // Click a bit above the iframe, and check the event is delivered
     54  // to the parent document, not the iframe.
     55  await synthesizeNativeMouseEventWithAPZ({
     56    type: "click",
     57    target: document.documentElement,
     58    offsetX: 350,
     59    offsetY: 175
     60  });
     61  await eventPromise;
     62 }
     63 
     64 waitUntilApzStable()
     65 .then(test)
     66 .then(subtestDone, subtestFailed);
     67 
     68  </script>
     69 </body>