Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / as-object / embedded-svg-size-changes.html
blobb0a15ecaefecf8e758b9079136d9371c3c95b78d
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../resources/js-test.js"></script>
5 <script src="../../fast/repaint/resources/text-based-repaint.js"></script>
6 </head>
7 <body style="margin: 0px" onload="runRepaintAndPixelTest()">
9 <script type="text/javascript">
10 window.outputRepaintRects = false;
11 function test1() {
12 object1 = document.getElementsByTagName("object")[0];
13 debug("Check initial &lt;object&gt; size, before external resource loaded");
15 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "300px");
16 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "150px");
19 function repaintTest() {
20 object1 = document.getElementsByTagName("object")[0];
22 debug("");
23 debug("Check initial &lt;object&gt; size, after external resource loaded");
24 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "200px");
25 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
27 setTimeout(function() {
28 var svgDoc = object1.getSVGDocument();
29 var svgWindow = svgDoc.defaultView;
30 svgWindow.changeSize();
31 test3();
32 }, 0);
35 function test3() {
36 object1 = document.getElementsByTagName("object")[0];
38 debug("");
39 debug("Check final &lt;object&gt; size, after resizing finished");
40 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
41 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
43 debug("");
44 debug("Test passed if you see two green rectangles");
46 finishJSTest();
48 </script>
50 <object style="border: 1px red solid" data="resources/embedded-svg-size-changes.svg"></object>
51 <p id="description"></p>
52 <div id="console"></div>
54 <script>
55 window.jsTestIsAsync = true;
56 if (window.testRunner)
57 testRunner.waitUntilDone();
58 description("This test checks that intrinsic size changes of an embedded SVG cause immediate updates of the object that embeds it.");
59 test1();
60 </script>
61 </body>
62 </html>