Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
height: 2000px;
}
iframe {
display: block;
width: 200px;
height: 150px;
border: 0;
}
</style>
<script>
promiseTest(async () => {
const frame = document.createElement("iframe");
const frameLoaded = new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));
frame.srcdoc = "<style>body { margin: 0; } div { width: 100px; height: 100px; overflow: auto; overscroll-behavior: contain; }</style><div id='box'></div>";
document.body.prepend(frame);
await frameLoaded;
await waitForCondition(() => internals.compositorWheelTargetAt(50, 50, 0, 50).decision === "scroll-kept-by-overscroll-behavior");
// The box in the frame has nothing to scroll, and keeps its scrolls from the frame and from this document. The
// compositor keeps every step of the gesture there, without scrolling anything.
internals.beginInputTrace();
await internals.wheelThroughUIProcess(50, 50, 0, 50, true, "ongoing");
await internals.wheelThroughUIProcess(50, 50, 0, 50, true, "ongoing");
await internals.wheelThroughUIProcess(50, 50, 0, 0, true, "ended");
printInputTrace(internals.takeInputTrace(), { stages: ["compositor"] });
await animationFrame();
await animationFrame();
println(`window.scrollY: ${window.scrollY}`);
});
</script>