Skip to content

Truly independent web browser

1.3 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
    @keyframes pulse { 50% { opacity: 0.5; } }
    #target::before { content: ""; display: block; width: 10px; height: 10px; background-color: blue; animation: pulse 100s linear infinite; }
    #target.faded::before { opacity: 0.2; }
</style>
<div id="target"></div>
<script>
    function printCompositorAnimations(title) {
        println(title);
        for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))
            println(`  ${line}`);
    }

    asyncTest(async done => {
        await Promise.all(document.getAnimations().map(animation => animation.ready));
        internals.updateCompositorAnimations();
        printCompositorAnimations("compositor animations:");

        // A change to the style of the pseudo-element resolves its keyframes again, as they take its opacity.
        internals.beginRenderingTrace();
        target.classList.add("faded");
        internals.updateStyle();
        internals.updateCompositorAnimations();
        const resolutions = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("compositor keyframe values resolved"));
        println(`keyframes resolved again: [${resolutions.join(", ")}]`);
        done();
    });
</script>