mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
Track the simple selector features that appear inside :has() arguments on each StyleScope, then consult that metadata before scheduling an ancestor walk for a structural mutation. If the mutated subtree has no tag, id, class, attribute, or pseudo-class feature that any cached :has() argument cares about, skip the walk entirely. Stay conservative for featureless-sensitive arguments such as :has(*), :has(:not(...)), :has(:empty), and child-index pseudos: an unfeatured node can still start or stop matching there. Track that case via a new has_selectors_sensitive_to_featureless_subtree_changes flag on StyleInvalidationData and fall back to the old conservative walk. Stay conservative for pseudo-classes the subtree filter cannot probe (:focus, :hover, validation pseudos). Move :default out of the set of trackable feature pseudo-classes for the same reason; it now triggers the conservative walk where it previously recorded metadata. Tag and attribute names are stored lowercased, so for non-HTML elements (SVG, MathML) treat lowercased matches as scheduling hints only; the actual :has() match still goes through case-sensitive selector matching. Test counter expectations are rebaselined to reflect the skipped walks and reduced recomputations. Matching behavior is unchanged.
2.8 KiB
2.8 KiB