gecko-dev/dom/plugins/test/reftest/update-1.html
Karl Tomlinson 1d9e644eb7 b=810426 Flush() old surfaces before the plugin may redraw r=roc
--HG--
extra : transplant_source : n%F7%0D%20J%D9%DF%CBY%60J0%09%F2%02h2%DC%C6%E7
2012-11-11 21:10:32 -08:00

58 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>Test for bugs 807728 and 810426</title>
<script>
function start()
{
document.removeEventListener("MozReftestInvalidate", start, false);
var plugin = document.getElementById("plugin");
var color = "FF000000";
var color_count = 0;
var last_paint_count = 0;
// Enough paints to test reusing a surface after it has been
// moved from front to back buffer.
var final_paint_count = window.mozPaintCount + 10;
var final_color = "FFFF0000";
// Using mozPaintCount to track when content has been updated as an
// indication that the browser has received updates, instead of
// plugin.getPaintCount() which tracks when the plugin sends updates or
// MozAfterPaint events which track OS paints. Not using
// MozPaintWaitFinished because invalidation causes no geometry changes.
function wait_for_paints() {
var paint_count = window.mozPaintCount;
if (paint_count >= final_paint_count && color == final_color) {
document.documentElement.removeAttribute("class");
return;
}
if (paint_count != last_paint_count) {
last_paint_count = paint_count;
if (paint_count + 1 >= final_paint_count) {
color = final_color;
// Wait for the paint with the final color
final_paint_count = paint_count + 1;
} else {
++color_count;
color = "FF00000" + color_count;
}
plugin.setColor(color);
}
setTimeout(wait_for_paints, 0);
}
wait_for_paints();
}
// MozReftestInvalidate is delivered after initial painting has settled.
document.addEventListener("MozReftestInvalidate", start, false);
</script>
</head>
<body>
<embed id="plugin" type="application/x-test"
drawmode="solid" color="FF000000" width="30" height="50">
</embed>
</body>
</html>