|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test that scrolling a windowless plugin doesn't force us to repaint it</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="utils.js"></script> |
|
7 <script type="text/javascript"> |
|
8 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
9 </script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 </head> |
|
12 <body onload="runTest()"> |
|
13 <p id="display"></p> |
|
14 <embed id="plugin" type="application/x-test" style="width:50px; height:10px; margin-top:20px;"></embed> |
|
15 </div> |
|
16 <div id="content" style="display: none"> |
|
17 |
|
18 </div> |
|
19 <pre id="test"> |
|
20 </pre> |
|
21 |
|
22 <script type="application/javascript"> |
|
23 SimpleTest.waitForExplicitFinish(); |
|
24 |
|
25 var container = document.documentElement; |
|
26 container.scrollTop = 0; |
|
27 var plugin = document.getElementById("plugin"); |
|
28 var pluginTop; |
|
29 var beforeScrollPaintCount; |
|
30 |
|
31 function waitForScroll() { |
|
32 if (plugin.getEdge(1) >= pluginTop) { |
|
33 setTimeout(waitForScroll, 0); |
|
34 return; |
|
35 } |
|
36 |
|
37 is(plugin.getPaintCount(), beforeScrollPaintCount, "plugin should not paint due to scrolling"); |
|
38 SimpleTest.finish(); |
|
39 } |
|
40 |
|
41 function waitForInitialScroll() { |
|
42 if (plugin.getEdge(1) >= pluginTop) { |
|
43 setTimeout(waitForInitialScroll, 0); |
|
44 return; |
|
45 } |
|
46 |
|
47 pluginTop = plugin.getEdge(1); |
|
48 beforeScrollPaintCount = plugin.getPaintCount(); |
|
49 container.scrollTop = 20; |
|
50 waitForScroll(); |
|
51 } |
|
52 |
|
53 function runTest() { |
|
54 document.body.offsetTop; |
|
55 pluginTop = plugin.getEdge(1); |
|
56 container.scrollTop = 10; |
|
57 waitForInitialScroll(); |
|
58 } |
|
59 </script> |
|
60 |
|
61 <div style="height:4000px;"></div> |
|
62 |
|
63 </body> |
|
64 </html> |