Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
body { margin: 0; }
#host { width: 50px; height: 50px; }
#child { width: 100px; height: 50px; background: green; }
</style>
<div id="host"><div id="child"></div></div>
<script>
const overflowingContent = () => document.elementFromPoint(75, 10);
visualContextTest({
setup: async () => {
internals.forceIncompatibleVisualContextTreeRebuild();
while (internals.frameSchedulerState() !== "idle")
await new Promise(resolve => setTimeout(resolve, 0));
},
steps: [
{
name: "without containment",
check: equal => equal(overflowingContent().id, "child", "overflowing content"),
expect: ``,
},
{
name: "paint containment",
mutate: () => { host.style.contain = "paint"; },
check: equal => equal(overflowingContent().tagName, "BODY", "overflowing content"),
expect: `
update DIRTY-PATH
div#host clip ALLOCATED
recording NEEDED
`,
},
{
name: "containment removed",
mutate: () => { host.style.contain = "none"; },
check: equal => equal(overflowingContent().id, "child", "overflowing content"),
expect: `
update DIRTY-PATH
div#host clip RELEASED
epoch NEW
recording NEEDED
`,
},
],
});
</script>