OLD | NEW |
1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 window.enablePixelTesting = true; | 4 window.enablePixelTesting = true; |
5 window.jsTestIsAsync = true; | 5 window.jsTestIsAsync = true; |
6 </script> | 6 </script> |
7 <script src="../../resources/js-test.js"></script> | 7 <script src="../../resources/js-test.js"></script> |
8 <script src="../../fast/repaint/resources/repaint.js"></script> | 8 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> |
9 <script type="text/javascript"> | 9 <script type="text/javascript"> |
10 function repaintTest() { | 10 function repaintTest() { |
11 // Test initial reported offsetWidth is 0, as we're not in the tree yet. | 11 // Test initial reported offsetWidth is 0, as we're not in the tree yet. |
12 newObject = document.createElement("object"); | 12 newObject = document.createElement("object"); |
13 newObject.setAttribute("style", "border: 1px black solid; background: re
d"); | 13 newObject.setAttribute("style", "border: 1px black solid; background: re
d"); |
14 shouldBe("newObject.offsetWidth", "0"); | 14 shouldBe("newObject.offsetWidth", "0"); |
15 shouldBe("newObject.offsetWidth", "0"); | 15 shouldBe("newObject.offsetWidth", "0"); |
16 | 16 |
17 // Test that the initial width is 300px + 1px border on each side. | 17 // Test that the initial width is 300px + 1px border on each side. |
18 document.body.insertBefore(newObject, document.getElementById("descripti
on")); | 18 document.body.insertBefore(newObject, document.getElementById("descripti
on")); |
19 shouldBe("newObject.offsetWidth", "302"); | 19 shouldBe("newObject.offsetWidth", "302"); |
20 shouldBe("newObject.offsetWidth", "302"); | 20 shouldBe("newObject.offsetWidth", "302"); |
21 | 21 |
22 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="4
00" height="200"><rect width="400" height="200" fill="green"/><script><![CDAT
A[window.parent.postMessage('running', '*');]]></script></svg>". | 22 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="4
00" height="200"><rect width="400" height="200" fill="green"/><script><![CDAT
A[window.parent.postMessage('running', '*');]]></script></svg>". |
23 | 23 |
24 // The replacement won't synchronous; wait on its completion. | 24 // The replacement won't synchronous; wait on its completion. |
25 window.onmessage = function () { | 25 window.onmessage = function () { |
26 shouldBe("newObject.offsetWidth", "402"); | 26 shouldBe("newObject.offsetWidth", "402"); |
27 shouldBe("newObject.offsetWidth", "402"); | 27 shouldBe("newObject.offsetWidth", "402"); |
28 finishJSTest(); | 28 finishJSTest(); |
29 }; | 29 }; |
30 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz
0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC
B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48c2NyaXB0PjwhW0NEQVRBW3dpbm
Rvdy5wYXJlbnQucG9zdE1lc3NhZ2UoJ3J1bm5pbmcnLCAnKicpO11dPjwvc2NyaXB0Pjwvc3ZnPg==")
; | 30 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz
0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC
B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48c2NyaXB0PjwhW0NEQVRBW3dpbm
Rvdy5wYXJlbnQucG9zdE1lc3NhZ2UoJ3J1bm5pbmcnLCAnKicpO11dPjwvc2NyaXB0Pjwvc3ZnPg==")
; |
31 } | 31 } |
32 </script> | 32 </script> |
33 </head> | 33 </head> |
34 <body style="margin: 0px" onload="runRepaintTest()"> | 34 <body style="margin: 0px" onload="forceStyleRecalc();repaintTest();"> |
35 | 35 |
36 <p id="description"></p> | 36 <p id="description"></p> |
37 <div id="console"></div> | 37 <div id="console"></div> |
38 | 38 |
39 <script> | 39 <script> |
40 description("Tests that querying offsetWidth twice leads to the same result
- no red background should be visible."); | 40 description("Tests that querying offsetWidth twice leads to the same result
- no red background should be visible."); |
41 </script> | 41 </script> |
42 </body> | 42 </body> |
43 </html> | 43 </html> |
OLD | NEW |