mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Allow CSS pseudo-element chaining with ::part() so that selectors like ::part(title)::before can style pseudo-elements within shadow DOM parts. Parser changes (SelectorParsing.cpp): The pseudo-element validation logic now tracks which pseudo-element appears first and second in a compound selector. When multiple pseudo-elements are found, the parser permits the selector only if the first is ::part() and the second is NOT ::part(). A maximum of two pseudo-elements is enforced. Selector changes (Selector.cpp, Selector.h): The Selector constructor now stores the last pseudo-element (the styling target) rather than the first. For ::part(foo)::before, the selector reports ::before as its target. A new m_contains_part_pseudo_element flag separately tracks whether ::part() is present for the selector engine. Fixes 9 WPT tests: 6 in css/selectors/parsing/parse-part.html for chained selector parsing, and 3 in css/css-shadow-parts/multiple-scopes.html for correct scoping of exported, middle-scope, and non-exported part selectors.