Files
ladybird/Libraries/LibWeb/CSS/Selector.cpp
Andreas Kling 7f709c6502 LibWeb: Improve the ancestor filter we use during selector matching
Before this change, we'd stop collecting must-be-present identifiers
from the selector once we crossed a combinator that wasn't ' ' or '>'.

However, we can simply skip over sibling combinators and continue
collecting ancestor identifiers on the "other side" of them, since
siblings always have a shared parent.

This allows us to use the ancestor filter to quickly reject more
selectors. It also fixes a harmless bug where we believed the ancestor
filter to be useful while there were 0 ancestor hashes in the selector.
2025-12-20 12:55:26 -06:00

41 KiB