Skip to content

Truly independent web browser

1.5 KB
Raw Blame
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="../expected/iframe-fixed-blend-in-isolated-group-over-scrolled-content-ref.html">
<style>
    iframe { display: block; width: 200px; height: 150px; border: 0; }
</style>
<iframe></iframe>
<script>
    const iframe = document.querySelector("iframe");
    iframe.srcdoc = `<!DOCTYPE html>
        <style>
            body { margin: 0; height: 1000px; background: white; }
            main { position: relative; z-index: 1; height: 600px; background: navy; }
            .stripe { position: absolute; left: 0; width: 200px; height: 30px; background: lime; }
            #nav { position: fixed; left: 20px; top: 10px; width: 100px; height: 40px; background: orange; mix-blend-mode: difference; }
        </style>
        <main>
            <div class="stripe" style="top: 120px"></div>
            <div class="stripe" style="top: 160px"></div>
            <div id="nav"></div>
        </main>`;
    const frame = () => new Promise(resolve => requestAnimationFrame(resolve));
    window.onload = async () => {
        await frame();
        await frame();
        // The fixed box stays over the stripes as the document under it scrolls, and blends with them alone.
        iframe.contentWindow.scrollTo(0, 115);
        await frame();
        await frame();
        if (window.internals)
            internals.signalTestIsDone("PASS");
        else
            document.documentElement.classList.remove("reftest-wait");
    };
</script>