1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/chrome/test_fixed_bg_scrolling_repaints.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test that we don't get unnecessary repaints with fixed backgrounds</title> 1.8 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 1.11 +</head> 1.12 +<!-- Need a timeout here to allow paint unsuppression before we start the test --> 1.13 +<body onload="setTimeout(startTest,0)" style="background: url(blue-32x32.png) fixed"> 1.14 +<div style="height: 2048px"></div> 1.15 +<pre id="test"> 1.16 +<script type="application/javascript"> 1.17 +SimpleTest.waitForExplicitFinish(); 1.18 + 1.19 +var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). 1.20 + getInterface(Components.interfaces.nsIDOMWindowUtils); 1.21 + 1.22 +function startTest() { 1.23 + // Do a scroll to ensure we trigger activity heuristics. 1.24 + waitForAllPaintsFlushed(function () { 1.25 + // Clear paint state and scroll down 1.26 + utils.checkAndClearPaintedState(document.body); 1.27 + document.documentElement.scrollTop = 100; 1.28 + waitForAllPaintsFlushed(function () { 1.29 + // Make sure the body didn't paint 1.30 + var painted = utils.checkAndClearPaintedState(document.body); 1.31 + is(painted, false, "Fixed background should not have been painted when scrolled"); 1.32 + SimpleTest.finish(); 1.33 + }); 1.34 + }); 1.35 +} 1.36 +</script> 1.37 +</pre> 1.38 +</body> 1.39 +</html>