// Unfortunately we cannot reliably assert that mozPaintCount and afterPaintCount increment perfectly
// in sync, because they can diverge in the presence of OS-triggered paints or system load.
// Instead, wait for a minimum number of afterPaint events to at least ensure that they are being fired.
const minimumAfterPaintsToPass = 10;
function doElementFlicker() {
ok(true, "Element color iteration " + color + ", afterpaint count: " + afterPaintCount + ", mozpaint count: " + SpecialPowers.DOMWindowUtils.paintCount);
if (afterPaintCount >= minimumAfterPaintsToPass) {
ok(true, "afterPaintCount incremented enough from color changes.");
SimpleTest.finish();
return;
}
color = (color + 1) % 256;
document.getElementById("p").style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")";
setTimeout(doElementFlicker, 0);
}
function doBackgroundFlicker() {
ok(true, "Background color iteration " + color + ", afterpaint count: " + afterPaintCount + ", mozpaint count: " + SpecialPowers.DOMWindowUtils.paintCount);
if (afterPaintCount >= minimumAfterPaintsToPass) {
ok(true, "afterPaintCount incremented enough from background color changes.");
afterPaintCount = 0;
initialPaintCount = SpecialPowers.DOMWindowUtils.paintCount;
doElementFlicker();
return;
}
color = (color + 1) % 256;
document.body.style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")";
setTimeout(doBackgroundFlicker, 0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.