Truly independent web browser
<!doctype html>
<html id="html">
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
body { margin: 0; font: 16px/20px monospace; }
#block { width: 200px; }
#flex { display: flex; width: 200px; height: 30px; }
.item { flex: none; width: 60px; }
</style>
<body id="body">
<div id="block"><div id="moved">moved</div></div><div id="flex"><div class="item" id="stay">stay</div></div>
<script>
// Moving a block into a flex container records it as a flex item and replans both containers.
displayListTest({
setup: removeBodyWhitespace,
steps: [
{
name: "quiet before reparenting",
check: equal => {
equal(document.elementFromPoint(10, 10).id, "moved", "hit target on the block child");
equal(document.elementFromPoint(10, 30).id, "stay", "hit target on the flex item");
},
expect: `
@canvas RECORD (empty)
@viewport COPY
`
},
{
name: "move the block into the flex container",
mutate: () => { moved.className = "item"; flex.appendChild(moved); },
check: equal => {
equal(document.elementFromPoint(10, 10).id, "stay", "hit target on the first item");
equal(document.elementFromPoint(70, 10).id, "moved", "hit target on the moved item");
},
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 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>#block/descendants(background-and-borders) REPLAN
BlockContainer<DIV>#block/scroll-metadata RECORD (empty)
BlockContainer<DIV>#block/background SKIP
BlockContainer<DIV>#block/border SKIP
Box<DIV>#flex/descendants(background-and-borders) REPLAN
Box<DIV>#flex/scroll-metadata RECORD (empty)
Box<DIV>#flex/background SKIP
Box<DIV>#flex/border SKIP
BlockContainer<DIV>#stay.item/descendants(background-and-borders) ASSEMBLE
BlockContainer<DIV>#moved.item/descendants(background-and-borders) RECORD
BlockContainer<HTML>#html/foreground RECORD (empty)
BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
BlockContainer<BODY>#body/foreground RECORD (empty)
BlockContainer<DIV>#block/descendants(foreground) REPLAN
BlockContainer<DIV>#block/foreground RECORD (empty)
BlockContainer<DIV>#block/outline SKIP
BlockContainer<DIV>#block/overlay SKIP
Box<DIV>#flex/descendants(foreground) REPLAN
Box<DIV>#flex/foreground RECORD (empty)
BlockContainer<DIV>#stay.item/descendants(foreground) ASSEMBLE
BlockContainer<DIV>#stay.item/scroll-metadata RECORD (empty)
BlockContainer<DIV>#stay.item/background SKIP
BlockContainer<DIV>#stay.item/border SKIP
BlockContainer<DIV>#stay.item/foreground RECORD
BlockContainer<DIV>#stay.item/outline SKIP
BlockContainer<DIV>#stay.item/overlay SKIP
BlockContainer<DIV>#moved.item/descendants(foreground) RECORD
BlockContainer<DIV>#moved.item/scroll-metadata RECORD (empty)
BlockContainer<DIV>#moved.item/background SKIP
BlockContainer<DIV>#moved.item/border SKIP
BlockContainer<DIV>#moved.item/foreground RECORD
BlockContainer<DIV>#moved.item/outline SKIP
BlockContainer<DIV>#moved.item/overlay SKIP
Box<DIV>#flex/outline SKIP
Box<DIV>#flex/overlay SKIP
BlockContainer<BODY>#body/outline SKIP
BlockContainer<BODY>#body/overlay SKIP
BlockContainer<HTML>#html/outline SKIP
@viewport/outline COPY
`
}
]
});
</script>