Add toWebKitCSS*Value functions to cast from CSSValue
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Sep 2013 14:31:42 +0000 (14:31 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Sep 2013 14:31:42 +0000 (14:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121776

Reviewed by Andreas Kling.

CSS_VALUE_TYPE_CASTS can't cover WebKitCSS*Value classes. So, this patch adds toWebKitCSS*Value manually.

No new tests, no behavior change.

* css/CSSValue.cpp:
(WebCore::CSSValue::destroy):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::createCustomFilterOperationWithInlineSyntax):
(WebCore::StyleResolver::createFilterOperations):
* css/TransformFunctions.cpp:
(WebCore::transformsForValue):
* css/WebKitCSSArrayFunctionValue.h:
(WebCore::toWebKitCSSArrayFunctionValue):
* css/WebKitCSSFilterValue.h:
(WebCore::toWebKitCSSFilterValue):
* css/WebKitCSSMatFunctionValue.h:
(WebCore::toWebKitCSSMatFunctionValue):
* css/WebKitCSSMixFunctionValue.h:
(WebCore::toWebKitCSSMixFunctionValue):
* css/WebKitCSSSVGDocumentValue.h:
(WebCore::toWebKitCSSSVGDocumentValue):
* css/WebKitCSSShaderValue.h:
(WebCore::toWebKitCSSShaderValue):
* css/WebKitCSSTransformValue.h:
(WebCore::toWebKitCSSTransformValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156542 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/TransformFunctions.cpp
Source/WebCore/css/WebKitCSSArrayFunctionValue.h
Source/WebCore/css/WebKitCSSFilterValue.h
Source/WebCore/css/WebKitCSSMatFunctionValue.h
Source/WebCore/css/WebKitCSSMixFunctionValue.h
Source/WebCore/css/WebKitCSSSVGDocumentValue.h
Source/WebCore/css/WebKitCSSTransformValue.h

index 1e4c53a..5c589ec 100644 (file)
@@ -1,3 +1,36 @@
+2013-09-27  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Add toWebKitCSS*Value functions to cast from CSSValue
+        https://bugs.webkit.org/show_bug.cgi?id=121776
+
+        Reviewed by Andreas Kling.
+
+        CSS_VALUE_TYPE_CASTS can't cover WebKitCSS*Value classes. So, this patch adds toWebKitCSS*Value manually.
+
+        No new tests, no behavior change.
+
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::destroy):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::createCustomFilterOperationWithInlineSyntax):
+        (WebCore::StyleResolver::createFilterOperations):
+        * css/TransformFunctions.cpp:
+        (WebCore::transformsForValue):
+        * css/WebKitCSSArrayFunctionValue.h:
+        (WebCore::toWebKitCSSArrayFunctionValue):
+        * css/WebKitCSSFilterValue.h:
+        (WebCore::toWebKitCSSFilterValue):
+        * css/WebKitCSSMatFunctionValue.h:
+        (WebCore::toWebKitCSSMatFunctionValue):
+        * css/WebKitCSSMixFunctionValue.h:
+        (WebCore::toWebKitCSSMixFunctionValue):
+        * css/WebKitCSSSVGDocumentValue.h:
+        (WebCore::toWebKitCSSSVGDocumentValue):
+        * css/WebKitCSSShaderValue.h:
+        (WebCore::toWebKitCSSShaderValue):
+        * css/WebKitCSSTransformValue.h:
+        (WebCore::toWebKitCSSTransformValue):
+
 2013-09-27  Zalan Bujtas  <zalan@apple.com>
 
         Unexpected word wrapping for wrapped content then raw content.
index b36990d..eba937c 100644 (file)
@@ -446,7 +446,7 @@ void CSSValue::destroy()
         delete static_cast<CSSValueList*>(this);
         return;
     case WebKitCSSTransformClass:
-        delete static_cast<WebKitCSSTransformValue*>(this);
+        delete toWebKitCSSTransformValue(this);
         return;
     case LineBoxContainClass:
         delete static_cast<CSSLineBoxContainValue*>(this);
@@ -464,17 +464,17 @@ void CSSValue::destroy()
         delete static_cast<CSSFilterImageValue*>(this);
         return;
     case WebKitCSSFilterClass:
-        delete static_cast<WebKitCSSFilterValue*>(this);
+        delete toWebKitCSSFilterValue(this);
         return;
 #if ENABLE(CSS_SHADERS)
     case WebKitCSSArrayFunctionValueClass:
-        delete static_cast<WebKitCSSArrayFunctionValue*>(this);
+        delete toWebKitCSSArrayFunctionValue(this);
         return;
     case WebKitCSSMatFunctionValueClass:
-        delete static_cast<WebKitCSSMatFunctionValue*>(this);
+        delete toWebKitCSSMatFunctionValue(this);
         return;
     case WebKitCSSMixFunctionValueClass:
-        delete static_cast<WebKitCSSMixFunctionValue*>(this);
+        delete toWebKitCSSMixFunctionValue(this);
         return;
     case WebKitCSSShaderClass:
         delete static_cast<WebKitCSSShaderValue*>(this);
