Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
    <div id="wrapper" style="width: 50px; height: 50px;">
        <div id="child" style="width: 40px; height: 40px;"></div>
    </div>
</div>
<script>
    // A transformed box contributes to its scroll container through an intermediate
    // overflow: visible ancestor, so the recalculation has to propagate along the whole
    // containing block chain.
    test(() => {
        const scroller = document.getElementById("scroller");
        const child = document.getElementById("child");
        const initialHeight = scroller.scrollHeight;
        let heightAfterChange;
        const work = layoutWork(() => {
            child.style.transform = "translateY(400px)";
            heightAfterChange = scroller.scrollHeight;
        });
        println(`initial scrollHeight: ${initialHeight}`);
        println(`scrollHeight after transform change: ${heightAfterChange}`);
        println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
    });
</script>