Skip to content

Truly independent web browser

4.0 KB
Raw Blame
<!doctype html>
<html id="html">
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
    body { margin: 0; }
    svg { display: block; }
</style>
<body id="body">
<svg id="svg" width="200" height="100"><rect id="rect" width="100" height="100" fill="url(#g)"/><rect id="other" x="100" width="100" height="100" fill="blue"/></svg>
<svg id="resources" width="0" height="0"><defs><linearGradient id="g"><stop id="s0" offset="0" stop-color="red"/><stop id="s1" offset="1" stop-color="red"/></linearGradient></defs></svg>
<script>
// A gradient reference is resolved when the paint resources are synced, and a change to the
// gradient pushes damage on the elements using it: a quiet frame copies the filled shape, an
// edited stop records it once, and the next frame copies it again.
displayListTest({
    setup: removeBodyWhitespace,
    steps: [
        {
            name: "quiet gradient fill",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        },
        {
            name: "edit a gradient stop",
            mutate: () => { s1.setAttribute("stop-color", "blue"); },
            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
                      SVGSVGBox<svg>#svg/descendants(background-and-borders) ASSEMBLE
                      SVGSVGBox<svg>#resources/descendants(background-and-borders) COPY
                    BlockContainer<BODY>#body/descendants(inline-background-and-borders) ASSEMBLE
                      SVGSVGBox<svg>#svg/descendants(inline-background-and-borders) ASSEMBLE
                      SVGSVGBox<svg>#resources/descendants(inline-background-and-borders) COPY
                    BlockContainer<HTML>#html/foreground COPY
                    BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
                      BlockContainer<BODY>#body/foreground COPY
                      SVGSVGBox<svg>#svg/descendants(foreground) 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>#rect/svg RECORD
                            SVGGeometryBox<rect>#rect/foreground RECORD
                          SVGGeometryBox<rect>#other/svg RECORD
                            SVGGeometryBox<rect>#other/foreground RECORD
                      SVGSVGBox<svg>#resources/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 gradient change",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        }
    ]
});
</script>