Skip to content

Truly independent web browser

1.2 KB
Raw Blame
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="../expected/viewport-overflow-propagation-origin-starts-clipping-ref.html">
<style>
    html, body {
        margin: 0;
    }
    body {
        height: 100px;
        overflow: hidden;
        background: white;
    }
    #inside {
        width: 50px;
        height: 50px;
        background: green;
    }
    #overflowing {
        position: relative;
        top: 50px;
        width: 50px;
        height: 50px;
        background: red;
    }
</style>
<body><div id="inside"></div><div id="overflowing"></div></body>
<script>
    // body's overflow is first propagated to the viewport, so its red child paints outside it. Once html takes over
    // the propagation, body clips its own overflow and the red child must disappear.
    requestAnimationFrame(() => {
        requestAnimationFrame(() => {
            document.documentElement.style.overflow = "hidden";
            requestAnimationFrame(() => {
                if (window.internals)
                    internals.signalTestIsDone("PASS");
                else
                    document.documentElement.classList.remove("reftest-wait");
            });
        });
    });
</script>
</html>