Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / as-object / embedded-svg-immediate-offsetWidth-query.html
blob77144537624a565a211b5d9f4e20b0ecc613d7d3
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script>
4 window.enablePixelTesting = true;
5 window.jsTestIsAsync = true;
6 </script>
7 <script src="../../resources/js-test.js"></script>
8 <script src="../../resources/run-after-layout-and-paint.js"></script>
9 <script type="text/javascript">
10 function repaintTest() {
11 // Test initial reported offsetWidth is 0, as we're not in the tree yet.
12 newObject = document.createElement("object");
13 newObject.setAttribute("style", "border: 1px black solid; background: red");
14 shouldBe("newObject.offsetWidth", "0");
15 shouldBe("newObject.offsetWidth", "0");
17 // Test that the initial width is 300px + 1px border on each side.
18 document.body.insertBefore(newObject, document.getElementById("description"));
19 shouldBe("newObject.offsetWidth", "302");
20 shouldBe("newObject.offsetWidth", "302");
22 // Switch to document: "<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200"><rect width="400" height="200" fill="green"/>&lt;script><![CDATA[window.parent.postMessage('running', '*');]]>&lt;/script></svg>".
24 // The replacement won't synchronous; wait on its completion.
25 window.onmessage = function () {
26 shouldBe("newObject.offsetWidth", "402");
27 shouldBe("newObject.offsetWidth", "402");
28 finishJSTest();
30 newObject.setAttribute("data", "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iMjAwIj48cmVjdCB3aWR0aD0iNDAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iZ3JlZW4iLz48c2NyaXB0PjwhW0NEQVRBW3dpbmRvdy5wYXJlbnQucG9zdE1lc3NhZ2UoJ3J1bm5pbmcnLCAnKicpO11dPjwvc2NyaXB0Pjwvc3ZnPg==");
32 </script>
33 </head>
34 <body style="margin: 0px" onload="runAfterLayoutAndPaint(repaintTest);">
36 <p id="description"></p>
37 <div id="console"></div>
39 <script>
40 description("Tests that querying offsetWidth twice leads to the same result - no red background should be visible.");
41 </script>
42 </body>
43 </html>