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

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

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: Created 4 years, 5 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.h
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index a66a3f692703a6fc7afc027125741241d2e39597..524da95010284620365e3867ad5842b0659999cc 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -25,6 +25,7 @@
#ifndef ComputedStyle_h
#define ComputedStyle_h
+#include "core/BaseComputedStyle.h"
#include "core/CSSPropertyNames.h"
#include "core/CoreExport.h"
#include "core/style/BorderValue.h"
@@ -71,7 +72,6 @@
#include "platform/transforms/TransformOperations.h"
#include "wtf/Forward.h"
#include "wtf/LeakAnnotations.h"
-#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include <memory>
@@ -123,7 +123,20 @@ class ContentData;
typedef Vector<RefPtr<ComputedStyle>, 4> PseudoStyleCache;
-class CORE_EXPORT ComputedStyle: public RefCounted<ComputedStyle> {
+// ComputedStyle stores the final style for an element and provides the
+// interface between the style engine and the rest of Blink.
+//
+// It contains all the resolved styles for an element, and is densely packed and
+// optimized for memory and performance. Enums and small fields are packed in
+// bit fields, while large fields are stored in pointers and shared where not
+// modified from their parent value (see the DataRef class).
+//
+// Currently, ComputedStyle is hand-written and BaseComputedStyle is generated.
+// Over time, methods will be moved to BaseComputedStyle and the generator will
+// be expanded to handle more and more types of properties. Eventually, all
+// methods will be on BaseComputedStyle (with custom methods defined in a class
+// such as BaseComputedStyle.cpp) and ComputedStyle will be removed.
+class CORE_EXPORT ComputedStyle: public BaseComputedStyle {
friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the color styles
friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
friend class CSSPropertyEquality; // Used by CSS animations. We can't allow them to animate based off visited colors.
@@ -168,7 +181,6 @@ protected:
&& (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)
@@ -190,7 +202,6 @@ protected:
unsigned m_captionSide : 2; // ECaptionSide
unsigned m_listStyleType : 7; // EListStyleType
unsigned m_listStylePosition : 1; // EListStylePosition
- unsigned m_visibility : 2; // EVisibility
unsigned m_textAlign : 4; // ETextAlign
unsigned m_textTransform : 2; // ETextTransform
unsigned m_textUnderline : 1;
@@ -294,11 +305,11 @@ protected:
void setBitDefaults()
{
+ BaseComputedStyle::setBitDefaults();
m_inheritedData.m_emptyCells = initialEmptyCells();
m_inheritedData.m_captionSide = initialCaptionSide();
m_inheritedData.m_listStyleType = initialListStyleType();
m_inheritedData.m_listStylePosition = initialListStylePosition();
- m_inheritedData.m_visibility = static_cast<unsigned>(initialVisibility());
m_inheritedData.m_textAlign = initialTextAlign();
m_inheritedData.m_textTransform = initialTextTransform();
m_inheritedData.m_textUnderline = false;
@@ -379,11 +390,6 @@ public:
StyleDifference visualInvalidationDiff(const ComputedStyle&) const;
- enum IsAtShadowBoundary {
- AtShadowBoundary,
- NotAtShadowBoundary,
- };
-
void inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBoundary = NotAtShadowBoundary);
void copyNonInheritedFromCached(const ComputedStyle&);
@@ -1467,11 +1473,6 @@ public:
ETextTransform textTransform() const { return static_cast<ETextTransform>(m_inheritedData.m_textTransform); }
void setTextTransform(ETextTransform v) { m_inheritedData.m_textTransform = v; }
- // visibility
- static EVisibility initialVisibility() { return EVisibility::Visible; }
- EVisibility visibility() const { return static_cast<EVisibility>(m_inheritedData.m_visibility); }
- void setVisibility(EVisibility v) { m_inheritedData.m_visibility = static_cast<unsigned>(v); }
-
// white-space inherited
static EWhiteSpace initialWhiteSpace() { return NORMAL; }
EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace); }

Powered by Google App Engine
This is Rietveld 408576698