blob: 937f28c163456b38952138373b6c7d376570841d [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>window.enablePixelTesting = true;</script>
<script src="../../resources/js-test.js"></script>
<script src="../../fast/repaint/resources/repaint.js"></script>
</head>
<body style="margin: 0px">
<script type="text/javascript">
window.jsTestIsAsync = true;
if (window.testRunner)
testRunner.waitUntilDone();
function test1() {
object1 = document.getElementsByTagName("object")[0];
debug("Check initial &lt;object&gt; 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 &lt;object&gt; size, after external resource loaded - should not change.");
shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
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 &lt;object&gt; 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");
finishJSTest();
}
</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>