ladybird/Libraries/LibWeb/CSS/Invalidation
Sam Atkins 35b43f7d3a LibWeb/CSS: Insert a combinator before all pseudo-element selectors
Previously, and according to the spec, `a::part(foo)::before` would be a
single CompoundSelector, even though it matches against 3 different
targets. This meant some awkward swapping of targets in the middle of
matching, and in particular it made `::part()` and `::slotted()` quite
hacky, requiring them to track extra data on the MatchContext to then
use later. This was scattered around and difficult to follow.

Partly inspired by Gecko, this commit instead introduces an invisible
PseudoElement combinator. After parsing a selector, we find any
CompoundSelectors that contain a pseudo-element and split them up, so
that each CompoundSelector only has a single target in the end. Where
the pseudo-element was at the start of a CompoundSelector, we insert an
invisible universal selector before it to represent its originating
element.

So now, a CompoundSelector deals with one target, and switching targets
is done at the combinator.

The one inconsistency is that we match the target of ::slotted()
and ::part() in pseudo_element_transition_target(), instead of before
then when processing the SimpleSelector. This is to avoid repeating the
same computations twice.

No outward-facing behaviour changes, though the invalidation metrics
have changed.
2026-05-13 11:03:02 +01:00
..
AdoptedStyleSheetInvalidator.cpp LibWeb: Use targeted invalidation when adopting a stylesheet 2026-05-10 20:19:32 +02:00
AdoptedStyleSheetInvalidator.h LibWeb: Move adopted stylesheet invalidation into a helper 2026-04-29 15:47:23 +02:00
AttributeInvalidator.cpp LibWeb: Move attribute style invalidation into a helper 2026-04-29 15:47:23 +02:00
AttributeInvalidator.h LibWeb: Move attribute style invalidation into a helper 2026-04-29 15:47:23 +02:00
CustomElementInvalidator.cpp LibWeb: Move custom state set invalidation into the helper 2026-04-29 15:47:23 +02:00
CustomElementInvalidator.h LibWeb: Move custom state set invalidation into the helper 2026-04-29 15:47:23 +02:00
ElementStateInvalidator.cpp LibWeb: Move shadow root style invalidation into the helper 2026-04-29 15:47:23 +02:00
ElementStateInvalidator.h LibWeb: Move shadow root style invalidation into the helper 2026-04-29 15:47:23 +02:00
EmbeddedContentInvalidator.cpp LibWeb: Move embedded content style invalidation into a helper 2026-04-29 15:47:23 +02:00
EmbeddedContentInvalidator.h LibWeb: Move embedded content style invalidation into a helper 2026-04-29 15:47:23 +02:00
FormControlInvalidator.cpp LibWeb: Move checked-state invalidation into a helper 2026-04-29 15:47:23 +02:00
FormControlInvalidator.h LibWeb: Move checked-state invalidation into a helper 2026-04-29 15:47:23 +02:00
HasMutationFeatureCollector.cpp LibWeb: Move invalidation set matching into a helper 2026-04-29 15:47:23 +02:00
HasMutationFeatureCollector.h LibWeb: Move :has() mutation checks into a helper 2026-04-29 15:47:23 +02:00
HasMutationInvalidator.cpp LibWeb: Coalesce safe :has() child-list invalidations 2026-04-30 14:31:28 +02:00
HasMutationInvalidator.h LibWeb: Move pending :has() invalidation into the helper 2026-04-29 15:47:23 +02:00
InvalidationSetMatcher.cpp LibWeb: Make structural-position pseudos targetable when sole feature 2026-05-07 19:32:27 +02:00
InvalidationSetMatcher.h LibWeb: Move invalidation set matching into a helper 2026-04-29 15:47:23 +02:00
LanguageInvalidator.cpp LibWeb: Skip unchanged :has() mutation fanout 2026-04-30 00:24:04 +02:00
LanguageInvalidator.h LibWeb: Move text directionality invalidation into the helper 2026-04-29 15:47:23 +02:00
LinkInvalidator.cpp LibWeb: Move hyperlink style invalidation into a helper 2026-04-29 15:47:23 +02:00
LinkInvalidator.h LibWeb: Move hyperlink style invalidation into a helper 2026-04-29 15:47:23 +02:00
MediaQueryInvalidator.cpp LibWeb: Move media query style invalidation into a helper 2026-04-29 15:47:23 +02:00
MediaQueryInvalidator.h LibWeb: Move media query style invalidation into a helper 2026-04-29 15:47:23 +02:00
NodeInvalidator.cpp LibWebView: Add style invalidation counter dump option 2026-04-30 00:24:04 +02:00
NodeInvalidator.h LibWeb: Move node style invalidation into a helper 2026-04-29 15:47:23 +02:00
PartInvalidator.cpp LibWeb: Move part style invalidation into a helper 2026-04-29 15:47:23 +02:00
PartInvalidator.h LibWeb: Move part style invalidation into a helper 2026-04-29 15:47:23 +02:00
PseudoClassInvalidator.cpp LibWeb/CSS: Insert a combinator before all pseudo-element selectors 2026-05-13 11:03:02 +01:00
PseudoClassInvalidator.h LibWeb: Move pseudo-class state invalidation into a helper 2026-04-29 15:47:23 +02:00
SlotInvalidator.cpp LibWeb: Move slot style propagation into the helper 2026-04-29 15:47:23 +02:00
SlotInvalidator.h LibWeb: Move slot style propagation into the helper 2026-04-29 15:47:23 +02:00
StructuralMutationInvalidator.cpp LibWeb: Target :first/:last/:only-child sibling invalidation precisely 2026-05-06 21:22:02 +02:00
StructuralMutationInvalidator.h LibWeb: Move structural mutation invalidation into a helper 2026-04-29 15:47:23 +02:00
StyleInvalidator.cpp LibWeb: Move StyleInvalidator into CSS invalidation 2026-04-29 15:47:23 +02:00
StyleInvalidator.h LibWeb: Move StyleInvalidator into CSS invalidation 2026-04-29 15:47:23 +02:00