tor-browser

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

test_fixed_bg_scrolling_repaints.html (1538B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test that we don't get unnecessary repaints with fixed backgrounds</title>
      5  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
      7  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
      8 </head>
      9 <!-- Need a timeout here to allow paint unsuppression before we start the test -->
     10 <body onload="setTimeout(startTest,0)" style="background:url(blue-32x32.png) top left no-repeat fixed; background-size: 100px 2000px; overflow:hidden;">
     11 <div style="height: 2048px"></div>
     12 
     13 <pre id="test">
     14 <script type="application/javascript">
     15 SimpleTest.waitForExplicitFinish();
     16 
     17 var utils = window.windowUtils;
     18 
     19 function startTest() {
     20  // Do a scroll to ensure we trigger activity heuristics.
     21  document.documentElement.scrollTop = 1;
     22  waitForAllPaintsFlushed(function () {
     23    document.documentElement.scrollTop = 0;
     24    waitForAllPaintsFlushed(function () {
     25      // Clear paint state and scroll down
     26      utils.checkAndClearPaintedState(document.documentElement);
     27      document.documentElement.scrollTop = 100;
     28      waitForAllPaintsFlushed(function () {
     29        // Make sure nothing painted
     30        var painted = utils.checkAndClearPaintedState(document.documentElement);
     31        is(painted, false, "Fixed background should not have been painted when scrolled");
     32        SimpleTest.finish();
     33      });
     34    });
     35  });
     36 }
     37 </script>
     38 </pre>
     39 </body>
     40 </html>