Skip to content

Truly independent web browser

4.9 KB
Raw Blame
<!doctype html>
<html id="html">
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
    body { margin: 0; font: 16px/20px monospace; }
</style>
<body id="body">
<svg id="svg" width="200" height="200">
    <mask id="m" maskUnits="userSpaceOnUse" x="0" y="0" width="200" height="200">
        <rect id="mask-rect" width="100" height="200" fill="white"/>
    </mask>
    <g id="group" mask="url(#m)"><rect id="masked" width="200" height="100"/></g>
</svg>
<div id="other">other</div>
<script>
// Mask contents are recorded by the element referencing the mask, inside the svg root's
// producer. A quiet frame copies them, and a change inside the mask records the svg again while
// the rest of the frame is copied.
displayListTest({
    setup: removeBodyWhitespace,
    steps: [
        {
            name: "quiet masked group",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        },
        {
            name: "widen the mask content",
            mutate: () => { document.getElementById("mask-rect").setAttribute("width", "200"); },
            expect: `
                @canvas RECORD (empty)
                @viewport ASSEMBLE
                  @viewport/preamble COPY
                  @viewport/scroll-metadata COPY
                  @viewport/background COPY
                  @viewport/border COPY
                  BlockContainer<HTML>#html/descendants(background-and-borders) ASSEMBLE
                  @viewport/foreground COPY
                  BlockContainer<HTML>#html/descendants(foreground) ASSEMBLE
                  BlockContainer<HTML>#html ASSEMBLE
                    BlockContainer<HTML>#html/preamble COPY
                    BlockContainer<HTML>#html/scroll-metadata COPY
                    BlockContainer<HTML>#html/background COPY
                    BlockContainer<HTML>#html/border COPY
                    BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE
                      BlockContainer<BODY>#body/scroll-metadata COPY
                      BlockContainer<BODY>#body/background COPY
                      BlockContainer<BODY>#body/border COPY
                      BlockContainer(anonymous)/descendants(background-and-borders) ASSEMBLE
                        BlockContainer(anonymous)/scroll-metadata COPY
                        BlockContainer(anonymous)/background COPY
                        BlockContainer(anonymous)/border COPY
                      BlockContainer<DIV>#other/descendants(background-and-borders) COPY
                    BlockContainer<BODY>#body/descendants(inline-background-and-borders) ASSEMBLE
                      BlockContainer(anonymous)/descendants(inline-background-and-borders) ASSEMBLE
                      BlockContainer<DIV>#other/descendants(inline-background-and-borders) COPY
                    BlockContainer<HTML>#html/foreground COPY
                    BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
                      BlockContainer<BODY>#body/foreground COPY
                      BlockContainer(anonymous)/descendants(foreground) ASSEMBLE
                        SVGSVGBox<svg>#svg ASSEMBLE
                          SVGSVGBox<svg>#svg/scroll-metadata RECORD (empty)
                          SVGSVGBox<svg>#svg/background SKIP
                          SVGSVGBox<svg>#svg/border SKIP
                          SVGSVGBox<svg>#svg/svg RECORD
                            SVGSVGBox<svg>#svg/foreground RECORD (empty)
                            SVGGraphicsBox<g>#group/svg RECORD
                              SVGGraphicsBox<g>#group/svg-mask RECORD
                                SVGMaskBox<mask>#m/background RECORD (empty)
                                SVGMaskBox<mask>#m/border RECORD (empty)
                                SVGMaskBox<mask>#m/svg RECORD
                                  SVGMaskBox<mask>#m/foreground RECORD (empty)
                                  SVGGeometryBox<rect>#mask-rect/svg RECORD
                                    SVGGeometryBox<rect>#mask-rect/foreground RECORD
                              SVGGraphicsBox<g>#group/foreground RECORD (empty)
                              SVGGeometryBox<rect>#masked/svg RECORD
                                SVGGeometryBox<rect>#masked/foreground RECORD
                        BlockContainer(anonymous)/foreground COPY
                        BlockContainer(anonymous)/outline COPY
                        BlockContainer(anonymous)/overlay COPY
                      BlockContainer<DIV>#other/descendants(foreground) COPY
                      BlockContainer<BODY>#body/outline COPY
                      BlockContainer<BODY>#body/overlay COPY
                    BlockContainer<HTML>#html/outline COPY
                  @viewport/outline COPY
            `
        },
        {
            name: "quiet after the mask change",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        }
    ]
});
</script>