Skip to content

Truly independent web browser

4.8 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; }
    #a, #b { position: relative; width: 200px; }
    .row { height: 20px; }
</style>
<body id="body">
<div id="a"><div class="row" id="a0">A 0</div><div class="row" id="a1">A 1</div></div>
<div id="b"><div class="row" id="b0">B 0</div></div>
<script>
displayListTest({
    setup: removeBodyWhitespace,
    steps: [
        {
            name: "quiet before insertion",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        },
        {
            // The inserted in-flow child changes B's height; A retains its entire capture.
            name: "insert positioned child into B",
            mutate: () => { const inserted = document.createElement("div"); inserted.id = "inserted"; inserted.className = "row"; inserted.style.position = "relative"; inserted.textContent = "B 1"; b.appendChild(inserted); },
            check: equal => { equal(document.elementFromPoint(10, 70).id, "inserted", "hit target"); },
            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) REPLAN
                  @viewport/foreground COPY
                  BlockContainer<HTML>#html/descendants(foreground) REPLAN
                  BlockContainer<HTML>#html REPLAN
                    BlockContainer<HTML>#html/preamble RECORD (empty)
                    BlockContainer<HTML>#html/scroll-metadata RECORD (empty)
                    BlockContainer<HTML>#html/background RECORD (empty)
                    BlockContainer<HTML>#html/border SKIP
                    BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE
                      BlockContainer<BODY>#body/scroll-metadata RECORD (empty)
                      BlockContainer<BODY>#body/background SKIP
                      BlockContainer<BODY>#body/border SKIP
                      BlockContainer<DIV>#a/descendants(background-and-borders) COPY
                      BlockContainer<DIV>#b/descendants(background-and-borders) REPLAN
                    BlockContainer<HTML>#html/foreground RECORD (empty)
                    BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
                      BlockContainer<BODY>#body/foreground RECORD (empty)
                      BlockContainer<DIV>#a/descendants(foreground) COPY
                      BlockContainer<DIV>#b/descendants(foreground) REPLAN
                      BlockContainer<BODY>#body/outline SKIP
                      BlockContainer<BODY>#body/overlay SKIP
                    BlockContainer<DIV>#a COPY
                    BlockContainer<DIV>#b REPLAN
                      BlockContainer<DIV>#b/scroll-metadata RECORD (empty)
                      BlockContainer<DIV>#b/background SKIP
                      BlockContainer<DIV>#b/border SKIP
                      BlockContainer<DIV>#b0.row/descendants(background-and-borders) COPY
                      BlockContainer<DIV>#inserted.row/descendants(background-and-borders) RECORD
                      BlockContainer<DIV>#b0.row/descendants(floats) COPY
                      BlockContainer<DIV>#inserted.row/descendants(floats) RECORD
                      BlockContainer<DIV>#b0.row/descendants(inline-background-and-borders) COPY
                      BlockContainer<DIV>#inserted.row/descendants(inline-background-and-borders) RECORD
                      BlockContainer<DIV>#b/foreground RECORD (empty)
                      BlockContainer<DIV>#b0.row/descendants(foreground) COPY
                      BlockContainer<DIV>#inserted.row/descendants(foreground) RECORD
                      BlockContainer<DIV>#b/outline SKIP
                      BlockContainer<DIV>#b/overlay SKIP
                    BlockContainer<DIV>#inserted.row RECORD
                      BlockContainer<DIV>#inserted.row/scroll-metadata RECORD (empty)
                      BlockContainer<DIV>#inserted.row/background SKIP
                      BlockContainer<DIV>#inserted.row/border SKIP
                      BlockContainer<DIV>#inserted.row/foreground RECORD
                      BlockContainer<DIV>#inserted.row/outline SKIP
                      BlockContainer<DIV>#inserted.row/overlay SKIP
                    BlockContainer<HTML>#html/outline SKIP
                  @viewport/outline COPY
            `
        },
        {
            name: "quiet after insertion",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        }
    ]
});
</script>