Skip to content

Truly independent web browser

1.9 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
    @keyframes open {
        0%, 10% { height: 0; padding-top: 0; }
        100% { height: var(--h); padding-top: 4px; }
    }
    .item {
        border-radius: 8px;
        overflow: hidden;
    }
    #answer {
        --h: 100px;
        height: 0;
        overflow: hidden;
    }
    #answer.open {
        animation: open 10s linear infinite;
    }
</style>
<div class="item"><div id="answer">Text beside<p>a paragraph</p></div></div>
<div class="item">Below</div>
<script>
    // The render clock keeps opening a box beside a task, into its next iteration: a looping animation of a
    // var() height and a padding, of a box with an anonymous child, in a box that clips with rounded corners. The item
    // opens past its content, which leaves it nothing to scroll.
    asyncTest(async done => {
        const result = await whileLaneAnimates(() => {
            answer.classList.add("open");
            return answer.getAnimations()[0];
        }, (frameTime, animation, startTime) => {
            internals.injectClockTick(frameTime + 1000);
            // 95% into the second iteration, past the hold of its first 10%.
            internals.injectClockTick(startTime + 19500);
            const lane = internals.clockLaneState(document);
            const presented = internals.presentedBorderBox(answer);
            return {
                presentedHeightIsTheTicks: presented !== null && Math.abs(presented.height - (104 * 0.85) / 0.9) < 0.05,
                lane,
                presentedBy: internals.lastFramePresentedBy(document),
            };
        });
        println(`the presented height is the animation's at the last tick, in its second iteration: ${result.presentedHeightIsTheTicks}`);
        println(`lane after the ticks: ${result.lane}`);
        println(`last frame presented by: ${result.presentedBy}`);
        done();
    });
</script>