Chromium Code Reviews| 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> |
| 4 window.enablePixelTesting = true; | |
| 5 window.jsTestIsAsync = true; | |
| 6 </script> | |
| 4 <script src="../../resources/js-test.js"></script> | 7 <script src="../../resources/js-test.js"></script> |
| 5 <script src="../../fast/repaint/resources/repaint.js"></script> | 8 <script src="../../fast/repaint/resources/repaint.js"></script> |
| 6 <script type="text/javascript"> | 9 <script type="text/javascript"> |
| 7 function repaintTest() { | 10 function repaintTest() { |
| 8 // 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. |
| 9 newObject = document.createElement("object"); | 12 newObject = document.createElement("object"); |
| 10 newObject.setAttribute("style", "border: 1px black solid; background: re d"); | 13 newObject.setAttribute("style", "border: 1px black solid; background: re d"); |
| 11 shouldBe("newObject.offsetWidth", "0"); | 14 shouldBe("newObject.offsetWidth", "0"); |
| 12 shouldBe("newObject.offsetWidth", "0"); | 15 shouldBe("newObject.offsetWidth", "0"); |
| 13 | 16 |
| 14 // 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. |
| 15 document.body.insertBefore(newObject, document.getElementById("descripti on")); | 18 document.body.insertBefore(newObject, document.getElementById("descripti on")); |
| 16 shouldBe("newObject.offsetWidth", "302"); | 19 shouldBe("newObject.offsetWidth", "302"); |
| 17 shouldBe("newObject.offsetWidth", "302"); | 20 shouldBe("newObject.offsetWidth", "302"); |
| 18 | 21 |
| 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>". | 22 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="4 00" height="200"><rect width="400" height="200" fill="green"/></svg>". |
| 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. | |
| 21 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz 0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48L3N2Zz4="); | 23 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz 0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdC B3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48L3N2Zz4="); |
| 22 shouldBe("newObject.offsetWidth", "502"); | 24 |
| 23 shouldBe("newObject.offsetWidth", "502"); | 25 // The replacement isn't synchronous, wait before testing. |
| 26 setTimeout(function () { | |
| 27 shouldBe("newObject.offsetWidth", "402"); | |
| 28 shouldBe("newObject.offsetWidth", "402"); | |
| 29 finishJSTest(); | |
| 30 }, 50); | |
|
abarth-chromium
2014/01/14 18:11:45
This looks like it's going to be flaky.
eseidel
2014/01/15 00:09:41
Yeah, please find a non-time-based way. newobject
sof
2014/01/15 15:26:58
I used postMessage().
| |
| 24 } | 31 } |
| 25 </script> | 32 </script> |
| 26 </head> | 33 </head> |
| 27 <body style="margin: 0px" onload="runRepaintTest()"> | 34 <body style="margin: 0px" onload="runRepaintTest()"> |
| 28 | 35 |
| 29 <p id="description"></p> | 36 <p id="description"></p> |
| 30 <div id="console"></div> | 37 <div id="console"></div> |
| 31 | 38 |
| 32 <script> | 39 <script> |
| 33 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."); |
| 34 </script> | 41 </script> |
| 35 </body> | 42 </body> |
| 36 </html> | 43 </html> |
| OLD | NEW |