Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
index 3a671d051c066787e9e0174febf1e9470cb43c82..d4ecea553149fae5db25b9120f62e06e9f4021a2 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -65,6 +65,8 @@ struct SameSizeAsBorderValue { |
static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue should stay small"); |
+// Since different compilers/architectures pack ComputedStyle differently, |
+// re-create the same structure for an accurate size comparison. |
struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { |
void* dataRefs[7]; |
void* ownPtrs[1]; |
@@ -197,8 +199,15 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt |
|| oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
return Reattach; |
- if (!oldStyle->inheritedEqual(*newStyle) |
- || !oldStyle->loadingCustomFontsEqual(*newStyle) |
+ bool independentEqual = oldStyle->independentInheritedEqual(*newStyle); |
+ bool nonIndependentEqual = oldStyle->nonIndependentInheritedEqual(*newStyle); |
+ if (!independentEqual || !nonIndependentEqual) { |
+ if (nonIndependentEqual && !oldStyle->hasExplicitlyInheritedProperties()) |
+ return IndependentInherit; |
+ return Inherit; |
+ } |
+ |
+ if (!oldStyle->loadingCustomFontsEqual(*newStyle) |
|| oldStyle->alignItems() != newStyle->alignItems() |
|| oldStyle->justifyItems() != newStyle->justifyItems()) |
return Inherit; |
@@ -212,6 +221,15 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt |
return NoInherit; |
} |
+// TODO(sashab): Generate this function. |
+void ComputedStyle::propagateIndependentInheritedProperties(const ComputedStyle& parentStyle) |
+{ |
+ if (m_nonInheritedData.m_isPointerEventsInherited) |
+ setPointerEvents(parentStyle.pointerEvents()); |
+ if (m_nonInheritedData.m_isVisibilityInherited) |
+ setVisibility(parentStyle.visibility()); |
+} |
+ |
StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignmentData& value, ItemPosition normalValueBehavior) |
{ |
// To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it. |
@@ -362,6 +380,11 @@ void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) |
// m_nonInheritedData.m_affectedByDrag |
// m_nonInheritedData.m_isLink |
+ // Any properties that are inherited on a style are also inherited on elements |
+ // that share this style. |
+ m_nonInheritedData.m_isPointerEventsInherited = other.m_nonInheritedData.m_isPointerEventsInherited; |
+ m_nonInheritedData.m_isVisibilityInherited = other.m_nonInheritedData.m_isVisibilityInherited; |
+ |
if (m_svgStyle != other.m_svgStyle) |
m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); |
DCHECK_EQ(zoom(), initialZoom()); |
@@ -441,7 +464,18 @@ void ComputedStyle::removeCachedPseudoStyle(PseudoId pid) |
bool ComputedStyle::inheritedEqual(const ComputedStyle& other) const |
{ |
- return m_inheritedData == other.m_inheritedData |
+ return independentInheritedEqual(other) |
+ && nonIndependentInheritedEqual(other); |
+} |
+ |
+bool ComputedStyle::independentInheritedEqual(const ComputedStyle& other) const |
+{ |
+ return m_inheritedData.compareEqualIndependent(other.m_inheritedData); |
+} |
+ |
+bool ComputedStyle::nonIndependentInheritedEqual(const ComputedStyle& other) const |
+{ |
+ return m_inheritedData.compareEqualNonIndependent(other.m_inheritedData) |
&& m_styleInheritedData == other.m_styleInheritedData |
&& m_svgStyle->inheritedEqual(*other.m_svgStyle) |
&& m_rareInheritedData == other.m_rareInheritedData; |