Files
ladybird/Tests/LibWeb/Layout/input/css-counters/dynamic-counter-style-replace-sync-adopted-sheet.html
Andreas Kling e2e3c7fcdf LibWeb: Rebuild counter style cache lazily
Stop rebuilding the counter style cache from every style update.
That made unrelated restyles pay the full counter-style cost even when
no relevant stylesheet state had changed.

Dirty the cache when stylesheet rule caches are invalidated and rebuild
it on the first counter-style lookup instead. Also make cold cache
rebuilds include user stylesheets.

Add regression tests covering insertRule() and replaceSync() updates
that should make newly defined counter styles take effect.
2026-04-05 12:34:28 +02:00

24 lines
509 B
HTML

<!doctype html>
<div style="counter-reset: a 5"></div>
<script>
let sheet = new CSSStyleSheet();
sheet.replaceSync(`
div::after {
content: counter(a, dynamic-counter-style);
}
`);
document.adoptedStyleSheets = [sheet];
sheet.replaceSync(`
@counter-style dynamic-counter-style {
symbols: "*";
}
div::after {
content: counter(a, dynamic-counter-style);
}
`);
document.body.offsetWidth;
</script>