layout/base/tests/chrome/test_fixed_bg_scrolling_repaints.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test that we don't get unnecessary repaints with fixed backgrounds</title>
     5   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" 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) fixed">
    11 <div style="height: 2048px"></div>
    12 <pre id="test">
    13 <script type="application/javascript">
    14 SimpleTest.waitForExplicitFinish();
    16 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
    17                getInterface(Components.interfaces.nsIDOMWindowUtils);
    19 function startTest() {
    20   // Do a scroll to ensure we trigger activity heuristics.
    21   waitForAllPaintsFlushed(function () {
    22     // Clear paint state and scroll down
    23     utils.checkAndClearPaintedState(document.body);
    24     document.documentElement.scrollTop = 100;
    25     waitForAllPaintsFlushed(function () {
    26       // Make sure the body didn't paint
    27       var painted = utils.checkAndClearPaintedState(document.body);
    28       is(painted, false, "Fixed background should not have been painted when scrolled");
    29       SimpleTest.finish();
    30     });
    31   });
    32 }
    33 </script>
    34 </pre>
    35 </body>
    36 </html>

mercurial