Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / as-object / nested-embedded-svg-size-changes.html
blob001410f753a9d9f5d63e480ce99e95f6b2acf467
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">
8 <script type="text/javascript">
9 window.jsTestIsAsync = true;
10 window.outputRepaintRects = false;
11 if (window.testRunner)
12 testRunner.waitUntilDone();
14 function test1() {
15 object1 = document.getElementsByTagName("object")[0];
16 debug("Check initial &lt;object&gt; size, before external resource loaded");
18 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
19 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
22 function repaintTest() {
23 object1 = document.getElementsByTagName("object")[0];
25 debug("");
26 debug("Check initial &lt;object&gt; size, after external resource loaded - should not change.");
27 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
28 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
30 requestSizeChange();
33 function requestSizeChange() {
34 object1 = document.getElementsByTagName("object")[0];
35 var htmlDoc = object1.contentDocument;
36 if (!htmlDoc) {
37 setTimeout(requestSizeChange, 50);
38 return;
41 var htmlWindow = htmlDoc.defaultView;
42 // Wait until the embedded SVG (of the embedded HTML that we're loading), is loaded.
43 if (htmlWindow.canChangeSize) {
44 htmlWindow.changeSize();
45 test3();
46 } else
47 setTimeout(requestSizeChange, 50);
50 function test3() {
51 object1 = document.getElementsByTagName("object")[0];
53 debug("");
54 debug("Check final &lt;object&gt; size, after resizing finished");
55 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
56 shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
58 debug("");
59 debug("Test passed if you see two green rectangles");
61 finishJSTest();
63 </script>
65 <object style="border: 1px red solid; width: 400px; height: 200px;" onload="runRepaintAndPixelTest()" data="resources/nested-embedded-svg-size-changes-target.html"></object>
66 <p id="description"></p>
67 <div id="console"></div>
69 <script>
70 description("This test checks that intrinsic size changes of an embedded SVG cause immediate updates of the object that embeds it.");
71 test1();
72 </script>
73 </body>
74 </html>