Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2187493004: Add a generated ComputedStyleBase class that ComputedStyle extends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_visibility_enum_class_rebase
Patch Set: Rebase onto fast path patches Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d8c9c2bba30a8f62674f3253bf2aa23f13848807..f944d5b288b6f4ff09bb9a27a3ef80e78dfbafb6 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -68,6 +68,10 @@ static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue
// Since different compilers/architectures pack ComputedStyle differently,
// re-create the same structure for an accurate size comparison.
struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> {
+ // The size of ComputedStyle increases by 1 pointer since we are now
+ // inheriting from the generated parent class. This change is temporary and
+ // will go away once ComputedStyleBase becomes ComputedStyle.
+ void* parentClass[1];
void* dataRefs[7];
void* ownPtrs[1];
void* dataRefSvgStyle;
@@ -113,7 +117,8 @@ PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other)
}
ALWAYS_INLINE ComputedStyle::ComputedStyle()
- : m_box(initialStyle().m_box)
+ : ComputedStyleBase()
+ , m_box(initialStyle().m_box)
, m_visual(initialStyle().m_visual)
, m_background(initialStyle().m_background)
, m_surround(initialStyle().m_surround)
@@ -128,6 +133,7 @@ ALWAYS_INLINE ComputedStyle::ComputedStyle()
}
ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag)
+ : ComputedStyleBase()
{
setBitDefaults();
@@ -152,7 +158,7 @@ ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag)
}
ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o)
- : RefCounted<ComputedStyle>()
+ : ComputedStyleBase(o)
, m_box(o.m_box)
, m_visual(o.m_visual)
, m_background(o.m_background)
@@ -306,6 +312,7 @@ ContentDistributionType ComputedStyle::resolvedAlignContentDistribution(const St
void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBoundary isAtShadowBoundary)
{
+ ComputedStyleBase::inheritFrom(inheritParent, isAtShadowBoundary);
if (isAtShadowBoundary == AtShadowBoundary) {
// Even if surrounding content is user-editable, shadow DOM should act as a single unit, and not necessarily be editable
EUserModify currentUserModify = userModify();
@@ -470,12 +477,14 @@ bool ComputedStyle::inheritedEqual(const ComputedStyle& other) const
bool ComputedStyle::independentInheritedEqual(const ComputedStyle& other) const
{
- return m_inheritedData.compareEqualIndependent(other.m_inheritedData);
+ return ComputedStyleBase::independentInheritedEqual(other)
+ && m_inheritedData.compareEqualIndependent(other.m_inheritedData);
}
bool ComputedStyle::nonIndependentInheritedEqual(const ComputedStyle& other) const
{
- return m_inheritedData.compareEqualNonIndependent(other.m_inheritedData)
+ return ComputedStyleBase::nonIndependentInheritedEqual(other)
+ && m_inheritedData.compareEqualNonIndependent(other.m_inheritedData)
&& m_styleInheritedData == other.m_styleInheritedData
&& m_svgStyle->inheritedEqual(*other.m_svgStyle)
&& m_rareInheritedData == other.m_rareInheritedData;
@@ -501,7 +510,9 @@ bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const
bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const
{
// This is a fast check that only looks if the data structures are shared.
- return m_inheritedData == other.m_inheritedData
+ // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method?
+ return ComputedStyleBase::inheritedEqual(other)
+ && m_inheritedData == other.m_inheritedData
&& m_styleInheritedData.get() == other.m_styleInheritedData.get()
&& m_svgStyle.get() == other.m_svgStyle.get()
&& m_rareInheritedData.get() == other.m_rareInheritedData.get();
@@ -810,7 +821,7 @@ bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
if (!m_background->outline().visuallyEqual(other.m_background->outline()))
return true;
- if (m_inheritedData.m_visibility != other.m_inheritedData.m_visibility
+ if (visibility() != other.visibility()
|| m_inheritedData.m_printColorAdjust != other.m_inheritedData.m_printColorAdjust
|| m_inheritedData.m_insideLink != other.m_inheritedData.m_insideLink
|| !m_surround->border.visuallyEqual(other.m_surround->border)

Powered by Google App Engine
This is Rietveld 408576698