Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
}
#scroller {
width: 200px;
height: 200px;
overflow: scroll;
scroll-snap-type: y mandatory;
}
.item {
width: 400px;
height: 200px;
scroll-snap-align: start;
}
#inner {
width: 150px;
height: 100px;
overflow: scroll;
}
#inner > div {
height: 200px;
}
</style>
<div id="scroller">
<div class="item"><div id="inner"><div></div></div></div>
<div class="item"></div>
<div class="item"></div>
</div>
<script>
promiseTest(async () => {
await animationFrame();
await animationFrame();
// The compositor selects the snap positions of the wheel scrolls it performs itself, so a snap container is
// scrolled on it whatever the input's precision or gesture phase.
println(`wheel along the snapping axis: ${wheelTargetToString(internals.compositorWheelTargetAt(175, 150, 0, 50))}`);
println(`wheel across the snapping axis: ${wheelTargetToString(internals.compositorWheelTargetAt(175, 150, 50, 0))}`);
// The inner scroller reaches its scroll extent, so a wheel over it chains to the snap container around it.
document.getElementById("inner").scrollTop = 100;
await animationFrame();
await animationFrame();
println(`wheel chained to the snap container: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 50))}`);
});
</script>