Skip to content

Truly independent web browser

1.5 KB
Raw Blame
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="../../expected/svg/green-square-100-ref.html" />
<svg width="100" height="100">
    <pattern id="template" patternUnits="userSpaceOnUse" width="100" height="100" />
    <!-- Only the inheriting pattern has content and a viewBox, which it maps onto the tile the
         template's attributes size. Until the template is 200 wide, half of each tile is empty. -->
    <pattern id="p" href="#template" viewBox="0 0 100 100" preserveAspectRatio="none">
        <rect width="50" height="100" fill="green" />
    </pattern>
    <rect width="100" height="100" fill="red" />
    <rect width="100" height="100" fill="url(#p)" />
</svg>
<script>
    requestAnimationFrame(() => {
        requestAnimationFrame(() => {
            document.getElementById("template").setAttribute("width", "200");
            // FIXME: A change to the template alone does not lay the inheriting pattern's box out
            //        again, so rebuild the boxes to have layout read the pattern's attributes anew.
            const svg = document.querySelector("svg");
            svg.style.display = "none";
            svg.getBoundingClientRect();
            svg.style.display = "";
            requestAnimationFrame(() => {
                if (window.internals)
                    internals.signalTestIsDone("PASS");
                else
                    document.documentElement.classList.remove("reftest-wait");
            });
        });
    });
</script>
</html>