Source code

Revision control

Copy as Markdown

Other Tools

<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>
body {
margin: 0;
padding: 0;
overflow-x: hidden;
<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) {
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,
await waitUntilApzStable();
is(visualViewport.offsetLeft, 0,
"The visual viewport offset should never be moved");
waitUntilApzStable().then(test).then(subtestDone, subtestFailed);