dom/plugins/test/reftest/update-1.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE html>
michael@0 2 <html class="reftest-wait">
michael@0 3 <head>
michael@0 4 <title>Test for bugs 807728 and 810426</title>
michael@0 5 <script>
michael@0 6 function start()
michael@0 7 {
michael@0 8 document.removeEventListener("MozReftestInvalidate", start, false);
michael@0 9
michael@0 10 var plugin = document.getElementById("plugin");
michael@0 11 var color = "FF000000";
michael@0 12 var color_count = 0;
michael@0 13 var last_paint_count = 0;
michael@0 14 // Enough paints to test reusing a surface after it has been
michael@0 15 // moved from front to back buffer.
michael@0 16 var final_paint_count = window.mozPaintCount + 10;
michael@0 17 var final_color = "FFFF0000";
michael@0 18
michael@0 19 // Using mozPaintCount to track when content has been updated as an
michael@0 20 // indication that the browser has received updates, instead of
michael@0 21 // plugin.getPaintCount() which tracks when the plugin sends updates or
michael@0 22 // MozAfterPaint events which track OS paints. Not using
michael@0 23 // MozPaintWaitFinished because invalidation causes no geometry changes.
michael@0 24 function wait_for_paints() {
michael@0 25 var paint_count = window.mozPaintCount;
michael@0 26 if (paint_count >= final_paint_count && color == final_color) {
michael@0 27 document.documentElement.removeAttribute("class");
michael@0 28 return;
michael@0 29 }
michael@0 30 if (paint_count != last_paint_count) {
michael@0 31 last_paint_count = paint_count;
michael@0 32 if (paint_count + 1 >= final_paint_count) {
michael@0 33 color = final_color;
michael@0 34 // Wait for the paint with the final color
michael@0 35 final_paint_count = paint_count + 1;
michael@0 36 } else {
michael@0 37 ++color_count;
michael@0 38 color = "FF00000" + color_count;
michael@0 39 }
michael@0 40 plugin.setColor(color);
michael@0 41 }
michael@0 42 setTimeout(wait_for_paints, 0);
michael@0 43 }
michael@0 44
michael@0 45 wait_for_paints();
michael@0 46 }
michael@0 47
michael@0 48 // MozReftestInvalidate is delivered after initial painting has settled.
michael@0 49 document.addEventListener("MozReftestInvalidate", start, false);
michael@0 50 </script>
michael@0 51 </head>
michael@0 52 <body>
michael@0 53 <embed id="plugin" type="application/x-test"
michael@0 54 drawmode="solid" color="FF000000" width="30" height="50">
michael@0 55 </embed>
michael@0 56 </body>
michael@0 57 </html>

mercurial