Skip to content

Truly independent web browser

4.7 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">
    <clipPath id="c"><rect id="clip-rect" width="100" height="100"/></clipPath>
    <rect id="clipped" clip-path="url(#c)" width="200" height="100" fill="red"/>
</svg>
<div id="other">other</div>
<script>
// Clip path contents are recorded by the element referencing the clip path, inside the svg
// root's producer. A quiet frame copies them, and a change inside the clip path records the svg
// again while the rest of the frame is copied.
displayListTest({
    setup: removeBodyWhitespace,
    steps: [
        {
            name: "quiet clipped shape",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        },
        {
            name: "widen the clip content",
            mutate: () => { document.getElementById("clip-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)
                            SVGGeometryBox<rect>#clipped/svg RECORD
                              SVGGeometryBox<rect>#clipped/svg-clip RECORD
                                SVGClipBox<clipPath>#c/background RECORD (empty)
                                SVGClipBox<clipPath>#c/border RECORD (empty)
                                SVGClipBox<clipPath>#c/svg RECORD
                                  SVGClipBox<clipPath>#c/foreground RECORD (empty)
                                  SVGGeometryBox<rect>#clip-rect/svg RECORD
                                    SVGGeometryBox<rect>#clip-rect/foreground RECORD
                              SVGGeometryBox<rect>#clipped/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 clip change",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        }
    ]
});
</script>