Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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>