Diff
Modified: trunk/Source/WebCore/ChangeLog (252343 => 252344)
--- trunk/Source/WebCore/ChangeLog 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/ChangeLog 2019-11-12 00:34:04 UTC (rev 252344)
@@ -1,5 +1,39 @@
2019-11-11 Antti Koivisto <[email protected]>
+ Always use matched declarations cache fully when parent inherited style matches
+ https://bugs.webkit.org/show_bug.cgi?id=204083
+
+ Reviewed by Zalan Bujtas.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::applyMatchedProperties):
+
+ We used inheritedDataShared check here since it is always just pointer compare.
+ However instrumentation shows we miss out from singificant amount of cache benefit
+ due to this and the full check is not expensive.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::inheritedEqual const):
+ (WebCore::RenderStyle::inheritedNotEqual const): Deleted.
+
+ Reverse the logic.
+
+ (WebCore::RenderStyle::inheritedDataShared const): Deleted.
+
+ Not used anymore.
+
+ * rendering/style/RenderStyle.h:
+ * rendering/style/SVGRenderStyle.cpp:
+ (WebCore::SVGRenderStyle::inheritedEqual const):
+ (WebCore::SVGRenderStyle::inheritedNotEqual const): Deleted.
+ * rendering/style/SVGRenderStyle.h:
+ * style/StyleChange.cpp:
+ (WebCore::Style::determineChange):
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::createInheritedDisplayContentsStyleIfNeeded):
+
+2019-11-11 Antti Koivisto <[email protected]>
+
Empty property sets should not mark MatchedProperties uncacheable
https://bugs.webkit.org/show_bug.cgi?id=204079
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (252343 => 252344)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2019-11-12 00:34:04 UTC (rev 252344)
@@ -553,7 +553,8 @@
// style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the
// element context. This is fast and saves memory by reusing the style data structures.
style.copyNonInheritedFrom(*cacheEntry->renderStyle);
- if (parentStyle.inheritedDataShared(cacheEntry->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {
+
+ if (parentStyle.inheritedEqual(*cacheEntry->parentRenderStyle) && !isAtShadowBoundary(element)) {
InsideLink linkStatus = state.style()->insideLink();
// If the cache item parent style has identical inherited properties to the current parent style then the
// resulting style will be identical too. We copy the inherited properties over from the cache and are done.
@@ -563,6 +564,7 @@
style.setInsideLink(linkStatus);
return;
}
+
includedProperties = Style::PropertyCascade::IncludedProperties::InheritedOnly;
}
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (252343 => 252344)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2019-11-12 00:34:04 UTC (rev 252344)
@@ -428,12 +428,12 @@
}
}
-bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
+bool RenderStyle::inheritedEqual(const RenderStyle& other) const
{
- return m_inheritedFlags != other->m_inheritedFlags
- || m_inheritedData != other->m_inheritedData
- || m_svgStyle->inheritedNotEqual(other->m_svgStyle)
- || m_rareInheritedData != other->m_rareInheritedData;
+ return m_inheritedFlags == other.m_inheritedFlags
+ && m_inheritedData == other.m_inheritedData
+ && (m_svgStyle.ptr() == other.m_svgStyle.ptr() || m_svgStyle->inheritedEqual(other.m_svgStyle))
+ && m_rareInheritedData == other.m_rareInheritedData;
}
#if ENABLE(TEXT_AUTOSIZING)
@@ -581,15 +581,6 @@
#endif // ENABLE(TEXT_AUTOSIZING)
-bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
-{
- // This is a fast check that only looks if the data structures are shared.
- return m_inheritedFlags == other->m_inheritedFlags
- && m_inheritedData.ptr() == other->m_inheritedData.ptr()
- && m_svgStyle.ptr() == other->m_svgStyle.ptr()
- && m_rareInheritedData.ptr() == other->m_rareInheritedData.ptr();
-}
-
static bool positionChangeIsMovementOnly(const LengthBox& a, const LengthBox& b, const Length& width)
{
// If any unit types are different, then we can't guarantee
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (252343 => 252344)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2019-11-12 00:34:04 UTC (rev 252344)
@@ -1396,8 +1396,7 @@
const AtomString& hyphenString() const;
- bool inheritedNotEqual(const RenderStyle*) const;
- bool inheritedDataShared(const RenderStyle*) const;
+ bool inheritedEqual(const RenderStyle&) const;
#if ENABLE(TEXT_AUTOSIZING)
uint32_t hashForTextAutosizing() const;
Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp (252343 => 252344)
--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp 2019-11-12 00:34:04 UTC (rev 252344)
@@ -114,13 +114,13 @@
&& m_nonInheritedFlags == other.m_nonInheritedFlags;
}
-bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle& other) const
+bool SVGRenderStyle::inheritedEqual(const SVGRenderStyle& other) const
{
- return m_fillData != other.m_fillData
- || m_strokeData != other.m_strokeData
- || m_textData != other.m_textData
- || m_inheritedResourceData != other.m_inheritedResourceData
- || m_inheritedFlags != other.m_inheritedFlags;
+ return m_fillData == other.m_fillData
+ && m_strokeData == other.m_strokeData
+ && m_textData == other.m_textData
+ && m_inheritedResourceData == other.m_inheritedResourceData
+ && m_inheritedFlags == other.m_inheritedFlags;
}
void SVGRenderStyle::inheritFrom(const SVGRenderStyle& other)
Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.h (252343 => 252344)
--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h 2019-11-12 00:34:04 UTC (rev 252344)
@@ -37,7 +37,7 @@
Ref<SVGRenderStyle> copy() const;
~SVGRenderStyle();
- bool inheritedNotEqual(const SVGRenderStyle&) const;
+ bool inheritedEqual(const SVGRenderStyle&) const;
void inheritFrom(const SVGRenderStyle&);
void copyNonInheritedFrom(const SVGRenderStyle&);
Modified: trunk/Source/WebCore/style/StyleChange.cpp (252343 => 252344)
--- trunk/Source/WebCore/style/StyleChange.cpp 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/style/StyleChange.cpp 2019-11-12 00:34:04 UTC (rev 252344)
@@ -50,7 +50,7 @@
return Detach;
if (s1 != s2) {
- if (s1.inheritedNotEqual(&s2))
+ if (!s1.inheritedEqual(s2))
return Inherit;
if (s1.alignItems() != s2.alignItems() || s1.justifyItems() != s2.justifyItems())
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (252343 => 252344)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2019-11-12 00:17:50 UTC (rev 252343)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2019-11-12 00:34:04 UTC (rev 252344)
@@ -447,7 +447,7 @@
{
if (parentElementStyle.display() != DisplayType::Contents)
return nullptr;
- if (parentBoxStyle && !parentBoxStyle->inheritedNotEqual(&parentElementStyle))
+ if (parentBoxStyle && parentBoxStyle->inheritedEqual(parentElementStyle))
return nullptr;
// Compute style for imaginary unstyled <span> around the text node.
auto style = RenderStyle::createPtr();