Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 72bd1bab23f7b55d21cba762339f3bfbe81d8ba9
      
https://github.com/WebKit/WebKit/commit/72bd1bab23f7b55d21cba762339f3bfbe81d8ba9
  Author: Antti Koivisto <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M LayoutTests/fast/selectors/has-invalidation-traversal-size-expected.txt
    M LayoutTests/fast/selectors/has-invalidation-traversal-size.html
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/CSSSelectorParser.h
    M Source/WebCore/style/RuleFeature.cpp
    M Source/WebCore/style/RuleFeature.h

  Log Message:
  -----------
  [:has() perf] Build better scope selector for nested :is()
https://bugs.webkit.org/show_bug.cgi?id=314192
rdar://176354723

Reviewed by Alan Baradlay.

In cases like

.foo:is(.bar:has(.changed)) .baz

the scope selector could be .foo.bar but is currently just .bar. Merge
compound peers across enclosing logical pseudo-classes so all levels
contribute. Inner compounds containing a type selector are skipped to
avoid synthesizing an invalid two-type compound (e.g. div.span).

* LayoutTests/fast/selectors/has-invalidation-traversal-size-expected.txt:
* LayoutTests/fast/selectors/has-invalidation-traversal-size.html:

Add cases covering merge across levels, inner-type skip, and
outer-type with inner-class merge.

* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::makeHasScopeSelector):
* Source/WebCore/css/parser/CSSSelectorParser.h:

Take a vector of compound selectors (outermost to :has()) and union
their compound peers. The outermost contributes the compound relation
and ancestor chain.

* Source/WebCore/style/RuleFeature.cpp:
(WebCore::Style::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
(WebCore::Style::RuleFeatureSet::collectFeatures):
* Source/WebCore/style/RuleFeature.h:

Track the full stack of enclosing logical compounds rather than only the
outermost.

Canonical link: https://commits.webkit.org/312715@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to