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;
    }

    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>html { overscroll-behavior: contain; }</style><body></body>";
        document.body.prepend(frame);
        await frameLoaded;
        await waitForCondition(() => internals.compositorWheelTargetAt(100, 75, 0, 50).decision === "scroll-kept-by-overscroll-behavior");

        // The frame has nothing to scroll, and its root keeps the scrolls from this document. The gesture stays latched
        // to the frame for all of its steps, which scroll nothing.
        internals.beginInputTrace();
        await internals.wheelThroughUIProcess(100, 75, 0, 50, true, "ongoing");
        await internals.wheelThroughUIProcess(100, 75, 0, 50, true, "ongoing");
        await internals.wheelThroughUIProcess(100, 75, 0, 0, true, "ended");
        printInputTrace(internals.takeInputTrace(), { stages: ["compositor"] });
        await animationFrame();
        await animationFrame();
        println(`window.scrollY: ${window.scrollY}`);
    });
</script>