Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
body { margin: 0; }
#box { width: 100px; height: 100px; background: rgb(0, 0, 255); opacity: 1; transition: opacity 50ms linear; }
#box.faded { opacity: 0.2; }
#box.faded:hover { opacity: 0.6; transition: opacity 100s linear; }
</style>
<div id="box"></div>
<script>
// A transition of opacity runs on the compositor, and no rendering update follows before it ends. A hover beside the task then starts a transition of opacity of its own: the frames the render
// clock presents show it with no compositor animation of the box, which would hold the box at its end.
asyncTest(async done => {
if (document.readyState !== "complete")
await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));
await twoFrames();
box.classList.add("faded");
await nextFrame();
const result = await whileLaneHovers(frameTime => {
internals.injectHoverPointer(50, 50, frameTime + 200);
internals.injectClockTick(frameTime + 200 + 50000);
return {
compositorAnimations: JSON.stringify(internals.presentedCompositorAnimations(box)),
opacity: internals.presentedOpacity(box),
presentedBy: internals.lastFramePresentedBy(document),
};
});
println(`compositor animations of the box as the hover starts its transition: ${result.compositorAnimations}`);
println(`box opacity halfway through: ${result.opacity}`);
println(`last frame presented by: ${result.presentedBy}`);
done();
});
</script>