Index: Source/core/css/CSSValue.cpp |
diff --git a/Source/core/css/CSSValue.cpp b/Source/core/css/CSSValue.cpp |
index cd6970f776a2f293a024f7471e9973a50b5579cc..f1e37a8a8c8f0c8a5164716f668fa4e665567532 100644 |
--- a/Source/core/css/CSSValue.cpp |
+++ b/Source/core/css/CSSValue.cpp |
@@ -85,6 +85,21 @@ private: |
String m_cssText; |
}; |
+// This will catch anyone doing an unnecessary cast. |
+void toTextCloneCSSValue(const TextCloneCSSValue*); |
esprehn
2013/10/15 01:17:41
We should just fix the macros. DEFINE_NODE_TYPE_CA
gyuyoung-inactive
2013/10/15 01:46:27
Yes, good idea. It looks we can change DEFINE_NODE
gyuyoung-inactive
2013/10/15 03:36:49
I upload a patch for this.
https://chromiumcoderev
|
+ |
+inline TextCloneCSSValue* toTextCloneCSSValue(CSSValue* value) |
+{ |
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isTextCloneCSSValue()); |
+ return static_cast<TextCloneCSSValue*>(value); |
+} |
+ |
+inline const TextCloneCSSValue* toTextCloneCSSValue(const CSSValue* value) |
+{ |
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isTextCloneCSSValue()); |
+ return static_cast<const TextCloneCSSValue*>(value); |
+} |
+ |
bool CSSValue::isImplicitInitialValue() const |
{ |
return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
@@ -147,7 +162,7 @@ bool CSSValue::equals(const CSSValue& other) const |
{ |
if (m_isTextClone) { |
ASSERT(isCSSOMSafe()); |
- return static_cast<const TextCloneCSSValue*>(this)->cssText() == other.cssText(); |
+ return toTextCloneCSSValue(this)->cssText() == other.cssText(); |
} |
if (m_classType == other.m_classType) { |
@@ -234,8 +249,8 @@ bool CSSValue::equals(const CSSValue& other) const |
String CSSValue::cssText() const |
{ |
if (m_isTextClone) { |
- ASSERT(isCSSOMSafe()); |
- return static_cast<const TextCloneCSSValue*>(this)->cssText(); |
+ ASSERT(isCSSOMSafe()); |
+ return toTextCloneCSSValue(this)->cssText(); |
} |
ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |
@@ -333,7 +348,7 @@ void CSSValue::destroy() |
{ |
if (m_isTextClone) { |
ASSERT(isCSSOMSafe()); |
- delete static_cast<TextCloneCSSValue*>(this); |
+ delete toTextCloneCSSValue(this); |
return; |
} |
ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM()); |