Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0fdbbfbe25ea91a8952f14f72cc8175183aeaa72
      
https://github.com/WebKit/WebKit/commit/0fdbbfbe25ea91a8952f14f72cc8175183aeaa72
  Author: Antti Koivisto <[email protected]>
  Date:   2025-10-29 (Wed, 29 Oct 2025)

  Changed paths:
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/CSSSelectorList.cpp
    M Source/WebCore/css/CSSSelectorList.h
    M Source/WebCore/style/RuleFeature.cpp
    M Source/WebCore/style/RuleFeature.h
    M Source/WebCore/style/StyleScopeRuleSets.cpp

  Log Message:
  -----------
  [github perf] Deduplicate invalidation selectors
https://bugs.webkit.org/show_bug.cgi?id=300327
rdar://162120232

Reviewed by Alan Baradlay.

We may end up with multiple copies of the same selector in invalidation 
RuleSets if the
same selector is repeated in the stylesheets.

We also unnecessarily include pseudo-elements to these RuleSets as most 
pseudo-elements
invalidate their originating element.

* Source/WebCore/css/CSSSelector.cpp:
(WebCore::CSSSelector::RareData::equals const):
(WebCore::CSSSelector::simpleSelectorEqual const):
(WebCore::isElementBackedPseudoElement):
(WebCore::complexSelectorsEqual):

Add selector equality test functions. Allow testing equality while ignoring 
pseudo-elements.

* Source/WebCore/css/CSSSelector.h:
* Source/WebCore/css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::operator== const):
* Source/WebCore/css/CSSSelectorList.h:
* Source/WebCore/style/RuleFeature.cpp:
(WebCore::Style::RuleAndSelector::selector const):
(WebCore::Style::equalIgnoringPseudoElement):
(WebCore::Style::RuleFeatureSet::collectFeatures):

Try to deduplicate newly added RuleFeatures against the existing ones.

* Source/WebCore/style/RuleFeature.h:
* Source/WebCore/style/StyleScopeRuleSets.cpp:
(WebCore::Style::ensureInvalidationRuleSets):

Also deduplicate invalidation selectors.

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



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

Reply via email to