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