summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_fullscreen.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /gfx/layers/apz/test/mochitest/helper_fullscreen.html
parentInitial commit. (diff)
downloadthunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz
thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_fullscreen.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_fullscreen.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_fullscreen.html b/gfx/layers/apz/test/mochitest/helper_fullscreen.html
new file mode 100644
index 0000000000..32de4979f2
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_fullscreen.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Tests that layout viewport is not larger than visual viewport on fullscreen</title>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ overflow-x: hidden;
+ }
+ </style>
+</head>
+<body>
+ <div style="background: blue; width: 100%; height: 100%;"></div>
+ <div style="background: red; width: 200%; height: 100px;">overflowed element</div>
+ <div id="target" style="background: green; width: 100px; height: 100px;"></div>
+ <script type="application/javascript">
+ const utils = SpecialPowers.getDOMWindowUtils(window);
+
+ function waitForFullscreenChange() {
+ return new Promise(resolve => {
+ document.addEventListener("fullscreenchange", resolve);
+ });
+ }
+
+ async function test(testDriver) {
+ target.requestFullscreen();
+
+ await waitForFullscreenChange();
+
+ is(document.fullscreenElement, target,
+ "The target element should have been fullscreen-ed");
+
+ // Try to move rightward, but it should NOT happen.
+ utils.scrollToVisual(200, 0, utils.UPDATE_TYPE_MAIN_THREAD,
+ utils.SCROLL_MODE_INSTANT);
+
+ await waitUntilApzStable();
+
+ is(visualViewport.offsetLeft, 0,
+ "The visual viewport offset should never be moved");
+
+ document.exitFullscreen();
+ }
+
+ waitUntilApzStable().then(test).then(subtestDone, subtestFailed);
+ </script>
+</body>
+</html>