mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 09:27:00 +02:00
Handle inline stylesheet @keyframes insertions without falling back to broad owner invalidation. Recompute only elements whose computed animation-name already references the inserted keyframes name. Document-scoped insertions still walk the shadow-including tree so existing shadow trees pick up inherited animations, and shadow-root stylesheets fan out through the host root so :host combinators can refresh host-side consumers as well. Also introduce the shared ShadowRootStylesheetEffects analysis so later stylesheet mutation paths can reuse the same per-scope escape classification.
28 lines
815 B
HTML
28 lines
815 B
HTML
<!DOCTYPE html>
|
|
<style id="dynamic-style">
|
|
#target {
|
|
animation-duration: 1s;
|
|
animation-name: inserted;
|
|
}
|
|
</style>
|
|
<div id="target"></div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(async done => {
|
|
const target = document.getElementById("target");
|
|
const sheet = document.getElementById("dynamic-style").sheet;
|
|
|
|
println(`before: ${target.getAnimations().length}`);
|
|
|
|
sheet.insertRule("@keyframes inserted { from { opacity: 0.25; } to { opacity: 0.75; } }", 1);
|
|
await animationFrame();
|
|
|
|
const animations = target.getAnimations();
|
|
println(`after: ${animations.length}`);
|
|
if (animations.length > 0)
|
|
println(`keyframes: ${animations[0].effect.getKeyframes().length}`);
|
|
|
|
done();
|
|
});
|
|
</script>
|