diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html b/gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html new file mode 100644 index 0000000000..27add6debb --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_fixed_html_hittest.html @@ -0,0 +1,61 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width"> + <title>Hittest position:fixed zoomed scroll</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> + <style> + html { + position: fixed; + } + body { + margin: 0; + } + #fixed { + position: fixed; + top: 100px; + left: 100px; + } + </style> +</head> +<body> + <div id="fixed"><input type="button" value="Button" /></div> + <script> + async function test() { + // Create an offset between the visual and layout viewports. + // The offset is 50 CSS pixels = 100 screen pixels at 2x zoom + // in either direction. + let transformEndPromise = promiseTransformEnd(); + await synthesizeNativeTouchDrag(document.body, 10, 10, -50, -50); + await transformEndPromise; + + await promiseApzFlushedRepaints(); + + let clickPromise = new Promise(resolve => { + window.addEventListener("click", resolve); + }); + let input = document.querySelector("input"); + // Provide the input in window-relative coordinates, + // otherwise coordinatesRelativeToScreen() will run into the + // same bug as the hit-test, and the two bugs cancel out. + await synthesizeNativeMouseEventWithAPZ({ + type: "click", + target: window, + // The visual viewport is already offset (50, 50) CSS pixels + // into the layout viewport. An additional (50, 50) CSS pixels + // gives us (100, 100), the offset of #fixed, in total. + offsetX: 55, + offsetY: 55 + }); + let e = await clickPromise; + is(e.target, input, "got click"); + } + + SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0); + waitUntilApzStable().then(test).then(subtestDone, subtestFailed); + </script> +</body> +</html> |