summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html b/gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html
new file mode 100644
index 0000000000..3665ef5a31
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1638441_fixed_pos_hit_test.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1638441
+-->
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Test for Bug 1638441</title>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <style>
+ #target {
+ position: fixed;
+ bottom: 50px;
+ width: 100px;
+ height: 100px;
+ }
+ </style>
+</head>
+<body>
+ <div id="target">
+ <script type="application/javascript">
+
+async function test() {
+ let utils = SpecialPowers.getDOMWindowUtils(window);
+
+ // Do a large visual scroll to scroll the visual viewport to the bottom
+ // of the layout viewport.
+ let visualScrollPromise = new Promise(resolve => {
+ window.visualViewport.addEventListener("scroll", resolve, { once: true });
+ });
+ utils.scrollToVisual(0, 900, utils.UPDATE_TYPE_MAIN_THREAD,
+ utils.SCROLL_MODE_INSTANT);
+ await visualScrollPromise;
+ await promiseApzFlushedRepaints();
+
+ // Tap the position-fixed element which is near the bottom of the
+ // layout viewport (and therefore visible now that the visual
+ // viewport is scrolled to the bottom of the layout viewport).
+ // The intention is to test that the visual-to-layout transform
+ // is applied correctly during the hit test.
+ let target = document.getElementById("target");
+ let mouseDownEvent = null;
+ let mouseDownPromise = new Promise(resolve => {
+ target.addEventListener("mousedown", function(e) {
+ mouseDownEvent = e;
+ resolve();
+ });
+ });
+
+ await synthesizeNativeTap(target, 10, 10);
+ await mouseDownPromise;
+
+ is(mouseDownEvent.target, target, "mousedown event targeted the correct element");
+}
+
+SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0);
+waitUntilApzStable()
+.then(test)
+.then(subtestDone, subtestFailed);
+
+ </script>
+</body>
+</html>