| 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>window.enablePixelTesting = true;</script> | 3 <script>window.enablePixelTesting = true;</script> |
| 4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 5 <script src="../../fast/repaint/resources/repaint.js"></script> | 5 <script src="../../fast/repaint/resources/repaint.js"></script> |
| 6 <script type="text/javascript"> | 6 <script type="text/javascript"> |
| 7 function completeTest() { | |
| 8 var script = document.createElement("script"); | |
| 9 | |
| 10 script.onload = function() { | |
| 11 if (window.testRunner) | |
| 12 testRunner.notifyDone(); | |
| 13 }; | |
| 14 | |
| 15 script.src = "../../fast/js/resources/js-test-post.js"; | |
| 16 document.body.appendChild(script); | |
| 17 } | |
| 18 | |
| 19 function repaintTest() { | 7 function repaintTest() { |
| 20 if (window.testRunner) | |
| 21 testRunner.waitUntilDone(); | |
| 22 | |
| 23 // Test initial reported offsetWidth is 0, as we're not in the tree yet. | 8 // Test initial reported offsetWidth is 0, as we're not in the tree yet. |
| 24 newObject = document.createElement("object"); | 9 newObject = document.createElement("object"); |
| 25 newObject.setAttribute("style", "border: 1px black solid; background: re
d"); | 10 newObject.setAttribute("style", "border: 1px black solid; background: re
d"); |
| 26 shouldBe("newObject.offsetWidth", "0"); | 11 shouldBe("newObject.offsetWidth", "0"); |
| 27 shouldBe("newObject.offsetWidth", "0"); | 12 shouldBe("newObject.offsetWidth", "0"); |
| 28 | 13 |
| 29 // Test that the initial width is 300px + 1px border on each side. | 14 // Test that the initial width is 300px + 1px border on each side. |
| 30 document.body.insertBefore(newObject, document.getElementById("descripti
on")); | 15 document.body.insertBefore(newObject, document.getElementById("descripti
on")); |
| 31 shouldBe("newObject.offsetWidth", "302"); | 16 shouldBe("newObject.offsetWidth", "302"); |
| 32 shouldBe("newObject.offsetWidth", "302"); | 17 shouldBe("newObject.offsetWidth", "302"); |
| 33 | 18 |
| 34 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="4
00" height="200"><rect width="400" height="200" fill="green"/></svg>". | 19 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="4
00" height="200"><rect width="400" height="200" fill="green"/></svg>". |
| 35 // FIXME: This currently fails in WebKit trunk. We don't react on dataAt
tr changes at all. When manually relayouting using eg. zoom in/out it takes affe
ct. | 20 // FIXME: This currently fails in WebKit trunk. We don't react on dataAt
tr changes at all. When manually relayouting using eg. zoom in/out it takes affe
ct. |
| 36 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz
0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC
B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48L3N2Zz4="); | 21 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz
0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC
B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48L3N2Zz4="); |
| 37 shouldBe("newObject.offsetWidth", "502"); | 22 shouldBe("newObject.offsetWidth", "502"); |
| 38 shouldBe("newObject.offsetWidth", "502"); | 23 shouldBe("newObject.offsetWidth", "502"); |
| 39 | |
| 40 completeTest(); | |
| 41 } | 24 } |
| 42 </script> | 25 </script> |
| 43 </head> | 26 </head> |
| 44 <body style="margin: 0px" onload="runRepaintTest()"> | 27 <body style="margin: 0px" onload="runRepaintTest()"> |
| 45 | 28 |
| 46 <p id="description"></p> | 29 <p id="description"></p> |
| 47 <div id="console"></div> | 30 <div id="console"></div> |
| 48 | 31 |
| 49 <script> | 32 <script> |
| 50 description("Tests that querying offsetWidth twice leads to the same result
- no red background should be visible."); | 33 description("Tests that querying offsetWidth twice leads to the same result
- no red background should be visible."); |
| 51 </script> | 34 </script> |
| 52 </body> | 35 </body> |
| 53 </html> | 36 </html> |
| OLD | NEW |