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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9608d966
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.
......@@ -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
......
......@@ -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:
......
......@@ -53,6 +53,8 @@ private:
bool m_isImplicit;
};
CSS_VALUE_TYPE_CASTS(InitialValue)
} // namespace WebCore
#endif // CSSInitialValue_h
......@@ -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);
......
......@@ -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()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment