author Cosmin Sabou <>
Sun, 05 Feb 2023 19:37:33 +0000
changeset 651812 d8601249f1eb8c52c742b0c19c9ca0fa8f2e31fe
parent 553964 dc1d17e222a7cee6a96a50df8ed5ad2d1330cfa0
permissions -rw-r--r--
Bug 1806090 - temporarily disable browser_quickactions.js on linux for frequent failures. r=intermittent-reviewers,MasterWayZ Differential Revision:

<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta charset="utf-8">
<title>Testcase for checkerboarding after zooming during page load</title>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<meta name="viewport" content="width=device-width"/>
body, html {
    margin: 0;
 <div style="height: 5000px; background-color: green"></div>
<script type="application/javascript">

// This function runs after page load, but simulates what might happen if
// the user does a zoom during page load. It's hard to actually do this
// during page load, because the specific behaviour depends on interleaving
// between paints and the load event which is hard to control from a test.
// So instead, we do the zoom after page load, and then trigger a MVM reset
// which simulates what happens during the pageload process.
async function test() {
  var utils = SpecialPowers.getDOMWindowUtils(window);

  // Make it so that the layout and visual viewports diverge. We do this by
  // zooming and then moving the visual viewport.
  var x = window.innerWidth / 2;
  var y = window.innerHeight / 2;
  utils.scrollToVisual(x, y, utils.UPDATE_TYPE_MAIN_THREAD, utils.SCROLL_MODE_INSTANT);
  dump("Done scrollToVisual\n");

  // Next, kick off a paint transaction to APZ, so that it sets appropriate
  // displayport margins with visual/layout adjustment factors.
  await promiseApzFlushedRepaints();

  // Once that's done, we want to trigger the MobileViewportManager to update
  // the displayport margins.
  dump("Resetting MVM...\n");

  // The bug is that at this point, paints end up checkerboarding because the
  // MVM code to update the displayport margins doesn't preserve the layout
  // adjustment factor needed.
  assertNotCheckerboarded(utils, utils.getViewId(document.scrollingElement), `Should not see checkerboarding`);

.then(subtestDone, subtestFailed);