1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/chrome/test_transformed_scrolling_repaints.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</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)"> 1.14 +<div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden"> 1.15 + <div style="height:40px;">Hello</div> 1.16 + <div id="e" style="height:30px; background:lime">Kitty</div> 1.17 + <div style="height:300px; background:yellow">Kitty</div> 1.18 +</div> 1.19 +<pre id="test"> 1.20 +<script type="application/javascript"> 1.21 +SimpleTest.waitForExplicitFinish(); 1.22 + 1.23 +var t = document.getElementById("t"); 1.24 +var e = document.getElementById("e"); 1.25 +var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). 1.26 + getInterface(Components.interfaces.nsIDOMWindowUtils); 1.27 +const isLinux = navigator.platform.indexOf("Linux") >= 0; 1.28 +const is64 = navigator.platform.indexOf("x86_64") >= 0; 1.29 +var winLowerThanVista = navigator.platform.indexOf("Win") == 0; 1.30 +if (winLowerThanVista) { 1.31 + var version = Components.classes["@mozilla.org/system-info;1"] 1.32 + .getService(Components.interfaces.nsIPropertyBag2) 1.33 + .getProperty("version"); 1.34 + winLowerThanVista = parseFloat(version) < 6.0; 1.35 +} 1.36 + 1.37 +function startTest() { 1.38 + // Do a couple of scrolls to ensure we've triggered activity heuristics. 1.39 + waitForAllPaintsFlushed(function () { 1.40 + t.scrollTop = 5; 1.41 + waitForAllPaintsFlushed(function () { 1.42 + t.scrollTop = 10; 1.43 + waitForAllPaintsFlushed(function () { 1.44 + // Clear paint state now and scroll again. 1.45 + utils.checkAndClearPaintedState(e); 1.46 + t.scrollTop = 15; 1.47 + waitForAllPaintsFlushed(function () { 1.48 + var painted = utils.checkAndClearPaintedState(e); 1.49 + if ((isLinux && !is64) || winLowerThanVista) { 1.50 + todo(false, "Fully-visible scrolled element should not have been painted (random on Linux-32)"); 1.51 + } else { 1.52 + is(painted, false, "Fully-visible scrolled element should not have been painted"); 1.53 + } 1.54 + SimpleTest.finish(); 1.55 + }); 1.56 + }); 1.57 + }); 1.58 + }); 1.59 +} 1.60 +</script> 1.61 +</pre> 1.62 +</body> 1.63 +</html>