Skip to content

Truly independent web browser

1015 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<div style="container-type: size; width: 100px; height: 100px">
    <div id="box" style="width: 10px; height: 0px; background: green"></div>
</div>
<script>
    // A keyframe in container units resolves against a container's size, which only the host knows: the first tick of
    // a clock lane of such an animation parks the lane.
    asyncTest(async done => {
        const result = await whileLaneAnimates(() => {
            return box.animate([{ height: "0cqh" }, { height: "100cqh" }], { duration: 10000, easing: "linear" });
        }, frameTime => {
            const before = internals.clockLaneState(document);
            internals.injectClockTick(frameTime + 500);
            return { before, after: internals.clockLaneState(document) };
        });
        println(`lane as the task begins: ${result.before}`);
        println(`lane after a tick: ${result.after}`);
        done();
    });
</script>