Skip to content

Truly independent web browser

1.4 KB
Raw Blame
<!DOCTYPE html>
<script src="include.js"></script>
<style>
    body {
        margin: 0;
        height: 2000px;
    }
    #nested {
        width: 100px;
        height: 100px;
        overflow: scroll;
    }
    #nested > div {
        height: 300px;
    }
</style>
<div id="nested"><div></div></div>
<script>
    promiseTest(async () => {
        // A blocking wheel event listener makes the compositor wait for the page before it scrolls these gestures.
        nested.addEventListener("wheel", () => {}, { passive: false });
        await animationFrame();
        await animationFrame();

        // The nested scroller reaches its extent during the gesture and absorbs the rest of it.
        await internals.wheel(50, 50, 0, 150, true, "ongoing");
        await internals.wheel(50, 50, 0, 150, true, "ongoing");
        await internals.wheel(50, 50, 0, 100, true, "ongoing");
        println(`nested.scrollTop mid-gesture: ${nested.scrollTop}`);
        println(`window.scrollY mid-gesture: ${window.scrollY}`);
        await internals.wheel(50, 50, 0, 0, true, "ended");

        // A new gesture over the nested scroller at its extent goes to the page.
        await internals.wheel(50, 50, 0, 100, true, "ongoing");
        println(`window.scrollY after a new gesture: ${window.scrollY}`);
        println(`nested.scrollTop after a new gesture: ${nested.scrollTop}`);
        await internals.wheel(50, 50, 0, 0, true, "ended");
    });
</script>