diff options
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html b/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html new file mode 100644 index 0000000000..7280a26006 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, minimum-scale=0.25, initial-scale=0.5, user-scalable=no"> + <title>Tests that the layout viewport is not expanted to the minimum scale size if user-scalable=no is specified</title> + <script type="application/javascript" src="apz_test_utils.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <style> + html,body { + overflow: hidden; + margin: 0; + } + div { + position: absolute; + } + </style> +</head> +<body> + <div style="width: 400%; height: 400%; background: red;"></div> + <div style="width: 100%; height: 100%; background-color: blue"></div> + <script type="application/javascript"> + const utils = SpecialPowers.getDOMWindowUtils(window); + + async function test(testDriver) { + utils.scrollToVisual(100, 0, utils.UPDATE_TYPE_MAIN_THREAD, + utils.SCROLL_MODE_INSTANT); + + let receivedScrollEvent = false; + window.visualViewport.addEventListener("scroll", () => { + receivedScrollEvent = true; + }, { once: true }); + + await waitUntilApzStable(); + + // Waits two frames to get a chance to deliver scroll events. + await promiseFrame(); + await promiseFrame(); + + ok(!receivedScrollEvent, "Scroll should never happen"); + is(visualViewport.offsetLeft, 0, + "The visual viewport offset should not be moved"); + } + + waitUntilApzStable().then(test).then(subtestDone, subtestFailed); + </script> +</body> +</html> |