gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html
author Robert Longson <longsonr@gmail.com>
Sat, 04 Feb 2023 15:41:48 +0000
changeset 651752 40237e7707f1928c84d09cdd2f1fd018a74ea784
parent 618295 4a19d217b980b5903844432b7e03abff7b589f01
permissions -rw-r--r--
Bug 1814872 - Fix degenerate radial gradient handling r=emilio This is a change from SVG 1.1 where we only had to check for r=0 because fr did not exist. The SVG 2 behaviour was clarified in https://github.com/w3c/svgwg/issues/648 Differential Revision: https://phabricator.services.mozilla.com/D168783

<head>
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Test that events are delivered to the correct document near an iframe inide a perspective transform</title>
  <script src="apz_test_native_event_utils.js"></script>
  <script src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <style>
    div {
      position: absolute;
    }
    .outer {
      left: 300px;
      top: 300px;
      transform: translate3d(0px, 0px, -500px) perspective(500px);
    }
    .inner {
      left: -100px;
      top: -100px;
    }
    iframe {
      border: 0;
    }
  </style>
</head>
<body>
  <div class="outer">
    <div class="inner">
      <iframe width="300px" height="200px" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
    </div>
  </div>
  <script type="application/javascript">
async function test() {
  let eventPromise = new Promise(resolve => {
    window.addEventListener("message", event => {
      let data = JSON.parse(event.data);
      if ("type" in data && data.type == "got-mouse-down") {
        ok(false, "Child document should not have received mouse-down");
        resolve();
      }
    });

    window.addEventListener("mousedown", event => {
      ok(true, "Parent document should have received mouse-down");
      resolve();
    });
  });

  // Click a bit above the iframe, and check the event is delivered
  // to the parent document, not the iframe.
  await synthesizeNativeMouseEventWithAPZ({
    type: "click",
    target: document.documentElement,
    offsetX: 350,
    offsetY: 175
  });
  await eventPromise;
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);

  </script>
</body>