gecko/layout/base/tests/chrome/test_prerendered_transforms.html
Georg Fritzsche 5beaeb5928 Bug 805330 - Ensure plugin widget visibility via paint flushes. r=josh,roc,robcee
--HG--
rename : layout/base/tests/chrome/paint_listener.js => testing/mochitest/tests/SimpleTest/paint_listener.js
2012-12-05 14:39:26 +01:00

48 lines
1.9 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test that active transformed elements coming into view are prerendered so we don't have to redraw constantly</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body onload="startTest()">
<div>
<div id="t" style="position:absolute; left:0; top:500px; -moz-transform: translatex(-100px); width:200px; height:100px; background:yellow;">
<div style="text-align:right">Hello</div>
<div style="text-align:left">Kitty</div>
</div>
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var t = document.getElementById("t");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
function startTest() {
// Do a couple of transform changes to ensure we've triggered activity heuristics
waitForAllPaintsFlushed(function () {
t.style.MozTransform = "translatex(-75px)";
waitForAllPaintsFlushed(function () {
t.style.MozTransform = "translatex(-50px)";
waitForAllPaintsFlushed(function () {
// Clear paint state now and move again.
utils.checkAndClearPaintedState(t);
// Don't move to 0 since that might trigger some special case that turns off transforms.
t.style.MozTransform = "translatex(-1px)";
waitForAllPaintsFlushed(function () {
var painted = utils.checkAndClearPaintedState(t);
is(painted, false, "Transformed element should not have been painted");
SimpleTest.finish();
});
});
});
});
}
</script>
</pre>
</body>
</html>