mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Narrow @keyframes insertRule() invalidation
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.
This commit is contained in:
committed by
Andreas Kling
parent
b6559d3846
commit
4e92765211
Notes:
github-actions[bot]
2026-04-23 14:49:46 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4e927652110 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9049
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<div id="host"><span id="slotted" class="item">slotted</span></div>
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
const host = document.getElementById("host");
|
||||
const slotted = document.getElementById("slotted");
|
||||
const shadowRoot = host.attachShadow({ mode: "open" });
|
||||
const declarationsSheet = new CSSStyleSheet();
|
||||
const keyframesSheet = new CSSStyleSheet();
|
||||
|
||||
shadowRoot.innerHTML = "<slot></slot>";
|
||||
shadowRoot.adoptedStyleSheets = [declarationsSheet, keyframesSheet];
|
||||
|
||||
declarationsSheet.replaceSync(`
|
||||
::slotted(.item) {
|
||||
animation-name: fade;
|
||||
animation-duration: 1s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
`);
|
||||
|
||||
println(`opacity before keyframes insertRule: ${getComputedStyle(slotted).opacity}`);
|
||||
keyframesSheet.insertRule("@keyframes fade { from { opacity: 0.25; } to { opacity: 0.25; } }", keyframesSheet.cssRules.length);
|
||||
await animationFrame();
|
||||
println(`opacity after keyframes insertRule: ${getComputedStyle(slotted).opacity}`);
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user