layout/base/tests/chrome/test_prerendered_transforms.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial