2010-01-06 17:12:21 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test that we flush before painting</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body onload="doIteration()">
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<embed type="application/x-test" id="plugin" drawmode="solid" style="width:200px; height:200px;"></embed>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
var iterations = 0;
|
|
|
|
var plugin = document.getElementById("plugin");
|
|
|
|
var lastPaintCount;
|
|
|
|
var expectedWidth;
|
|
|
|
|
|
|
|
var toggle = true;
|
|
|
|
function invalidationLoop() {
|
|
|
|
toggle = !toggle;
|
|
|
|
var color = toggle ? "8F" : "00";
|
|
|
|
plugin.setColor("FFFFFF" + color);
|
|
|
|
setTimeout(invalidationLoop, 20);
|
|
|
|
}
|
|
|
|
invalidationLoop();
|
|
|
|
|
|
|
|
function doIteration() {
|
2010-09-07 17:36:54 -07:00
|
|
|
lastPaintCount = window.mozPaintCount;
|
2010-06-04 10:28:19 -07:00
|
|
|
ok(true, "Beginning iteration " + iterations + ", last paint count: " + lastPaintCount);
|
2010-01-06 17:12:21 -08:00
|
|
|
|
|
|
|
expectedWidth = 201 + iterations;
|
|
|
|
plugin.style.width = expectedWidth + "px";
|
|
|
|
checkDone();
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkDone() {
|
2010-09-07 17:36:54 -07:00
|
|
|
ok(true, "Check to see if we're done: " + window.mozPaintCount);
|
|
|
|
if (window.mozPaintCount == lastPaintCount) {
|
2010-01-06 17:12:21 -08:00
|
|
|
setTimeout(checkDone, 30);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-05 22:43:21 -07:00
|
|
|
var utils = SpecialPowers.getDOMWindowUtils(window);
|
2010-01-06 17:12:21 -08:00
|
|
|
is(plugin.getWidthAtLastPaint(), utils.screenPixelsPerCSSPixel*expectedWidth,
|
|
|
|
"Check that we set width before painting");
|
|
|
|
|
|
|
|
++iterations;
|
|
|
|
if (iterations < 100) {
|
|
|
|
doIteration();
|
|
|
|
} else {
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|