summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.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_zoom_keyboardscroll.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html b/gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html
new file mode 100644
index 0000000000..1a7b38fabd
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_zoom_keyboardscroll.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0">
+ <title>Tests that keyboard arrow keys scroll after zooming in when there was no scrollable overflow before zooming</title>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <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>
+</head>
+<body>
+ <div style="height: 20000px; background-color: green"></div>
+ <script type="application/javascript">
+ const utils = SpecialPowers.getDOMWindowUtils(window);
+
+ async function test() {
+ is(await getResolution(), 1.0, "should not be zoomed (1)");
+
+ is(window.scrollX, 0, "shouldn't have scrolled (2)");
+ is(window.scrollY, 0, "shouldn't have scrolled (3)");
+ is(visualViewport.pageTop, 0, "shouldn't have scrolled (4)");
+ is(visualViewport.pageLeft, 0, "shouldn't have scrolled (5)");
+
+ // Zoom in
+ SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0);
+ await promiseApzFlushedRepaints();
+ await promiseFrame();
+
+ is(await getResolution(), 2.0, "should have zoomed (6)");
+
+ is(window.scrollX, 0, "shouldn't have scrolled (7)");
+ is(window.scrollY, 0, "shouldn't have scrolled (8)");
+ is(visualViewport.pageTop, 0, "shouldn't have scrolled (9)");
+ is(visualViewport.pageLeft, 0, "shouldn't have scrolled (10)");
+
+ window.synthesizeKey("KEY_ArrowRight");
+
+ await promiseApzFlushedRepaints();
+ await promiseFrame();
+
+ is(await getResolution(), 2.0, "should be zoomed (11)");
+
+ is(window.scrollX, 0, "shouldn't have scrolled (12)");
+ is(window.scrollY, 0, "shouldn't have scrolled (13)");
+ is(visualViewport.pageTop, 0, "shouldn't have scrolled (14)");
+ isnot(visualViewport.pageLeft, 0, "should have scrolled (15)");
+
+ window.synthesizeKey("KEY_ArrowDown");
+
+ await promiseApzFlushedRepaints();
+ await promiseFrame();
+
+ is(await getResolution(), 2.0, "should be zoomed (16)");
+
+ is(window.scrollX, 0, "shouldn't have scrolled (17)");
+ is(window.scrollY, 0, "shouldn't have scrolled (18)");
+ isnot(visualViewport.pageTop, 0, "should have scrolled (19)");
+ isnot(visualViewport.pageLeft, 0, "should have scrolled (20)");
+
+ // Zoom back out
+ SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(1.0);
+ await promiseApzFlushedRepaints();
+ await promiseFrame();
+
+ is(await getResolution(), 1.0, "should not be zoomed (21)");
+ }
+
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+ </script>
+</body>
+</html>