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 984ff42be192101a07c21c53955cd3c42a23b460..308fd1a45dd9154198195118f6e225e6dd825a83 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -64,6 +64,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->justifyItems() != newStyle->justifyItems()) // TODO (lajava): We must avoid this Reattach. |
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)) |
return Inherit; |
if (*oldStyle == *newStyle) |
@@ -210,6 +219,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()); |
+} |
+ |
ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject) |
{ |
// The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". |
@@ -342,6 +360,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()); |
@@ -421,7 +444,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; |