diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html new file mode 100644 index 0000000000..0f20719d46 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html @@ -0,0 +1,74 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>APZ hit-testing of fixed content when async-scrolled</title> + <script type="application/javascript" src="apz_test_utils.js"></script> + <script type="application/javascript" src="apz_test_native_event_utils.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <meta name="viewport" content="width=device-width"/> + <style> + html, body { + margin: 0; + } + #fixed { + position: fixed; + height: 300px; + width: 100%; + top: 0; + background: blue; + } + #target { + margin-top: 100px; + margin-left: 100px; + height: 20px; + width: 20px; + background: red; + } + </style> +</head> +<body> + <div id="fixed"> + <div id="target"></div> + </div> + <div id="make_root_scrollable" style="height: 5000px"></div> +</body> +<script type="application/javascript"> + +async function test() { + // Async scroll the page by 50 pixels using the mouse-wheel. + await promiseMoveMouseAndScrollWheelOver(document.body, 10, 10, + /* waitForScroll = */ false, /* scrollDelta = */ 50); + + let clickPromise = new Promise(resolve => { + target.addEventListener("click", e => { + ok(true, "Target was hit"); + e.stopPropagation(); // do not propagate event to |fixed| ancestor + resolve(); + }); + fixed.addEventListener("click", e => { + // Since target's listener calls stopPropagation(), if we get here + // then the coordinates of the click event did not correspond to + // |target|, but somewhere else on |fixed|. + ok(false, "Fixed ancestor should not be hit"); + resolve(); + }); + }); + + // Synthesize a click at (110, 110), which should hit |target| (a + // descendant of |fixed|) regardless of the async scroll. + await synthesizeNativeMouseEventWithAPZ({ + type: "click", + target: window, + offsetX: 110, + offsetY: 110 + }); + + await clickPromise; +} + +waitUntilApzStable() +.then(test) +.then(subtestDone, subtestFailed); + +</script> +</html> |