Truly independent web browser
<!doctype html>
<html id="html">
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
body { margin: 0; }
#root { position: relative; width: 100px; }
svg { display: block; }
</style>
<body id="body">
<div id="root"><svg id="svg" width="100" height="100"><path id="p" d="M10 10h80v80h-80z" fill="red" stroke="blue"/><circle id="circle" cx="50" cy="50" r="20" fill="green"/></svg></div>
<script>
displayListTest({
setup: removeBodyWhitespace,
steps: [
{
name: "quiet SVG",
expect: `
@canvas RECORD (empty)
@viewport COPY
`
},
{
name: "change SVG fill",
mutate: () => { p.setAttribute("fill", "blue"); },
check: equal => { equal(document.elementFromPoint(15, 15).id, "p", "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>#root/descendants(background-and-borders) ASSEMBLE
BlockContainer<BODY>#body/descendants(inline-background-and-borders) ASSEMBLE
BlockContainer<DIV>#root/descendants(inline-background-and-borders) ASSEMBLE
BlockContainer<HTML>#html/foreground COPY
BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
BlockContainer<BODY>#body/foreground COPY
BlockContainer<DIV>#root/descendants(foreground) ASSEMBLE
BlockContainer<BODY>#body/outline COPY
BlockContainer<BODY>#body/overlay COPY
BlockContainer<DIV>#root ASSEMBLE
BlockContainer<DIV>#root/scroll-metadata COPY
BlockContainer<DIV>#root/background COPY
BlockContainer<DIV>#root/border COPY
SVGSVGBox<svg>#svg/descendants(background-and-borders) ASSEMBLE
SVGSVGBox<svg>#svg/descendants(floats) ASSEMBLE
SVGSVGBox<svg>#svg/descendants(inline-background-and-borders) ASSEMBLE
BlockContainer<DIV>#root/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<path>#p/svg RECORD
SVGGeometryBox<path>#p/foreground RECORD
SVGGeometryBox<circle>#circle/svg RECORD
SVGGeometryBox<circle>#circle/foreground RECORD
BlockContainer<DIV>#root/outline COPY
BlockContainer<DIV>#root/overlay COPY
BlockContainer<HTML>#html/outline COPY
@viewport/outline COPY
`
},
{
name: "quiet after SVG change",
expect: `
@canvas RECORD (empty)
@viewport COPY
`
}
]
});
</script>