Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
}
#scroller {
width: 100px;
height: 100px;
overflow: scroll;
}
#spacer {
width: 500px;
height: 500px;
}
</style>
<div id="scroller"><div id="spacer"></div></div>
<div style="height: 2000px"></div>
<script>
function printOutputAndDisplayList(output) {
const displayList = internals.dumpDisplayList();
for (const line of output)
println(line);
println("display list:");
println(displayList);
}
promiseTest(async () => {
await animationFrame();
await animationFrame();
const state = internals.compositorScrollState();
const output = [
`scroll node count: ${state.scrollNodeCount}`,
`scroll nodes: ${state.scrollNodes.length}`,
];
const viewportNode = state.scrollNodes.find(node => node.isViewport);
output.push(`has viewport node: ${!!viewportNode}`);
output.push(`viewport parent: ${viewportNode?.parentScrollNodeIndex ?? "missing"}`);
const childNodes = state.scrollNodes.filter(node => !node.isViewport);
output.push(`child nodes: ${childNodes.length}`);
for (const node of childNodes) {
output.push(`child parent is viewport: ${node.parentScrollNodeIndex === viewportNode.scrollNodeIndex}`);
}
printOutputAndDisplayList(output);
});
</script>