tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

helper_bug1509575.html (2439B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1509575
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <meta name="viewport" content="width=device-width, initial-scale=1.0">
      9  <title>Test for Bug 1509575</title>
     10  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
     11  <script type="application/javascript" src="apz_test_utils.js"></script>
     12  <script src="/tests/SimpleTest/paint_listener.js"></script>
     13  <script src="/tests/SimpleTest/EventUtils.js"></script>
     14 </head>
     15 <body>
     16  <div id="expand" style="background-color: paleturquoise ;">
     17    Now you're scrolled, now you're not?
     18  </div>
     19  <script type="application/javascript">
     20 
     21 async function test() {
     22  let transformEndPromise = promiseTransformEnd();
     23  await synthesizeNativeTouchDrag(document.body, 10, 100, -100, 0);
     24  dump("Finished native drag, waiting for transform-end observer...\n");
     25 
     26  // Wait for the APZ:TransformEnd to be fired after touch events are processed.
     27  await transformEndPromise;
     28 
     29  // Flush state.
     30  await promiseApzFlushedRepaints();
     31 
     32  is(window.scrollX, 0, "layout viewport didn't scroll");
     33  let visualX = window.visualViewport.pageLeft;
     34  ok(visualX > 0, "visual viewport did scroll");
     35 
     36  let topWinUtils;
     37  const isE10s = SpecialPowers.Services.appinfo.browserTabsRemoteAutostart;
     38  // We need to reset the first paint flag on the root document in the process
     39  // this test is loaded in.
     40  if (!isE10s) {
     41    // For non-e10s, such as in Fennec, this means we need the *chrome* window
     42    // as the topmost entitiy in this process.
     43    topWinUtils = SpecialPowers.getDOMWindowUtils(
     44        SpecialPowers._getTopChromeWindow(window));
     45  } else {
     46    topWinUtils = SpecialPowers.getDOMWindowUtils(window);
     47  }
     48  let afterPaintPromise = promiseAfterPaint();
     49  ok(topWinUtils.isFirstPaint === false, "first paint not set");
     50  topWinUtils.isFirstPaint = true;
     51  // do something that forces a paint *and* an APZ update.
     52  document.getElementById("expand").style.width = "6000px";
     53 
     54  // Wait for the event listener to fire.
     55  await afterPaintPromise;
     56  ok(true, "MozAfterPaint fired");
     57 
     58  // Flush state just to be sure.
     59  await promiseApzFlushedRepaints();
     60 
     61  is(window.visualViewport.pageLeft, visualX, "visual viewport remains unchanged");
     62 }
     63 
     64 SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0);
     65 waitUntilApzStable()
     66 .then(test)
     67 .then(subtestDone, subtestFailed);
     68 
     69  </script>
     70 </body>
     71 </html>