WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-71667.diff (text/plain), 8.20 KB, created by
Andreas Kling
on 2011-11-07 04:49:52 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andreas Kling
Created:
2011-11-07 04:49:52 PST
Size:
8.20 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 61ceb03..8fda469 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2011-11-06 Andreas Kling <kling@webkit.org> >+ >+ CSSValue: Devirtualize cssValueType(). >+ <http://webkit.org/b/71667> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Keep the cssValueType in a CSSValue member instead of using >+ virtual functions. >+ >+ This is part of a project to completely devirtualize CSSValue >+ <http://webkit.org/b/71666> and will incur a temporary object >+ size regression for CSSValue while the work is ongoing. >+ >+ * css/CSSInheritedValue.cpp: >+ * css/CSSInheritedValue.h: >+ (WebCore::CSSInheritedValue::CSSInheritedValue): >+ * css/CSSInitialValue.cpp: >+ * css/CSSInitialValue.h: >+ (WebCore::CSSInitialValue::CSSInitialValue): >+ * css/CSSPrimitiveValue.cpp: >+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): >+ * css/CSSPrimitiveValue.h: >+ * css/CSSValue.h: >+ (WebCore::CSSValue::cssValueType): >+ (WebCore::CSSValue::CSSValue): >+ * css/CSSValueList.cpp: >+ (WebCore::CSSValueList::CSSValueList): >+ * css/CSSValueList.h: >+ > 2011-11-07 Pavel Feldman <pfeldman@chromium.org> > > Web Inspector: split script-formatter test into multiple tests. >diff --git a/Source/WebCore/css/CSSInheritedValue.cpp b/Source/WebCore/css/CSSInheritedValue.cpp >index 20b73e2..a2de18a 100644 >--- a/Source/WebCore/css/CSSInheritedValue.cpp >+++ b/Source/WebCore/css/CSSInheritedValue.cpp >@@ -25,11 +25,6 @@ > > namespace WebCore { > >-unsigned short CSSInheritedValue::cssValueType() const >-{ >- return CSS_INHERIT; >-} >- > String CSSInheritedValue::cssText() const > { > return "inherit"; >diff --git a/Source/WebCore/css/CSSInheritedValue.h b/Source/WebCore/css/CSSInheritedValue.h >index e015a98..c1d9dec 100644 >--- a/Source/WebCore/css/CSSInheritedValue.h >+++ b/Source/WebCore/css/CSSInheritedValue.h >@@ -36,8 +36,10 @@ public: > virtual String cssText() const; > > private: >- CSSInheritedValue() { } >- virtual unsigned short cssValueType() const; >+ CSSInheritedValue() >+ : CSSValue(CSS_INHERIT) >+ { >+ } > }; > > } // namespace WebCore >diff --git a/Source/WebCore/css/CSSInitialValue.cpp b/Source/WebCore/css/CSSInitialValue.cpp >index 0d0c55c..6c8cf36 100644 >--- a/Source/WebCore/css/CSSInitialValue.cpp >+++ b/Source/WebCore/css/CSSInitialValue.cpp >@@ -25,11 +25,6 @@ > > namespace WebCore { > >-unsigned short CSSInitialValue::cssValueType() const >-{ >- return CSS_INITIAL; >-} >- > String CSSInitialValue::cssText() const > { > return "initial"; >diff --git a/Source/WebCore/css/CSSInitialValue.h b/Source/WebCore/css/CSSInitialValue.h >index 01bb63d..cbbb5bf 100644 >--- a/Source/WebCore/css/CSSInitialValue.h >+++ b/Source/WebCore/css/CSSInitialValue.h >@@ -43,7 +43,8 @@ public: > > private: > CSSInitialValue(bool implicit) >- : m_implicit(implicit) >+ : CSSValue(CSS_INITIAL) >+ , m_implicit(implicit) > { > } > >@@ -52,7 +53,6 @@ private: > return adoptRef(new CSSInitialValue(implicit)); > } > >- virtual unsigned short cssValueType() const; > virtual bool isImplicitInitialValue() const { return m_implicit; } > > bool m_implicit; >diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp >index 5f9a6e1..2b99d30 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.cpp >+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp >@@ -164,14 +164,16 @@ static const AtomicString& valueOrPropertyName(int valueOrPropertyID) > } > > CSSPrimitiveValue::CSSPrimitiveValue() >- : m_type(0) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_type(0) > , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { > } > > CSSPrimitiveValue::CSSPrimitiveValue(int ident) >- : m_type(CSS_IDENT) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_type(CSS_IDENT) > , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { >@@ -179,7 +181,8 @@ CSSPrimitiveValue::CSSPrimitiveValue(int ident) > } > > CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type) >- : m_type(type) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_type(type) > , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { >@@ -188,7 +191,8 @@ CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type) > } > > CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type) >- : m_type(type) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_type(type) > , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { >@@ -197,7 +201,8 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type) > } > > CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) >- : m_type(CSS_RGBCOLOR) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_type(CSS_RGBCOLOR) > , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { >@@ -205,7 +210,8 @@ CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) > } > > CSSPrimitiveValue::CSSPrimitiveValue(const Length& length) >- : m_hasCachedCSSText(false) >+ : CSSValue(CSS_PRIMITIVE_VALUE) >+ , m_hasCachedCSSText(false) > , m_isQuirkValue(false) > { > switch (length.type()) { >@@ -664,11 +670,6 @@ Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const > return m_value.pair; > } > >-unsigned short CSSPrimitiveValue::cssValueType() const >-{ >- return CSS_PRIMITIVE_VALUE; >-} >- > bool CSSPrimitiveValue::parseString(const String& /*string*/, bool /*strict*/) > { > // FIXME >diff --git a/Source/WebCore/css/CSSPrimitiveValue.h b/Source/WebCore/css/CSSPrimitiveValue.h >index 46f3642..aaba1f1 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.h >+++ b/Source/WebCore/css/CSSPrimitiveValue.h >@@ -252,8 +252,6 @@ private: > > virtual bool isPrimitiveValue() const { return true; } > >- virtual unsigned short cssValueType() const; >- > signed m_type : UnitTypesBits; > mutable unsigned m_hasCachedCSSText : 1; > unsigned m_isQuirkValue : 1; >diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h >index cf974f6..6283932 100644 >--- a/Source/WebCore/css/CSSValue.h >+++ b/Source/WebCore/css/CSSValue.h >@@ -34,8 +34,7 @@ typedef int ExceptionCode; > > class CSSValue : public RefCounted<CSSValue> { > public: >- // FIXME: Change name to Type. >- enum UnitTypes { >+ enum Type { > CSS_INHERIT = 0, > CSS_PRIMITIVE_VALUE = 1, > CSS_VALUE_LIST = 2, >@@ -45,8 +44,7 @@ public: > > virtual ~CSSValue() { } > >- // FIXME: Change this to return UnitTypes. >- virtual unsigned short cssValueType() const { return CSS_CUSTOM; } >+ Type cssValueType() const { return static_cast<Type>(m_type); } > > virtual String cssText() const = 0; > void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented. >@@ -81,6 +79,15 @@ public: > #endif > > virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*) { } >+ >+protected: >+ CSSValue(Type type = CSS_CUSTOM) >+ : m_type(type) >+ { >+ } >+ >+private: >+ unsigned m_type : 3; // Type > }; > > } // namespace WebCore >diff --git a/Source/WebCore/css/CSSValueList.cpp b/Source/WebCore/css/CSSValueList.cpp >index 2e4d7a0..591b2a8 100644 >--- a/Source/WebCore/css/CSSValueList.cpp >+++ b/Source/WebCore/css/CSSValueList.cpp >@@ -28,12 +28,14 @@ > namespace WebCore { > > CSSValueList::CSSValueList(bool isSpaceSeparated) >- : m_isSpaceSeparated(isSpaceSeparated) >+ : CSSValue(CSS_VALUE_LIST) >+ , m_isSpaceSeparated(isSpaceSeparated) > { > } > > CSSValueList::CSSValueList(CSSParserValueList* list) >- : m_isSpaceSeparated(true) >+ : CSSValue(CSS_VALUE_LIST) >+ , m_isSpaceSeparated(true) > { > if (list) { > size_t size = list->size(); >@@ -46,11 +48,6 @@ CSSValueList::~CSSValueList() > { > } > >-unsigned short CSSValueList::cssValueType() const >-{ >- return CSS_VALUE_LIST; >-} >- > void CSSValueList::append(PassRefPtr<CSSValue> val) > { > m_values.append(val); >diff --git a/Source/WebCore/css/CSSValueList.h b/Source/WebCore/css/CSSValueList.h >index 463cae3..2423d5b 100644 >--- a/Source/WebCore/css/CSSValueList.h >+++ b/Source/WebCore/css/CSSValueList.h >@@ -67,8 +67,6 @@ protected: > private: > virtual bool isValueList() const { return true; } > >- virtual unsigned short cssValueType() const; >- > Vector<RefPtr<CSSValue> > m_values; > bool m_isSpaceSeparated; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71667
: 113845