Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="include.js"></script>
<style>
    #scroller {
        width: 200px;
        height: 200px;
        overflow: scroll;
        scroll-snap-type: y mandatory;
    }
    .item {
        width: 100%;
        height: 200px;
        scroll-snap-align: start;
    }
</style>
<div id="scroller">
    <div class="item"></div>
    <div style="height: 60px"></div>
    <div class="item"></div>
    <div class="item"></div>
</div>
<script>
    promiseTest(async () => {
        internals.setDevicePixelRatio(2);
        await animationFrame();
        await animationFrame();

        // The compositor reads the device pixel ratio from the display list it is sent, and converts the snap
        // position it selects in CSS pixels to the device pixels it scrolls in.
        await scrollSettled(scroller, () => internals.wheel(50, 50, 0, 40));
        println(`scroll offset after a downward step: ${scroller.scrollLeft},${scroller.scrollTop}`);
        await scrollSettled(scroller, () => internals.wheel(50, 50, 0, 40));
        println(`scroll offset after another downward step: ${scroller.scrollLeft},${scroller.scrollTop}`);
    });
</script>