LibWeb: Make @counter-style tree-scoped and improve invalidation#8815
Open
Calme1709 wants to merge 10 commits intoLadybirdBrowser:masterfrom
Open
LibWeb: Make @counter-style tree-scoped and improve invalidation#8815Calme1709 wants to merge 10 commits intoLadybirdBrowser:masterfrom
@counter-style tree-scoped and improve invalidation#8815Calme1709 wants to merge 10 commits intoLadybirdBrowser:masterfrom
Conversation
AtkinsSJ
requested changes
Apr 8, 2026
Member
AtkinsSJ
left a comment
There was a problem hiding this comment.
Just a couple of nits really, plus a build issue. Otherwise I'm happy with this. (I really need to be more aware of StyleScope too. It's a good place for storing things.)
This was a pretty straightforward change of storing registered counter styles on the relevant `StyleScope`s and resolving by following the process to dereference a global tree-scoped name, the only things of note are: - We only define predefined counter styles (e.g. decimal) on the document's scope (since otherwise overrides in outer scopes would themselves be overriden). - When registering counter styles we don't have the full list of extendable styles so we defer fallback to "decimal" for undefined styles until `CounterStyle::from_counter_style_definition`.
This makes `ValueComparingRefPtr<CounterStyle>` work
In a later commit we can use the null state for an optimization.
The counter style used for an element (in either the `content` or `list-style-type`) may change despite the computed values of properties on that element remaining the same (e.g. if a new rule is inserted with higher cascade precedence).
Calme1709
commented
Apr 9, 2026
Contributor
Author
Calme1709
left a comment
There was a problem hiding this comment.
Applied those requested changes.
Looks like I managed to break both GCC and Windows compilation with separate mistakes, think those are fixed now as well but will double check once CI runs.
fe79e37 to
91a38fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See individual commits for details.