@@ -494,7 +494,7 @@ void CSSValue::destroy()
         delete static_cast<SVGPaint*>(this);
         return;
     case WebKitCSSSVGDocumentClass:
-        delete static_cast<WebKitCSSSVGDocumentValue*>(this);
+        delete toWebKitCSSSVGDocumentValue(this);
         return;
 #endif
     }
index c60dae2..5dee84d 100644 (file)
@@ -3636,7 +3636,7 @@ PassRefPtr<CustomFilterOperation> StyleResolver::createCustomFilterOperationWith
     if (shadersListLength > 1) {
         CSSValue* fragmentShaderOrMixFunction = shadersList->itemWithoutBoundsCheck(1);
         if (fragmentShaderOrMixFunction->isWebKitCSSMixFunctionValue()) {
-            WebKitCSSMixFunctionValue* mixFunction = static_cast<WebKitCSSMixFunctionValue*>(fragmentShaderOrMixFunction);
+            WebKitCSSMixFunctionValue* mixFunction = toWebKitCSSMixFunctionValue(fragmentShaderOrMixFunction);
             CSSValueListIterator iterator(mixFunction);
 
             ASSERT(mixFunction->length());
@@ -3760,7 +3760,7 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations&
         if (!currValue->isWebKitCSSFilterValue())
             continue;
 
-        WebKitCSSFilterValue* filterValue = static_cast<WebKitCSSFilterValue*>(i.value());
+        WebKitCSSFilterValue* filterValue = toWebKitCSSFilterValue(i.value());
         FilterOperation::OperationType operationType = filterOperationForType(filterValue->operationType());
 
 #if ENABLE(CSS_SHADERS)
@@ -3787,7 +3787,7 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations&
             if (!argument->isWebKitCSSSVGDocumentValue())
                 continue;
 
-            WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSSVGDocumentValue*>(argument);
+            WebKitCSSSVGDocumentValue* svgDocumentValue = toWebKitCSSSVGDocumentValue(argument);
             KURL url = m_state.document().completeURL(svgDocumentValue->url());
 
             RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType);
index 4725f86..23aff49 100644 (file)
@@ -96,7 +96,7 @@ bool transformsForValue(const RenderStyle* style, const RenderStyle* rootStyle,
         if (!currValue->isWebKitCSSTransformValue())
             continue;
 
-        WebKitCSSTransformValue* transformValue = static_cast<WebKitCSSTransformValue*>(i.value());
+        WebKitCSSTransformValue* transformValue = toWebKitCSSTransformValue(i.value());
         if (!transformValue->length())
             continue;
 
index c1c9e2a..34f21ac 100644 (file)
@@ -55,6 +55,12 @@ private:
     WebKitCSSArrayFunctionValue(const WebKitCSSArrayFunctionValue& cloneFrom);
 };
 
+inline WebKitCSSArrayFunctionValue* toWebKitCSSArrayFunctionValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSArrayFunctionValue());
+    return static_cast<WebKitCSSArrayFunctionValue*>(value);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_SHADERS)
index d6df3c8..86a2552 100644 (file)
@@ -77,6 +77,12 @@ private:
     FilterOperationType m_type;
 };
 
+inline WebKitCSSFilterValue* toWebKitCSSFilterValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSFilterValue());
+    return static_cast<WebKitCSSFilterValue*>(value);
+}
+
 }
 
 #endif // ENABLE(CSS_FILTERS)
index 530bb23..39dac9a 100644 (file)
@@ -55,6 +55,12 @@ private:
     WebKitCSSMatFunctionValue(const WebKitCSSMatFunctionValue& cloneFrom);
 };
 
+inline WebKitCSSMatFunctionValue* toWebKitCSSMatFunctionValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSMatFunctionValue());
+    return static_cast<WebKitCSSMatFunctionValue*>(value);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_SHADERS)
index f8f40e2..f57fc06 100644 (file)
@@ -54,6 +54,12 @@ private:
     WebKitCSSMixFunctionValue();
     WebKitCSSMixFunctionValue(const WebKitCSSMixFunctionValue& cloneFrom);
 };
+
+inline WebKitCSSMixFunctionValue* toWebKitCSSMixFunctionValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSMixFunctionValue());
+    return static_cast<WebKitCSSMixFunctionValue*>(value);
+}
     
 } // namespace WebCore
 
index 4f2a053..30f71f9 100644 (file)
@@ -54,6 +54,12 @@ private:
     bool m_loadRequested;
 };
 
+inline WebKitCSSSVGDocumentValue* toWebKitCSSSVGDocumentValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSSVGDocumentValue());
+    return static_cast<WebKitCSSSVGDocumentValue*>(value);
+}
+
 } // namespace WebCore
 
 #endif // WebKitCSSSVGDocumentValue_h
index ec092a8..ff34424 100644 (file)
@@ -82,6 +82,12 @@ private:
     TransformOperationType m_type;
 };
 
+inline WebKitCSSTransformValue* toWebKitCSSTransformValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSSTransformValue());
+    return static_cast<WebKitCSSTransformValue*>(value);
+}
+
 }
 
 #endif