Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b42d60b4ff3f9fc0d4676c72b4e418260e9952d
      
https://github.com/WebKit/WebKit/commit/5b42d60b4ff3f9fc0d4676c72b4e418260e9952d
  Author: Antti Koivisto <[email protected]>
  Date:   2026-05-04 (Mon, 04 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/style/StyleInvalidator.cpp
    M Source/WebCore/style/StyleScopeRuleSets.h

  Log Message:
  -----------
  [:has() perf] Optimize non-subject sibling invalidation
https://bugs.webkit.org/show_bug.cgi?id=313629
rdar://175835568

Reviewed by Alan Baradlay.

Avoid full document invalidation traversal in cases like

.c:has(+ .trigger) > .target
.c:has(~ .trigger) > .target
.c:has(+ .trigger) .target
.c:has(~ .trigger) .target

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

Also ensure we differentiate between scope breaking and weakly scoped cases.

* Source/WebCore/style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
* Source/WebCore/style/StyleScopeRuleSets.h:

Add additional traversal paths.

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



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

Reply via email to