layout/base/tests/chrome/test_transformed_scrolling_repaints.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:b59770962f6e
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</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)">
11 <div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
12 <div style="height:40px;">Hello</div>
13 <div id="e" style="height:30px; background:lime">Kitty</div>
14 <div style="height:300px; background:yellow">Kitty</div>
15 </div>
16 <pre id="test">
17 <script type="application/javascript">
18 SimpleTest.waitForExplicitFinish();
19
20 var t = document.getElementById("t");
21 var e = document.getElementById("e");
22 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
23 getInterface(Components.interfaces.nsIDOMWindowUtils);
24 const isLinux = navigator.platform.indexOf("Linux") >= 0;
25 const is64 = navigator.platform.indexOf("x86_64") >= 0;
26 var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
27 if (winLowerThanVista) {
28 var version = Components.classes["@mozilla.org/system-info;1"]
29 .getService(Components.interfaces.nsIPropertyBag2)
30 .getProperty("version");
31 winLowerThanVista = parseFloat(version) < 6.0;
32 }
33
34 function startTest() {
35 // Do a couple of scrolls to ensure we've triggered activity heuristics.
36 waitForAllPaintsFlushed(function () {
37 t.scrollTop = 5;
38 waitForAllPaintsFlushed(function () {
39 t.scrollTop = 10;
40 waitForAllPaintsFlushed(function () {
41 // Clear paint state now and scroll again.
42 utils.checkAndClearPaintedState(e);
43 t.scrollTop = 15;
44 waitForAllPaintsFlushed(function () {
45 var painted = utils.checkAndClearPaintedState(e);
46 if ((isLinux && !is64) || winLowerThanVista) {
47 todo(false, "Fully-visible scrolled element should not have been painted (random on Linux-32)");
48 } else {
49 is(painted, false, "Fully-visible scrolled element should not have been painted");
50 }
51 SimpleTest.finish();
52 });
53 });
54 });
55 });
56 }
57 </script>
58 </pre>
59 </body>
60 </html>

mercurial