gfx/layers/apz/test/mochitest/helper_hittest_fixed_item_over_oop_iframe.html
author moz-wptsync-bot <wptsync@mozilla.com>
Thu, 02 Feb 2023 17:56:40 +0000
changeset 651741 193873a769705e43125bf048e01f18ac964d91b4
parent 605522 f54686ba4658c194aaeeae3d472c24ab72f5764a
permissions -rw-r--r--
Bug 1814704 - [wpt-sync] Update web-platform-tests to cfdf7a3b7129de7f29c9ff9e9d63a4cfb56696fd, a=testonly MANUAL PUSH: wpt sync bot wpt-head: cfdf7a3b7129de7f29c9ff9e9d63a4cfb56696fd wpt-type: landing

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hit-testing of positioned item on top of oop iframe</title>
<script src="apz_test_utils.js"></script>
<script src="apz_test_native_event_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1747409 -->
<style>
body, html {
  width:100%;
  height:100%;
  margin:0;
}

iframe {
  width:100%;
  height:100%;
  position:fixed;
  z-index:1;
}

.over {
  position: fixed;
  right: 50px;
  bottom: 50px;
  z-index: 9999;
}
</style>
<div class="over">
  <a id="target" href="#">Link</a>
</div>
<iframe src="https://example.com"></iframe>
<script>
async function test() {
  let config = getHitTestConfig();
  let utils = config.utils;
  let iframe = document.querySelector("iframe");
  let target = document.getElementById("target");

  try {
    iframe.contentWindow.document;
    ok(false, "Should be a cross-origin iframe");
  } catch (ex) {}

  await promiseApzFlushedRepaints();

  checkHitResult(hitTest(centerOf(target)),
                 APZHitResultFlags.VISIBLE,
                 utils.getViewId(document.scrollingElement),
                 utils.getLayersId(),
                 "fixed element with z-index");
}


onload = function() {
  waitUntilApzStable()
    .then(test)
    .then(subtestDone, subtestFailed);
};
</script>