Skip to content

Truly independent web browser

1.2 KB
Raw Blame
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="../expected/elastic-overscroll-viewport-ref.html">
<script src="wpt-import/common/reftest-wait.js"></script>
<style>
    html {
        background: lightyellow;
    }
    body {
        margin: 0;
        height: 3000px;
    }
    #sticky {
        position: sticky;
        top: 0;
        height: 40px;
        background: steelblue;
    }
    #content {
        height: 200px;
        background: darkseagreen;
    }
    #fixed {
        position: fixed;
        top: 10px;
        right: 10px;
        width: 60px;
        height: 60px;
        background: tomato;
    }
</style>
<div id="sticky"></div>
<div id="content"></div>
<div id="fixed"></div>
<script>
    const animationFrame = () => new Promise(resolve => requestAnimationFrame(resolve));

    (async () => {
        await animationFrame();
        await animationFrame();

        // One gesture scrolls down and then back past the top, which the last 400px of it pull the page 20px past.
        await internals.wheel(100, 100, 0, 100, true, "ongoing");
        await internals.wheel(100, 100, 0, -500, true, "ongoing");

        await animationFrame();
        takeScreenshot();
    })();
</script>