Index: third_party/WebKit/Source/core/style/ComputedStyle.h |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h |
index 24caa7832faab720800d3a4962d6fdf33afcfbe8..d18257ccec5a0dcbd5b4bbf51378faa53a637886 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h |
@@ -163,11 +163,24 @@ protected: |
struct InheritedData { |
bool operator==(const InheritedData& other) const |
{ |
+ return compareEqualIndependent(other) |
+ && compareEqualNonIndependent(other); |
+ } |
+ |
+ bool operator!=(const InheritedData& other) const { return !(*this == other); } |
+ |
+ bool compareEqualIndependent(const InheritedData& other) const |
+ { |
+ return (m_visibility == other.m_visibility) |
+ && (m_pointerEvents == other.m_pointerEvents); |
+ } |
+ |
+ bool compareEqualNonIndependent(const InheritedData& other) const |
+ { |
return (m_emptyCells == other.m_emptyCells) |
&& (m_captionSide == other.m_captionSide) |
&& (m_listStyleType == other.m_listStyleType) |
&& (m_listStylePosition == other.m_listStylePosition) |
- && (m_visibility == other.m_visibility) |
&& (m_textAlign == other.m_textAlign) |
&& (m_textTransform == other.m_textTransform) |
&& (m_textUnderline == other.m_textUnderline) |
@@ -178,13 +191,10 @@ protected: |
&& (m_boxDirection == other.m_boxDirection) |
&& (m_rtlOrdering == other.m_rtlOrdering) |
&& (m_printColorAdjust == other.m_printColorAdjust) |
- && (m_pointerEvents == other.m_pointerEvents) |
&& (m_insideLink == other.m_insideLink) |
&& (m_writingMode == other.m_writingMode); |
} |
- bool operator!=(const InheritedData& other) const { return !(*this == other); } |
- |
unsigned m_emptyCells : 1; // EEmptyCells |
unsigned m_captionSide : 2; // ECaptionSide |
unsigned m_listStyleType : 7; // EListStyleType |
@@ -287,6 +297,27 @@ protected: |
// 66 bits |
} m_nonInheritedData; |
+ // For each inherited property, store a 1 if the stored value was inherited |
+ // from its parent, or 0 if it is explicitly set on this element. |
+ struct IsInheritedFlags { |
+ bool operator==(const IsInheritedFlags& other) const |
+ { |
+ return m_isPointerEventsInherited == other.m_isPointerEventsInherited |
+ && m_isVisibilityInherited == other.m_isVisibilityInherited; |
+ } |
+ |
+ bool operator!=(const IsInheritedFlags& other) const { return !(*this == other); } |
+ |
+ // Keep this list of fields in sync with: |
+ // - setBitDefaults() |
+ // - The ComputedStyle setter, which must take an extra boolean parameter and set this |
+ // - propagateIndependentInheritedProperties() in ComputedStyle.cpp |
+ // - The compareEqual() methods in the corresponding class |
+ // InheritedFlags |
+ unsigned m_isPointerEventsInherited : 1; |
+ unsigned m_isVisibilityInherited : 1; |
+ } m_isInheritedFlags; |
meade_UTC10
2016/07/13 07:29:13
It's not clear to me how m_inheritedData and m_isI
sashab
2016/07/14 05:08:42
Added a comment to explain the better way to imple
|
+ |
// !END SYNC! |
protected: |
@@ -336,6 +367,10 @@ protected: |
m_nonInheritedData.m_affectedByDrag = false; |
m_nonInheritedData.m_isLink = false; |
m_nonInheritedData.m_hasRemUnits = false; |
+ |
+ // All properties default to being inherited. |
meade_UTC10
2016/07/13 07:29:13
All independently inherited properties?
sashab
2016/07/14 05:08:41
Thanks!! Done.
sashab
2016/07/14 05:08:41
Thanks!! Done.
|
+ m_isInheritedFlags.m_isPointerEventsInherited = true; |
+ m_isInheritedFlags.m_isVisibilityInherited = true; |
} |
private: |
@@ -365,6 +400,10 @@ public: |
// Computes how the style change should be propagated down the tree. |
static StyleRecalcChange stylePropagationDiff(const ComputedStyle* oldStyle, const ComputedStyle* newStyle); |
+ // Copies the values of any independent inherited properties from parent to child |
+ // child that are not explicitly set in child. |
meade_UTC10
2016/07/13 07:29:13
You have the word "child" twice :)
sashab
2016/07/14 05:08:41
Haha thanks :) Nice find
|
+ static void propagateIndependentInheritedProperties(const ComputedStyle& parent, ComputedStyle& child); |
+ |
ContentPosition resolvedJustifyContentPosition(const StyleContentAlignmentData& normalValueBehavior) const; |
ContentDistributionType resolvedJustifyContentDistribution(const StyleContentAlignmentData& normalValueBehavior) const; |
ContentPosition resolvedAlignContentPosition(const StyleContentAlignmentData& normalValueBehavior) const; |
@@ -1622,6 +1661,10 @@ public: |
bool inheritedEqual(const ComputedStyle&) const; |
bool nonInheritedEqual(const ComputedStyle&) const; |
bool loadingCustomFontsEqual(const ComputedStyle&) const; |
+ |
+ bool independentInheritedEqual(const ComputedStyle&) const; |
+ bool nonIndependentInheritedEqual(const ComputedStyle&) const; |
+ |
bool inheritedDataShared(const ComputedStyle&) const; |
bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); } |
@@ -1682,6 +1725,10 @@ public: |
void addPaintImage(StyleImage*); |
+ // Inherited setters. |
+ void setPointerEventsIsInherited(bool isInherited) { m_isInheritedFlags.m_isPointerEventsInherited = isInherited; } |
+ void setVisibilityIsInherited(bool isInherited) { m_isInheritedFlags.m_isVisibilityInherited = isInherited; } |
+ |
// Initial values for all the properties |
static EBorderCollapse initialBorderCollapse() { return BorderCollapseSeparate; } |
static EBorderStyle initialBorderStyle() { return BorderStyleNone; } |