Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
@keyframes widen-and-back {
from { width: 200px; }
50% { width: 700px; }
to { width: 200px; }
}
#pane {
container-type: inline-size;
width: 200px;
}
#pane.widen {
animation: widen-and-back 20s linear;
}
#card {
display: grid;
grid-template-columns: 1fr;
}
#title {
height: 10px;
}
#aside {
display: none;
}
#aside > div {
height: 1em;
}
@container (min-width: 400px) {
#card {
grid-template-columns: 1fr 1fr;
}
#aside {
display: block;
font-size: 30px;
}
}
</style>
<div id="pane">
<div id="card">
<div id="title"></div>
<div id="aside"><div>Aside</div></div>
</div>
</div>
<script>
// A grid item the main thread could not insert in place, where its neighbors' whitespace sits in anonymous boxes,
// comes and goes beside a task as a container the render clock lays out crosses a query and back: the clock builds
// the grid's boxes again for it, with the grid's own move, as the main thread builds them for the same sizes.
asyncTest(async done => {
const result = await whileLaneAnimates(() => {
pane.classList.add("widen");
return pane.getAnimations()[0];
}, (frameTime, animation) => {
internals.injectClockTick(frameTime + 3000);
internals.injectClockTick(frameTime + 5000);
const clockAfterGrowing = internals.clockLaneState(document);
internals.injectClockTick(frameTime + 17000);
return {
clockAfterGrowing,
clock: internals.clockLaneState(document),
presented: internals.presentedBorderBox(pane),
presentedBy: internals.lastFramePresentedBy(document),
localTime: frameTime + 17000 - animation.startTime,
animation,
};
});
result.animation.pause();
result.animation.currentTime = result.localTime;
const laidOut = pane.getBoundingClientRect();
const presented = result.presented;
println(`clock after the aside came: ${result.clockAfterGrowing}`);
println(`clock after it went: ${result.clock}`);
println(`last frame presented by: ${result.presentedBy}`);
println(`the presented size is the main thread's: ${presented !== null && Math.abs(presented.width - laidOut.width) < 0.02 && Math.abs(presented.height - laidOut.height) < 0.02}`);
println(`the aside left the grid: ${laidOut.height === 10}`);
done();
});
</script>