Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 99a41c6adea151c9800799b8206beb6050193ba9
      
https://github.com/WebKit/WebKit/commit/99a41c6adea151c9800799b8206beb6050193ba9
  Author: Antti Koivisto <[email protected]>
  Date:   2025-04-07 (Mon, 07 Apr 2025)

  Changed paths:
    M LayoutTests/interaction-region/labels-expected.txt
    M Source/WebCore/SaferCPPExpectations/ForwardDeclCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/cssjit/SelectorCompiler.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/ElementRuleCollector.h
    M Source/WebCore/style/RuleData.cpp
    M Source/WebCore/style/RuleData.h
    M Source/WebCore/style/RuleFeature.cpp
    M Source/WebCore/style/RuleFeature.h
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebCore/style/StyleRelations.cpp
    M Source/WebCore/style/StyleRelations.h
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/style/StyleScopeRuleSets.cpp
    M Source/WebCore/style/StyleScopeRuleSets.h
    R Source/WebCore/style/StyleSharingResolver.cpp
    R Source/WebCore/style/StyleSharingResolver.h
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h

  Log Message:
  -----------
  Remove Style::SharingResolver
https://bugs.webkit.org/show_bug.cgi?id=290981
rdar://problem/148496056

Reviewed by Alan Baradlay.

This is an old performance optimization based on an idea that if the DOM 
structure is
sufficiently regular then we can know that an element will have the same exact 
style as another
element. For example in <div><span></span><span></span></div> we can know that 
both spans have
the same style as long as the style rules in effect are sufficiently simple. 
This allows skipping
expensive selector matching and style building steps.

This worked well in the early web where simple styles and DOM structures were 
the norm. It barely
works at all now when there are many ways to write styles where the assumptions 
don't hold and DOM
trees are complex. We currently disable it completely if some modern features 
like :has() are used
anywhere in the document.

It also has been subsumed by far more effective optimizations (matched 
declarations cache, match result cache)
which work well with modern content and achieves the same effect.

Removing the feature is either a win in terms of performance (figuring out it 
can't be used per-element is costly)
or flat in all benchmarks we care about. It is very bug prone and hard to 
understand optimization that
regularly breaks when new features are added so removing it is a significant 
reduction in mainteneance burder.

* LayoutTests/interaction-region/labels-expected.txt:

This VisionOS only test has a result change. Apparently sharing resolver was 
hiding our actual behavior in this test.

* Source/WebCore/SaferCPPExpectations/ForwardDeclCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
(WebCore::SelectorChecker::matchHasPseudoClass const):
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPlaceholderShown):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle):
(WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom):
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
(WebCore::RenderStyle::setHasAttrContent):
(WebCore::RenderStyle::NonInheritedFlags::dumpDifferences const):
(WebCore::RenderStyle::hasUniquePseudoStyle const): Deleted.
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ruleMatches):
* Source/WebCore/style/ElementRuleCollector.h:
(WebCore::Style::ElementRuleCollector::styleRelations const):
(WebCore::Style::ElementRuleCollector::didMatchUncommonAttributeSelector 
const): Deleted.
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::RuleData::RuleData):
(WebCore::Style::isCommonAttributeSelectorAttribute): Deleted.
(WebCore::Style::computeContainsUncommonAttributeSelector): Deleted.
* Source/WebCore/style/RuleData.h:
(WebCore::Style::RuleData::matchBasedOnRuleHash const):
(WebCore::Style::RuleData::containsUncommonAttributeSelector const): Deleted.
* Source/WebCore/style/RuleFeature.cpp:
(WebCore::Style::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
(WebCore::Style::RuleFeatureSet::collectFeatures):
(WebCore::Style::RuleFeatureSet::add):
(WebCore::Style::RuleFeatureSet::clear):
(WebCore::Style::RuleFeatureSet::shrinkToFit):
* Source/WebCore/style/RuleFeature.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
* Source/WebCore/style/StyleRelations.cpp:
(WebCore::Style::commitRelationsToRenderStyle):
(WebCore::Style::commitRelations):
(WebCore::Style::copyRelations):
* Source/WebCore/style/StyleRelations.h:
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForElement):
* Source/WebCore/style/StyleScopeRuleSets.cpp:
(WebCore::Style::ScopeRuleSets::collectFeatures const):
* Source/WebCore/style/StyleScopeRuleSets.h:
(WebCore::Style::ScopeRuleSets::sibling const): Deleted.
(WebCore::Style::ScopeRuleSets::uncommonAttribute const): Deleted.
* Source/WebCore/style/StyleSharingResolver.cpp: Removed.
* Source/WebCore/style/StyleSharingResolver.h: Removed.
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Scope::Scope):
(WebCore::Style::TreeResolver::styleForStyleable):
* Source/WebCore/style/StyleTreeResolver.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to