|
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 (1.1 scale)</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.1, 1.1); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden"> |
|
12 <div style="height:40px;"></div> |
|
13 <div id="e" style="height:30px; background:lime"></div> |
|
14 <div style="height:300px; background:yellow"></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 |
|
25 function startTest() { |
|
26 // Do a couple of scrolls to ensure we've triggered activity heuristics |
|
27 waitForAllPaintsFlushed(function () { |
|
28 t.scrollTop = 5; |
|
29 waitForAllPaintsFlushed(function () { |
|
30 t.scrollTop = 10; |
|
31 waitForAllPaintsFlushed(function () { |
|
32 // Clear paint state now and scroll again. |
|
33 utils.checkAndClearPaintedState(e); |
|
34 t.scrollTop = 20; |
|
35 waitForAllPaintsFlushed(function () { |
|
36 var painted = utils.checkAndClearPaintedState(e); |
|
37 is(painted, false, "Fully-visible scrolled element should not have been painted"); |
|
38 SimpleTest.finish(); |
|
39 }); |
|
40 }); |
|
41 }); |
|
42 }); |
|
43 } |
|
44 </script> |
|
45 </pre> |
|
46 </body> |
|
47 </html> |