Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
height: 2000px;
}
#a, #b {
position: absolute;
left: 0;
width: 200px;
}
#a {
top: 0;
height: 200px;
}
#b {
top: 200px;
height: 300px;
}
</style>
<div id="a"></div>
<div id="b"></div>
<script>
promiseTest(async () => {
const targets = [];
for (const element of [a, b])
element.addEventListener("wheel", event => targets.push(event.currentTarget.id), { passive: true });
await animationFrame();
await animationFrame();
// The compositor scrolls the page by each step before the page sees it, and #b slides under the cursor with the
// second step; the gesture's wheel events keep going to #a. Its end, a step that moves along no axis, goes to
// the page as no wheel event.
await internals.wheel(50, 50, 0, 100, true, "ongoing");
await internals.wheel(50, 50, 0, 100, true, "ongoing");
await internals.wheel(50, 50, 0, 0, true, "ended");
await internals.wheel(50, 50, 0, 100, true, "ongoing");
await internals.wheel(50, 50, 0, 0, true, "ended");
println(`wheel event targets: ${targets.join(",")}`);
println(`window.scrollY: ${window.scrollY}`);
});
</script>