mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +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.
32 lines
1.1 KiB
HTML
32 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<style id="document-style"></style>
|
|
<div id="host"></div>
|
|
<script>
|
|
asyncTest(async done => {
|
|
const host = document.getElementById("host");
|
|
const shadowRoot = host.attachShadow({ mode: "open" });
|
|
|
|
shadowRoot.innerHTML = `
|
|
<style>
|
|
#target {
|
|
animation-name: fade;
|
|
animation-duration: 1s;
|
|
animation-fill-mode: both;
|
|
}
|
|
</style>
|
|
<div id="target">target</div>
|
|
`;
|
|
|
|
const target = shadowRoot.getElementById("target");
|
|
const documentStyleSheet = document.getElementById("document-style").sheet;
|
|
|
|
println(`opacity before keyframes: ${getComputedStyle(target).opacity}`);
|
|
documentStyleSheet.insertRule("@keyframes fade { from { opacity: 0.25; } to { opacity: 0.25; } }", documentStyleSheet.cssRules.length);
|
|
await animationFrame();
|
|
println(`opacity after keyframes: ${getComputedStyle(target).opacity}`);
|
|
|
|
done();
|
|
});
|
|
</script>
|