Bug 852413 - Wait even more for painting to finish before forcing a paint. r=mattwoodrow

--HG--
extra : rebase_source : 8a0513da9cea80677b1d4739fad429044a24255d
This commit is contained in:
Joe Drew 2013-03-19 21:47:11 -04:00
parent 94ec89296d
commit 90723b2fd7

View File

@ -19,26 +19,37 @@ SimpleTest.waitForExplicitFinish();
var image = document.getElementById("image");
var lastPaintCount;
var utils = SpecialPowers.getDOMWindowUtils(window);
function changeImage() {
var utils = SpecialPowers.getDOMWindowUtils(window);
utils.checkAndClearPaintedState(image);
image.src = "./image_rrgg-256x256.png";
image.onload = function() {
lastPaintCount = window.mozPaintCount;
document.body.style.background = "black";
checkDone();
checkDonePainting();
}
}
// Wait until we've painted after the image loads, then force a paint and make
// sure the image doesn't get drawn.
function checkDonePainting() {
if (window.mozPaintCount == lastPaintCount || utils.isMozAfterPaintPending) {
setTimeout(checkDonePainting, 30);
return;
}
lastPaintCount = window.mozPaintCount;
document.body.style.background = "black";
checkDone();
}
function checkDone() {
if (window.mozPaintCount == lastPaintCount) {
if (window.mozPaintCount == lastPaintCount || utils.isMozAfterPaintPending) {
setTimeout(checkDone, 30);
return;
}
var utils = SpecialPowers.getDOMWindowUtils(window);
ok(!utils.checkAndClearPaintedState(image), "Should not paint any thebes layers for our image!");
SimpleTest.finish();
}