| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <script>window.enablePixelTesting = true;</script> | |
| <script src="../../fast/js/resources/js-test-pre.js"></script> | |
| <script src="../../fast/repaint/resources/repaint.js"></script> | |
| </head> | |
| <body style="margin: 0px"> | |
| <script type="text/javascript"> | |
| function test1() { | |
| object1 = document.getElementsByTagName("object")[0]; | |
| debug("Check initial <object> size, before external resource loaded"); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px"); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px"); | |
| } | |
| function repaintTest() { | |
| object1 = document.getElementsByTagName("object")[0]; | |
| debug(""); | |
| debug("Check initial <object> size, after external resource loaded - should not change."); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px"); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px"); | |
| if (window.testRunner) | |
| testRunner.waitUntilDone(); | |
| requestSizeChange(); | |
| } | |
| function requestSizeChange() { | |
| object1 = document.getElementsByTagName("object")[0]; | |
| var htmlDoc = object1.contentDocument; | |
| if (!htmlDoc) { | |
| setTimeout(requestSizeChange, 50); | |
| return; | |
| } | |
| var htmlWindow = htmlDoc.defaultView; | |
| // Wait until the embedded SVG (of the embedded HTML that we're loading), is loaded. | |
| if (htmlWindow.canChangeSize) { | |
| htmlWindow.changeSize(); | |
| test3(); | |
| } else | |
| setTimeout(requestSizeChange, 50); | |
| } | |
| function test3() { | |
| object1 = document.getElementsByTagName("object")[0]; | |
| debug(""); | |
| debug("Check final <object> size, after resizing finished"); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px"); | |
| shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px"); | |
| debug(""); | |
| debug("Test passed if you see two green rectangles"); | |
| completeTest(); | |
| } | |
| function completeTest() { | |
| var script = document.createElement("script"); | |
| script.onload = function() { | |
| if (window.testRunner) | |
| testRunner.notifyDone(); | |
| }; | |
| script.src = "../../fast/js/resources/js-test-post.js"; | |
| document.body.appendChild(script); | |
| } | |
| </script> | |
| <object style="border: 1px red solid; width: 400px; height: 200px;" onload="runRepaintTest()" data="resources/nested-embedded-svg-size-changes-target.html"></object> | |
| <p id="description"></p> | |
| <div id="console"></div> | |
| <script> | |
| description("This test checks that intrinsic size changes of an embedded SVG cause immediate updates of the object that embeds it."); | |
| test1(); | |
| </script> | |
| </body> | |
| </html> |