Generate toCSSFooValue() for CSSFilterImageValue and CSSInitialValue
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 05:22:22 +0000 (05:22 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 05:22:22 +0000 (05:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122056

Reviewed by Antti Koivisto.

Generate toCSSFooValue() for CSSFilterImageValue and CSSInitialValue, and use it.
This type cast function will help to detect bad-casts.

No new tests, no behavior changes.

* css/CSSFilterImageValue.h:
* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::image):
(WebCore::CSSImageGeneratorValue::fixedSize):
(WebCore::CSSImageGeneratorValue::loadSubimages):
* css/CSSInitialValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::destroy):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::generatedOrPendingFromValue):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSFilterImageValue.h
Source/WebCore/css/CSSImageGeneratorValue.cpp
Source/WebCore/css/CSSInitialValue.h
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/StyleResolver.cpp

index 8905578..23993f8 100644 (file)
@@ -1,3 +1,26 @@
+2013-09-29  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate toCSSFooValue() for CSSFilterImageValue and CSSInitialValue
+        https://bugs.webkit.org/show_bug.cgi?id=122056
+
+        Reviewed by Antti Koivisto.
+
+        Generate toCSSFooValue() for CSSFilterImageValue and CSSInitialValue, and use it.
+        This type cast function will help to detect bad-casts.
+
+        No new tests, no behavior changes.
+
+        * css/CSSFilterImageValue.h:
+        * css/CSSImageGeneratorValue.cpp:
+        (WebCore::CSSImageGeneratorValue::image):
+        (WebCore::CSSImageGeneratorValue::fixedSize):
+        (WebCore::CSSImageGeneratorValue::loadSubimages):
+        * css/CSSInitialValue.h:
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::destroy):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::generatedOrPendingFromValue):
+
 2013-09-29  Darin Adler  <darin@apple.com>
 
         Fix crashes caused by my recent attempt at a Windows build fix.
index 1c2cb5f..22e083b 100644 (file)
@@ -119,11 +119,7 @@ private:
     FilterSubimageObserverProxy m_filterSubimageObserver;
 };
 
-inline CSSFilterImageValue* toCSSFilterImageValue(CSSImageGeneratorValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isFilterImageValue());
-    return static_cast<CSSFilterImageValue*>(value);
-}
+CSS_VALUE_TYPE_CASTS(FilterImageValue)
 
 } // namespace WebCore
 
index 101575d..274472b 100644 (file)
@@ -113,7 +113,7 @@ PassRefPtr<Image> CSSImageGeneratorValue::image(RenderElement* renderer, const I
         return static_cast<CSSCrossfadeValue*>(this)->image(renderer, size);
 #if ENABLE(CSS_FILTERS)
     case FilterImageClass:
-        return static_cast<CSSFilterImageValue*>(this)->image(renderer, size);
+        return toCSSFilterImageValue(this)->image(renderer, size);
 #endif
     case LinearGradientClass:
         return static_cast<CSSLinearGradientValue*>(this)->image(renderer, size);
@@ -155,7 +155,7 @@ IntSize CSSImageGeneratorValue::fixedSize(const RenderElement* renderer)
         return static_cast<CSSCrossfadeValue*>(this)->fixedSize(renderer);
 #if ENABLE(CSS_FILTERS)
     case FilterImageClass:
-        return static_cast<CSSFilterImageValue*>(this)->fixedSize(renderer);
+        return toCSSFilterImageValue(this)->fixedSize(renderer);
 #endif
     case LinearGradientClass:
         return static_cast<CSSLinearGradientValue*>(this)->fixedSize(renderer);
@@ -220,7 +220,7 @@ void CSSImageGeneratorValue::loadSubimages(CachedResourceLoader* cachedResourceL
         break;
 #if ENABLE(CSS_FILTERS)
     case FilterImageClass:
-        static_cast<CSSFilterImageValue*>(this)->loadSubimages(cachedResourceLoader);
+        toCSSFilterImageValue(this)->loadSubimages(cachedResourceLoader);
         break;
 #endif
     case LinearGradientClass:
index 6e69588..035ea55 100644 (file)
@@ -53,6 +53,8 @@ private:
     bool m_isImplicit;
 };
 
+CSS_VALUE_TYPE_CASTS(InitialValue)
+
 } // namespace WebCore
 
 #endif // CSSInitialValue_h
index 4df11f3..3aefdde 100644 (file)
@@ -422,7 +422,7 @@ void CSSValue::destroy()
         delete static_cast<CSSInheritedValue*>(this);
         return;
     case InitialClass:
-        delete static_cast<CSSInitialValue*>(this);
+        delete toCSSInitialValue(this);
         return;
     case PrimitiveClass:
         delete static_cast<CSSPrimitiveValue*>(this);
@@ -461,7 +461,7 @@ void CSSValue::destroy()
 #endif
 #if ENABLE(CSS_FILTERS)
     case FilterImageClass:
-        delete static_cast<CSSFilterImageValue*>(this);
+        delete toCSSFilterImageValue(this);
         return;
     case WebKitCSSFilterClass:
         delete toWebKitCSSFilterValue(this);
index bad3aab..6f95d81 100644 (file)
@@ -3125,7 +3125,7 @@ PassRefPtr<StyleImage> StyleResolver::generatedOrPendingFromValue(CSSPropertyID
 #if ENABLE(CSS_FILTERS)
     if (value->isFilterImageValue()) {
         // FilterImage needs to calculate FilterOperations.
-        static_cast<CSSFilterImageValue*>(value)->createFilterOperations(this);
+        toCSSFilterImageValue(value)->createFilterOperations(this);
     }
 #endif
     if (value->isPending()) {