|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test that active transformed elements coming into view are prerendered so we don't have to redraw constantly</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 <body onload="startTest()"> |
|
10 <div> |
|
11 <div id="t" style="position:absolute; left:0; top:500px; -moz-transform: translatex(-100px); width:200px; height:100px; background:yellow;"> |
|
12 <div style="text-align:right">Hello</div> |
|
13 <div style="text-align:left">Kitty</div> |
|
14 </div> |
|
15 </div> |
|
16 <pre id="test"> |
|
17 <script type="application/javascript"> |
|
18 SimpleTest.waitForExplicitFinish(); |
|
19 |
|
20 var t = document.getElementById("t"); |
|
21 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). |
|
22 getInterface(Components.interfaces.nsIDOMWindowUtils); |
|
23 |
|
24 function startTest() { |
|
25 // Do a couple of transform changes to ensure we've triggered activity heuristics |
|
26 waitForAllPaintsFlushed(function () { |
|
27 t.style.MozTransform = "translatex(-75px)"; |
|
28 waitForAllPaintsFlushed(function () { |
|
29 t.style.MozTransform = "translatex(-50px)"; |
|
30 waitForAllPaintsFlushed(function () { |
|
31 // Clear paint state now and move again. |
|
32 utils.checkAndClearPaintedState(t); |
|
33 // Don't move to 0 since that might trigger some special case that turns off transforms. |
|
34 t.style.MozTransform = "translatex(-1px)"; |
|
35 waitForAllPaintsFlushed(function () { |
|
36 var painted = utils.checkAndClearPaintedState(t); |
|
37 is(painted, false, "Transformed element should not have been painted"); |
|
38 SimpleTest.finish(); |
|
39 }); |
|
40 }); |
|
41 }); |
|
42 }); |
|
43 } |
|
44 </script> |
|
45 </pre> |
|
46 </body> |
|
47 </html> |