Source code

Revision control

Copy as Markdown

Other Tools

<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>
html,body {
overflow: hidden;
margin: 0;
div {
position: absolute;
<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,
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);