Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
@keyframes widen {
from {
width: 100px;
}
to {
width: 200px;
}
}
#wrapper.animated {
animation: widen 10s linear;
}
</style>
<div style="container-type: size; width: 300px; height: 100px">
<div id="wrapper" style="width: 100px">
<svg width="100%" height="100"><text x="50cqw" y="50">Label</text></svg>
</div>
</div>
<script>
// A tick of the render clock that resizes an SVG lays its text out again, and resolves the text's position in
// container units against the container's committed box as the host does, so the lane goes on ticking.
asyncTest(async done => {
const result = await whileLaneAnimates(() => {
wrapper.classList.add("animated");
return wrapper.getAnimations()[0];
}, (frameTime, animation, startTime) => {
const before = internals.clockLaneState(document);
internals.injectClockTick(startTime + 5000);
return {
before,
after: internals.clockLaneState(document),
presentedBy: internals.lastFramePresentedBy(document),
presentedWidth: internals.presentedBorderBox(wrapper)?.width,
};
});
println(`lane as the task begins: ${result.before}`);
println(`lane after a tick: ${result.after}`);
println(`last frame presented by: ${result.presentedBy}`);
println(`presented wrapper width: ${result.presentedWidth}`);
done();
});
</script>