chromium/third_party/blink/web_tests/paint/invalidation/svg/nested-embedded-svg-size-changes.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>window.enablePixelTesting = true;</script>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/text-based-repaint.js"></script>
</head>
<body style="margin: 0px">
<script type="text/javascript">
    window.jsTestIsAsync = true;
    window.outputRepaintRects = false;
    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="runRepaintAndPixelTest()" 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>