Diff
Modified: trunk/Source/WebCore/ChangeLog (293955 => 293956)
--- trunk/Source/WebCore/ChangeLog 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/ChangeLog 2022-05-08 07:12:20 UTC (rev 293956)
@@ -1,3 +1,84 @@
+2022-05-08 Antti Koivisto <[email protected]>
+
+ Avoid resolving style for elements that only inherit changes from parent
+ https://bugs.webkit.org/show_bug.cgi?id=240132
+ <rdar://problem/92867346>
+
+ Reviewed by Sam Weinig.
+
+ When an inherited property changes we need to update all descendant styles too. Currently this
+ is done by simply running the full style resolution for them including selector matching and
+ style building steps.
+
+ In the common case nothing changes in descendants expect the inherited properties. This patch implements
+ a fast-path mechanism that allows us to simply copy the relevant properties from the parent, skipping
+ all the other work. This is possible if we can prove that the value of these properties is not changed
+ by any rules targeting the child and that there are no other properties affected by this value change.
+
+ The mechanism is only implemented for the 'color' property for now. It can be expanded for other properties later.
+ It would be especially useful for custom properties.
+
+ * css/CSSProperties.json:
+ * css/makeprop.pl:
+
+ Add "fast-path-inherited" codegen property that disables the fast-path if the property is explicitly mutated.
+
+ (generateInitialValueSetter):
+ (generateValueSetter):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::RenderStyle):
+ (WebCore::RenderStyle::fastPathInheritFrom):
+
+ Inherit fast path properties.
+
+ (WebCore::RenderStyle::fastPathInheritedEqual const):
+ (WebCore::RenderStyle::nonFastPathInheritedEqual const):
+
+ Test for fast-path property changes.
+
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::disallowsFastPathInheritance const):
+ (WebCore::RenderStyle::setDisallowsFastPathInheritance):
+
+ Track if can use the mechanism.
+
+ (WebCore::RenderStyle::NonInheritedFlags::operator== const):
+ * rendering/style/StyleInheritedData.cpp:
+ (WebCore::StyleInheritedData::operator== const):
+ (WebCore::StyleInheritedData::fastPathInheritedEqual const):
+ (WebCore::StyleInheritedData::nonFastPathInheritedEqual const):
+ (WebCore::StyleInheritedData::fastPathInheritFrom):
+ * rendering/style/StyleInheritedData.h:
+ * style/StyleBuilderCustom.h:
+ (WebCore::Style::BuilderCustom::applyValueFill):
+ (WebCore::Style::BuilderCustom::applyValueStroke):
+ * style/StyleBuilderState.cpp:
+ (WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const):
+
+ Color value 'currentcolor' is mostly resolved during use time but in the few places we still resolve it during style building
+ we need to disable the fast-path, since it makes other properties depend on 'color' property.
+
+ * style/StyleChange.cpp:
+ (WebCore::Style::determineChange):
+
+ New style change type for fast-path inheritance.
+
+ * style/StyleChange.h:
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::styleForStyleable):
+
+ Resolve by just copying properties from the parent.
+
+ (WebCore::Style::TreeResolver::computeDescendantsToResolve):
+ (WebCore::Style::TreeResolver::resolveElement):
+ (WebCore::Style::TreeResolver::determineResolutionType):
+
+ Use fast-path if the only reason we are resolving this element is that some supported inherited property changed.
+
+ (WebCore::Style::TreeResolver::resolveComposedTree):
+ (WebCore::Style::TreeResolver::shouldResolveElement): Deleted.
+ * style/StyleTreeResolver.h:
+
2022-05-07 Ryosuke Niwa <[email protected]>
Add helper functions to queue task on Node with GCReachableRef
Modified: trunk/Source/WebCore/css/CSSProperties.json (293955 => 293956)
--- trunk/Source/WebCore/css/CSSProperties.json 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/css/CSSProperties.json 2022-05-08 07:12:20 UTC (rev 293956)
@@ -92,6 +92,10 @@
"Indicates that this CSS property is color-related (populates",
"CSSProperty::isColorProperty().",
"",
+ "* fast-path-inherited:",
+ "Indicates that this CSS property can use the fast-path inheritance mechanism.",
+ "This generates code that disables the mechanism if the property is explicitly mutated.",
+ "",
"* logical-property-group:",
"Indicates that this CSS property belongs to a logical property group",
"(https://drafts.csswg.org/css-logical/#logical-property-group)",
@@ -250,7 +254,8 @@
"codegen-properties": {
"visited-link-color-support": true,
"color-property": true,
- "high-priority": true
+ "high-priority": true,
+ "fast-path-inherited": true
},
"status": {
"comment": "All the values from CSS Color Level 3 are supported, as well as the 8- and 4-digit forms of hex color, and the color() function."
Modified: trunk/Source/WebCore/css/makeprop.pl (293955 => 293956)
--- trunk/Source/WebCore/css/makeprop.pl 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/css/makeprop.pl 2022-05-08 07:12:20 UTC (rev 293956)
@@ -97,6 +97,7 @@
"conditional-converter" => 1,
"converter" => 1,
"custom" => 1,
+ "fast-path-inherited" => 1,
"fill-layer-property" => 1,
"font-property" => 1,
"getter" => 1,
@@ -1337,6 +1338,10 @@
my $initialValue = ($isSVG ? "SVGRenderStyle" : "RenderStyle") . "::" . $initial . "()";
$setterContent .= $indent . " " . generateSetValueStatement($name, $initialValue) . ";\n";
}
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"fast-path-inherited"})) {
+ $setterContent .= $indent . " builderState.style().setDisallowsFastPathInheritance();\n";
+ }
+
$setterContent .= $indent . "}\n";
return $setterContent;
@@ -1380,6 +1385,9 @@
my $inheritedValue = $parentStyle . "." . ($isSVG ? "svgStyle()." : "") . $getter . "()";
$setterContent .= $indent . " " . generateSetValueStatement($name, "forwardInheritedValue(" . $inheritedValue . ")") . ";\n";
}
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"fast-path-inherited"})) {
+ $setterContent .= $indent . " builderState.style().setDisallowsFastPathInheritance();\n";
+ }
$setterContent .= $indent . "}\n";
return $setterContent;
@@ -1445,6 +1453,9 @@
}
$setterContent .= $indent . " " . generateSetValueStatement($name, $convertedValue) . ";\n";
}
+ if (exists($propertiesWithStyleBuilderOptions{$name}{"fast-path-inherited"})) {
+ $setterContent .= $indent . " builderState.style().setDisallowsFastPathInheritance();\n";
+ }
$setterContent .= $indent . "}\n";
return $setterContent;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (293955 => 293956)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-05-08 07:12:20 UTC (rev 293956)
@@ -207,6 +207,7 @@
m_nonInheritedFlags.hasExplicitlySetTextAlign = false;
m_nonInheritedFlags.hasViewportUnits = false;
m_nonInheritedFlags.hasExplicitlyInheritedProperties = false;
+ m_nonInheritedFlags.disallowsFastPathInheritance = false;
m_nonInheritedFlags.isUnique = false;
m_nonInheritedFlags.emptyState = false;
m_nonInheritedFlags.firstChildState = false;
@@ -354,6 +355,21 @@
m_svgStyle.access().inheritFrom(inheritParent.m_svgStyle.get());
}
+void RenderStyle::fastPathInheritFrom(const RenderStyle& inheritParent)
+{
+ ASSERT(!disallowsFastPathInheritance());
+
+ if (m_inheritedData.ptr() == inheritParent.m_inheritedData.ptr())
+ return;
+
+ // FIXME: Use this mechanism for other properties too, like variables.
+ if (m_inheritedData->nonFastPathInheritedEqual(*inheritParent.m_inheritedData)) {
+ m_inheritedData = inheritParent.m_inheritedData;
+ return;
+ }
+ m_inheritedData.access().fastPathInheritFrom(*inheritParent.m_inheritedData);
+}
+
void RenderStyle::copyNonInheritedFrom(const RenderStyle& other)
{
m_boxData = other.m_boxData;
@@ -455,6 +471,26 @@
&& m_rareInheritedData == other.m_rareInheritedData;
}
+bool RenderStyle::fastPathInheritedEqual(const RenderStyle& other) const
+{
+ if (m_inheritedData.ptr() == other.m_inheritedData.ptr())
+ return true;
+ return m_inheritedData->fastPathInheritedEqual(*other.m_inheritedData);
+}
+
+bool RenderStyle::nonFastPathInheritedEqual(const RenderStyle& other) const
+{
+ if (m_inheritedFlags != other.m_inheritedFlags)
+ return false;
+ if (m_inheritedData.ptr() != other.m_inheritedData.ptr() && !m_inheritedData->nonFastPathInheritedEqual(*other.m_inheritedData))
+ return false;
+ if (m_rareInheritedData != other.m_rareInheritedData)
+ return false;
+ if (m_svgStyle.ptr() != other.m_svgStyle.ptr() && !m_svgStyle->inheritedEqual(other.m_svgStyle))
+ return false;
+ return true;
+}
+
bool RenderStyle::descendantAffectingNonInheritedPropertiesEqual(const RenderStyle& other) const
{
if (m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr())
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (293955 => 293956)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-05-08 07:12:20 UTC (rev 293956)
@@ -165,7 +165,8 @@
bool operator==(const RenderStyle&) const;
bool operator!=(const RenderStyle& other) const { return !(*this == other); }
- void inheritFrom(const RenderStyle& inheritParent);
+ void inheritFrom(const RenderStyle&);
+ void fastPathInheritFrom(const RenderStyle&);
void copyNonInheritedFrom(const RenderStyle&);
void copyContentFrom(const RenderStyle&);
@@ -1539,6 +1540,9 @@
const AtomString& hyphenString() const;
bool inheritedEqual(const RenderStyle&) const;
+ bool fastPathInheritedEqual(const RenderStyle&) const;
+ bool nonFastPathInheritedEqual(const RenderStyle&) const;
+
bool descendantAffectingNonInheritedPropertiesEqual(const RenderStyle&) const;
#if ENABLE(TEXT_AUTOSIZING)
@@ -1588,7 +1592,10 @@
void setHasExplicitlyInheritedProperties() { m_nonInheritedFlags.hasExplicitlyInheritedProperties = true; }
bool hasExplicitlyInheritedProperties() const { return m_nonInheritedFlags.hasExplicitlyInheritedProperties; }
-
+
+ bool disallowsFastPathInheritance() const { return m_nonInheritedFlags.disallowsFastPathInheritance; }
+ void setDisallowsFastPathInheritance() { m_nonInheritedFlags.disallowsFastPathInheritance = true; }
+
void setMathStyle(const MathStyle& v) { SET_VAR(m_rareInheritedData, mathStyle, static_cast<unsigned>(v)); }
// Initial values for all the properties
@@ -1987,6 +1994,7 @@
#endif
unsigned hasViewportUnits : 1;
unsigned hasExplicitlyInheritedProperties : 1; // Explicitly inherits a non-inherited property.
+ unsigned disallowsFastPathInheritance : 1;
unsigned isUnique : 1; // Style cannot be shared.
unsigned emptyState : 1;
unsigned firstChildState : 1;
@@ -2127,6 +2135,7 @@
#endif
&& hasViewportUnits == other.hasViewportUnits
&& hasExplicitlyInheritedProperties == other.hasExplicitlyInheritedProperties
+ && disallowsFastPathInheritance == other.disallowsFastPathInheritance
&& isUnique == other.isUnique
&& emptyState == other.emptyState
&& firstChildState == other.firstChildState
Modified: trunk/Source/WebCore/rendering/style/StyleInheritedData.cpp (293955 => 293956)
--- trunk/Source/WebCore/rendering/style/StyleInheritedData.cpp 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/rendering/style/StyleInheritedData.cpp 2022-05-08 07:12:20 UTC (rev 293956)
@@ -59,17 +59,34 @@
return adoptRef(*new StyleInheritedData(*this));
}
-bool StyleInheritedData::operator==(const StyleInheritedData& o) const
+bool StyleInheritedData::operator==(const StyleInheritedData& other) const
{
- return lineHeight == o.lineHeight
+ return fastPathInheritedEqual(other) && nonFastPathInheritedEqual(other);
+}
+
+bool StyleInheritedData::fastPathInheritedEqual(const StyleInheritedData& other) const
+{
+ // These properties also need to have "fast-path-inherited" codegen property set.
+ // Cases where other properties depend on these values need to disallow the fast path (via RenderStyle::setDisallowsFastPathInheritance).
+ return color == other.color
+ && visitedLinkColor == other.visitedLinkColor;
+}
+
+bool StyleInheritedData::nonFastPathInheritedEqual(const StyleInheritedData& other) const
+{
+ return lineHeight == other.lineHeight
#if ENABLE(TEXT_AUTOSIZING)
- && specifiedLineHeight == o.specifiedLineHeight
+ && specifiedLineHeight == other.specifiedLineHeight
#endif
- && fontCascade == o.fontCascade
- && color == o.color
- && visitedLinkColor == o.visitedLinkColor
- && horizontalBorderSpacing == o.horizontalBorderSpacing
- && verticalBorderSpacing == o.verticalBorderSpacing;
+ && fontCascade == other.fontCascade
+ && horizontalBorderSpacing == other.horizontalBorderSpacing
+ && verticalBorderSpacing == other.verticalBorderSpacing;
}
+void StyleInheritedData::fastPathInheritFrom(const StyleInheritedData& inheritParent)
+{
+ color = inheritParent.color;
+ visitedLinkColor = inheritParent.visitedLinkColor;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/StyleInheritedData.h (293955 => 293956)
--- trunk/Source/WebCore/rendering/style/StyleInheritedData.h 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/rendering/style/StyleInheritedData.h 2022-05-08 07:12:20 UTC (rev 293956)
@@ -40,6 +40,10 @@
bool operator==(const StyleInheritedData&) const;
bool operator!=(const StyleInheritedData& other) const { return !(*this == other); }
+ bool fastPathInheritedEqual(const StyleInheritedData&) const;
+ bool nonFastPathInheritedEqual(const StyleInheritedData&) const;
+ void fastPathInheritFrom(const StyleInheritedData&);
+
float horizontalBorderSpacing;
float verticalBorderSpacing;
Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (293955 => 293956)
--- trunk/Source/WebCore/style/StyleBuilderCustom.h 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h 2022-05-08 07:12:20 UTC (rev 293956)
@@ -1490,6 +1490,7 @@
else if (localValue->isValueID() && localValue->valueID() == CSSValueCurrentcolor) {
color = builderState.style().color();
paintType = url.isEmpty() ? SVGPaintType::CurrentColor : SVGPaintType::URICurrentColor;
+ builderState.style().setDisallowsFastPathInheritance();
} else {
color = builderState.colorFromPrimitiveValue(*localValue);
paintType = url.isEmpty() ? SVGPaintType::RGBColor : SVGPaintType::URIRGBColor;
@@ -1534,6 +1535,7 @@
else if (localValue->isValueID() && localValue->valueID() == CSSValueCurrentcolor) {
color = builderState.style().color();
paintType = url.isEmpty() ? SVGPaintType::CurrentColor : SVGPaintType::URICurrentColor;
+ builderState.style().setDisallowsFastPathInheritance();
} else {
color = builderState.colorFromPrimitiveValue(*localValue);
paintType = url.isEmpty() ? SVGPaintType::RGBColor : SVGPaintType::URIRGBColor;
Modified: trunk/Source/WebCore/style/StyleBuilderState.cpp (293955 => 293956)
--- trunk/Source/WebCore/style/StyleBuilderState.cpp 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleBuilderState.cpp 2022-05-08 07:12:20 UTC (rev 293956)
@@ -319,6 +319,7 @@
if (value.valueID() == CSSValueCurrentcolor) {
// Color is an inherited property so depending on it effectively makes the property inherited.
m_style.setHasExplicitlyInheritedProperties();
+ m_style.setDisallowsFastPathInheritance();
return m_style.color();
}
Modified: trunk/Source/WebCore/style/StyleChange.cpp (293955 => 293956)
--- trunk/Source/WebCore/style/StyleChange.cpp 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleChange.cpp 2022-05-08 07:12:20 UTC (rev 293956)
@@ -57,9 +57,6 @@
if (s1.hasTextCombine() != s2.hasTextCombine())
return Change::Renderer;
- if (!s1.inheritedEqual(s2))
- return Change::Inherited;
-
if (!s1.descendantAffectingNonInheritedPropertiesEqual(s2))
return Change::Inherited;
@@ -67,6 +64,12 @@
if (s1.containerType() != s2.containerType() || s1.containerNames() != s2.containerNames())
return Change::Inherited;
+ if (!s1.nonFastPathInheritedEqual(s2))
+ return Change::Inherited;
+
+ if (!s1.fastPathInheritedEqual(s2))
+ return Change::FastPathInherited;
+
if (s1 != s2)
return Change::NonInherited;
Modified: trunk/Source/WebCore/style/StyleChange.h (293955 => 293956)
--- trunk/Source/WebCore/style/StyleChange.h 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleChange.h 2022-05-08 07:12:20 UTC (rev 293956)
@@ -34,6 +34,7 @@
enum class Change : uint8_t {
None,
NonInherited,
+ FastPathInherited,
Inherited,
Renderer
};
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (293955 => 293956)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-05-08 07:12:20 UTC (rev 293956)
@@ -126,7 +126,7 @@
return m_scopeStack.removeLast();
}
-std::unique_ptr<RenderStyle> TreeResolver::styleForStyleable(const Styleable& styleable, const ResolutionContext& resolutionContext)
+std::unique_ptr<RenderStyle> TreeResolver::styleForStyleable(const Styleable& styleable, ResolutionType resolutionType, const ResolutionContext& resolutionContext)
{
auto& element = styleable.element;
@@ -140,6 +140,14 @@
}
}
+ if (resolutionType == ResolutionType::FastPathInherit) {
+ // If the only reason we are computing the style is that some parent inherited properties changed, we can just copy them.
+ auto& existingStyle = *element.renderOrDisplayContentsStyle();
+ auto style = RenderStyle::clonePtr(existingStyle);
+ style->fastPathInheritFrom(parent().style);
+ return style;
+ }
+
if (auto style = scope().sharingResolver.resolve(styleable, *m_update))
return style;
@@ -188,6 +196,7 @@
return DescendantsToResolve::None;
case Change::NonInherited:
return DescendantsToResolve::ChildrenWithExplicitInherit;
+ case Change::FastPathInherited:
case Change::Inherited:
return DescendantsToResolve::Children;
case Change::Renderer:
@@ -197,7 +206,7 @@
return DescendantsToResolve::None;
};
-auto TreeResolver::resolveElement(Element& element) -> std::pair<ElementUpdate, DescendantsToResolve>
+auto TreeResolver::resolveElement(Element& element, ResolutionType resolutionType) -> std::pair<ElementUpdate, DescendantsToResolve>
{
if (m_didSeePendingStylesheet && !element.renderer() && !m_document.isIgnoringPendingStylesheets()) {
m_document.setHasNodesWithMissingStyle();
@@ -210,7 +219,7 @@
auto resolutionContext = makeResolutionContext();
Styleable styleable { element, PseudoId::None };
- auto newStyle = styleForStyleable(styleable, resolutionContext);
+ auto newStyle = styleForStyleable(styleable, resolutionType, resolutionContext);
if (!affectsRenderedSubtree(element, *newStyle))
return { };
@@ -584,27 +593,35 @@
return pseudoElement->needsStyleRecalc();
}
-bool TreeResolver::shouldResolveElement(const Element& element, DescendantsToResolve parentDescendantsToResolve)
+auto TreeResolver::determineResolutionType(const Element& element, DescendantsToResolve parentDescendantsToResolve, Change parentChange) -> std::optional<ResolutionType>
{
if (element.styleValidity() != Validity::Valid)
- return true;
+ return ResolutionType::Full;
if (shouldResolvePseudoElement(element.beforePseudoElement()))
- return true;
+ return ResolutionType::Full;
if (shouldResolvePseudoElement(element.afterPseudoElement()))
- return true;
+ return ResolutionType::Full;
switch (parentDescendantsToResolve) {
case DescendantsToResolve::None:
- return false;
+ return { };
case DescendantsToResolve::Children:
+ if (parentChange == Change::FastPathInherited) {
+ auto* existingStyle = element.renderOrDisplayContentsStyle();
+ if (existingStyle && !existingStyle->disallowsFastPathInheritance())
+ return ResolutionType::FastPathInherit;
+ }
+ return ResolutionType::Full;
case DescendantsToResolve::All:
- return true;
+ return ResolutionType::Full;
case DescendantsToResolve::ChildrenWithExplicitInherit:
auto* existingStyle = element.renderOrDisplayContentsStyle();
- return existingStyle && existingStyle->hasExplicitlyInheritedProperties();
+ if (existingStyle && existingStyle->hasExplicitlyInheritedProperties())
+ return ResolutionType::Full;
+ return { };
};
ASSERT_NOT_REACHED();
- return false;
+ return { };
}
static void clearNeedsStyleResolution(Element& element)
@@ -708,8 +725,8 @@
auto descendantsToResolve = DescendantsToResolve::None;
auto previousContainerType = style ? style->containerType() : ContainerType::None;
- bool shouldResolve = shouldResolveElement(element, parent.descendantsToResolve);
- if (shouldResolve) {
+ auto resolutionType = determineResolutionType(element, parent.descendantsToResolve, parent.change);
+ if (resolutionType) {
if (!element.hasDisplayContents())
element.resetComputedStyle();
element.resetStyleRelations();
@@ -717,7 +734,7 @@
if (element.hasCustomStyleResolveCallbacks())
element.willRecalcStyle(parent.change);
- auto [elementUpdate, elementDescendantsToResolve] = resolveElement(element);
+ auto [elementUpdate, elementDescendantsToResolve] = resolveElement(element, *resolutionType);
if (element.hasCustomStyleResolveCallbacks())
element.didRecalcStyle(elementUpdate.change);
Modified: trunk/Source/WebCore/style/StyleTreeResolver.h (293955 => 293956)
--- trunk/Source/WebCore/style/StyleTreeResolver.h 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Source/WebCore/style/StyleTreeResolver.h 2022-05-08 07:12:20 UTC (rev 293956)
@@ -58,7 +58,8 @@
bool hasUnresolvedQueryContainers() const { return !m_unresolvedQueryContainers.isEmpty(); }
private:
- std::unique_ptr<RenderStyle> styleForStyleable(const Styleable&, const ResolutionContext&);
+ enum class ResolutionType : uint8_t { FastPathInherit, Full };
+ std::unique_ptr<RenderStyle> styleForStyleable(const Styleable&, ResolutionType, const ResolutionContext&);
void resolveComposedTree();
@@ -66,7 +67,7 @@
QueryContainerAction updateQueryContainer(Element&, const RenderStyle&, ContainerType previousContainerType);
enum class DescendantsToResolve : uint8_t { None, ChildrenWithExplicitInherit, Children, All };
- std::pair<ElementUpdate, DescendantsToResolve> resolveElement(Element&);
+ std::pair<ElementUpdate, DescendantsToResolve> resolveElement(Element&, ResolutionType);
static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change, const ResolutionContext&);
std::optional<ElementUpdate> resolvePseudoElement(Element&, PseudoId, const ElementUpdate&);
@@ -109,7 +110,7 @@
void popParentsToDepth(unsigned depth);
static DescendantsToResolve computeDescendantsToResolve(Change, Validity, DescendantsToResolve);
- static bool shouldResolveElement(const Element&, DescendantsToResolve);
+ static std::optional<ResolutionType> determineResolutionType(const Element&, DescendantsToResolve, Change parentChange);
static void resetDescendantStyleRelations(Element&, DescendantsToResolve);
ResolutionContext makeResolutionContext();
Modified: trunk/Tools/ChangeLog (293955 => 293956)
--- trunk/Tools/ChangeLog 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Tools/ChangeLog 2022-05-08 07:12:20 UTC (rev 293956)
@@ -1,3 +1,14 @@
+2022-05-08 Antti Koivisto <[email protected]>
+
+ Avoid resolving style for elements that only inherit changes from parent
+ https://bugs.webkit.org/show_bug.cgi?id=240132
+ <rdar://problem/92867346>
+
+ Reviewed by Sam Weinig.
+
+ * Scripts/webkitpy/style/checkers/jsonchecker.py:
+ (JSONCSSPropertiesChecker.check_codegen_properties):
+
2022-05-06 Wenson Hsieh <[email protected]>
Don't show "Markup Image" item for images that have already been marked up
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py (293955 => 293956)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py 2022-05-08 05:50:00 UTC (rev 293955)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py 2022-05-08 07:12:20 UTC (rev 293956)
@@ -290,6 +290,7 @@
'custom': self.validate_string,
'descriptor-only': self.validate_boolean,
'enable-if': self.validate_string,
+ 'fast-path-inherited': self.validate_boolean,
'fill-layer-property': self.validate_boolean,
'font-property': self.validate_boolean,
'getter': self.validate_string,