Skip to content

Truly independent web browser

3.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; }
    #wrap, #other { width: 200px; }
</style>
<body id="body">
<div id="wrap"><div id="inner">inner text</div></div><div id="other">other text</div>
<script>
// A clip added on an ancestor changes the visual context of everything below it, which records
// again under the new context, while the sibling outside the clip is copied.
displayListTest({
    setup: removeBodyWhitespace,
    steps: [
        {
            name: "clip the wrapper",
            mutate: () => { wrap.style.overflow = "hidden"; },
            check: equal => { equal(document.elementFromPoint(10, 10).id, "inner", "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) 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<DIV>#wrap/descendants(background-and-borders) ASSEMBLE
                        BlockContainer<DIV>#wrap/scroll-metadata RECORD (empty)
                        BlockContainer<DIV>#wrap/background SKIP
                        BlockContainer<DIV>#wrap/border SKIP
                        BlockContainer<DIV>#inner/descendants(background-and-borders) ASSEMBLE
                          BlockContainer<DIV>#inner/scroll-metadata RECORD (empty)
                          BlockContainer<DIV>#inner/background SKIP
                          BlockContainer<DIV>#inner/border SKIP
                      BlockContainer<DIV>#other/descendants(background-and-borders) COPY
                    BlockContainer<HTML>#html/foreground COPY
                    BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
                      BlockContainer<BODY>#body/foreground COPY
                      BlockContainer<DIV>#wrap/descendants(foreground) ASSEMBLE
                        BlockContainer<DIV>#wrap/foreground RECORD (empty)
                        BlockContainer<DIV>#inner/descendants(foreground) ASSEMBLE
                          BlockContainer<DIV>#inner/foreground RECORD
                          BlockContainer<DIV>#inner/outline SKIP
                          BlockContainer<DIV>#inner/overlay SKIP
                        BlockContainer<DIV>#wrap/outline SKIP
                        BlockContainer<DIV>#wrap/overlay SKIP
                      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 clipping",
            expect: `
                @canvas RECORD (empty)
                @viewport COPY
            `
        }
    ]
});
</script>