[webkit-changes] [WebKit/WebKit] 29a558: CSS Nesting: fix performance regression by storing...
Matthieu Dubet
noreply at github.com
Fri Mar 17 15:00:02 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 29a55829552726ea8b7310c95c3ff4bbcf591583
https://github.com/WebKit/WebKit/commit/29a55829552726ea8b7310c95c3ff4bbcf591583
Author: Matthieu Dubet <m_dubet at apple.com>
Date: 2023-03-17 (Fri, 17 Mar 2023)
Changed paths:
M Source/WebCore/css/CSSStyleRule.cpp
M Source/WebCore/css/StyleRule.cpp
M Source/WebCore/css/StyleRule.h
M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
M Source/WebCore/style/RuleData.h
M Source/WebCore/style/RuleSetBuilder.cpp
M Source/WebCore/style/RuleSetBuilder.h
Log Message:
-----------
CSS Nesting: fix performance regression by storing selector in StyleRule
https://bugs.webkit.org/show_bug.cgi?id=252904
rdar://105883716
Reviewed by Antti Koivisto.
CSS Nesting introduces a performance regression in selector
matching because of a branch to select the appropriate selector list
(user-written/nested one VS resolved/flatten one).
This patch stores the resolved selector list in the original StyleRule,
thus allowing to have only this object to perform selector matching.
The original user-written selector list is stored in the StyleRuleWithNesting
object which is not an issue because it's never in a hot code path.
* Source/WebCore/css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::generateSelectorText const):
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRuleWithNesting::StyleRuleWithNesting):
(WebCore::StyleRule::resolvedSelectorList const): Deleted.
(WebCore::StyleRuleWithNesting::setResolvedSelectorList const): Deleted.
* Source/WebCore/css/StyleRule.h:
* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
* Source/WebCore/style/RuleData.h:
(WebCore::Style::RuleData::selector const):
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::resolveSelectorListWithNesting):
(WebCore::Style::RuleSetBuilder::addStyleRule):
(WebCore::Style::RuleSetBuilder::populateStyleRuleResolvedSelectorList): Deleted.
* Source/WebCore/style/RuleSetBuilder.h:
Canonical link: https://commits.webkit.org/261809@main
More information about the webkit-changes
mailing list