Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2f26a21ea336b9a59a5bf200874eb1d625248a6c
https://github.com/WebKit/WebKit/commit/2f26a21ea336b9a59a5bf200874eb1d625248a6c
Author: Charlie Wolfe <[email protected]>
Date: 2026-10-02 (Fri, 02 Oct 2026)
Changed paths:
A
LayoutTests/fast/css-generated-content/before-after-box-from-animated-content-expected.txt
A
LayoutTests/fast/css-generated-content/before-after-box-from-animated-content.html
A
LayoutTests/fast/css-generated-content/before-after-box-from-universal-content-rule-expected.txt
A
LayoutTests/fast/css-generated-content/before-after-box-from-universal-content-rule.html
A
LayoutTests/fast/css-generated-content/before-after-box-from-var-and-reset-rules-expected.txt
A
LayoutTests/fast/css-generated-content/before-after-box-from-var-and-reset-rules.html
A
LayoutTests/fast/css-generated-content/before-after-box-with-content-less-rules-expected.txt
A
LayoutTests/fast/css-generated-content/before-after-box-with-content-less-rules.html
A
LayoutTests/fast/css/getComputedStyle/pseudo-element-without-content-expected.txt
A LayoutTests/fast/css/getComputedStyle/pseudo-element-without-content.html
M Source/WebCore/rendering/style/RenderStyleConstants.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/RuleSet.cpp
M Source/WebCore/style/RuleSet.h
M Source/WebCore/style/StyleResolver.cpp
M Source/WebCore/style/StyleTreeResolver.cpp
M Source/WebCore/style/computed/StyleComputedStyle.cpp
M Source/WebCore/style/computed/StyleComputedStyleBase+ConstructionInlines.h
M Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h
M Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h
M Source/WebCore/style/computed/StyleComputedStyleBase.cpp
M Source/WebCore/style/computed/StyleComputedStyleBase.h
Log Message:
-----------
Skip resolving ::before and ::after styles for rules that cannot generate
content
https://bugs.webkit.org/show_bug.cgi?id=323564
rdar://186807298
Reviewed by Antti Koivisto.
Rules like `*::before, *::after { box-sizing: border-box; }` force
::before/::after style resolution
for every element, even though they can never create a box.
RuleData now records whether a ::before/::after rule may generate a box. That's
true if it sets
'content', 'animation-name' or 'transition-behavior' to a non-initial value, or
uses var() or a
CSS-wide keyword. This is collected into a pseudoElementsMayGenerateBox bit on
the originating
element's style. Rules whose container query fails count as generating, because
the element may be
the query container for its own pseudo-elements. TreeResolver skips
::before/::after when the bit is
clear and there are no keyframe effects. getComputedStyle() still resolves them
lazily.
Tests: fast/css-generated-content/before-after-box-from-animated-content.html
fast/css-generated-content/before-after-box-from-universal-content-rule.html
fast/css-generated-content/before-after-box-from-var-and-reset-rules.html
fast/css-generated-content/before-after-box-with-content-less-rules.html
fast/css/getComputedStyle/pseudo-element-without-content.html
*
LayoutTests/fast/css-generated-content/before-after-box-from-animated-content-expected.txt:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-from-animated-content.html:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-from-universal-content-rule-expected.txt:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-from-universal-content-rule.html:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-from-var-and-reset-rules-expected.txt:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-from-var-and-reset-rules.html:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-with-content-less-rules-expected.txt:
Added.
*
LayoutTests/fast/css-generated-content/before-after-box-with-content-less-rules.html:
Added.
*
LayoutTests/fast/css/getComputedStyle/pseudo-element-without-content-expected.txt:
Added.
* LayoutTests/fast/css/getComputedStyle/pseudo-element-without-content.html:
Added.
* Source/WebCore/rendering/style/RenderStyleConstants.h:
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::collectMatchingRules):
(WebCore::Style::ElementRuleCollector::ruleMatches):
(WebCore::Style::ElementRuleCollector::collectMatchingRulesForListSlow):
* Source/WebCore/style/ElementRuleCollector.h:
(WebCore::Style::ElementRuleCollector::pseudoElementBoxGeneration const):
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::isKeywordOrKeywordList):
(WebCore::Style::selectorHasBeforeOrAfterPseudoElement):
(WebCore::Style::computePseudoElementBoxGeneration):
(WebCore::Style::RuleData::RuleData):
* Source/WebCore/style/RuleData.h:
(WebCore::Style::RuleData::pseudoElementBoxGeneration const):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRuleToBucket):
* Source/WebCore/style/RuleSet.h:
(WebCore::Style::RuleSet::universalHTMLPseudoElementBoxGeneration const):
(WebCore::Style::RuleSet::universalPseudoElementBoxGeneration const):
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::unadjustedStyleForElement):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolvePseudoElement):
* Source/WebCore/style/computed/StyleComputedStyle.cpp:
(WebCore::Style::ComputedStyle::copyPseudoElementBitsFrom):
* Source/WebCore/style/computed/StyleComputedStyleBase+ConstructionInlines.h:
(WebCore::Style::ComputedStyleBase::ComputedStyleBase):
* Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h:
(WebCore::Style::ComputedStyleBase::pseudoElementBoxGeneration const):
* Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h:
(WebCore::Style::ComputedStyleBase::NonInheritedFlags::setHasPseudoStyles):
(WebCore::Style::ComputedStyleBase::setHasPseudoStyles):
* Source/WebCore/style/computed/StyleComputedStyleBase.cpp:
(WebCore::Style::ComputedStyleBase::NonInheritedFlags::dumpDifferences const):
* Source/WebCore/style/computed/StyleComputedStyleBase.h:
Canonical link: https://commits.webkit.org/322517@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications