From 3f81f15f5f5ff94d26482c11a922e775cb7cc81e Mon Sep 17 00:00:00 2001 From: "gyuyoung.kim@samsung.com" Date: Mon, 19 Aug 2013 08:32:44 +0000 Subject: [PATCH] Introduce toSVGAnimateElement(), and use it Reviewed by Andreas Kling. As a step to clean-up static_cast, static_cast also can be changed with toSVGAnimateElement(). * svg/SVGAnimateElement.cpp: (WebCore::SVGAnimateElement::calculateAnimatedValue): * svg/SVGAnimateElement.h: (WebCore::toSVGAnimateElement): * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154266 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 16 ++++++++++++++++ Source/WebCore/svg/SVGAnimateElement.cpp | 7 +------ Source/WebCore/svg/SVGAnimateElement.h | 11 +++++++++++ Source/WebCore/svg/SVGAnimationElement.cpp | 3 +-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 3ca455f..5141996 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2013-08-19 Gyuyoung Kim + + Introduce toSVGAnimateElement(), and use it + + Reviewed by Andreas Kling. + + As a step to clean-up static_cast, static_cast also can be changed + with toSVGAnimateElement(). + + * svg/SVGAnimateElement.cpp: + (WebCore::SVGAnimateElement::calculateAnimatedValue): + * svg/SVGAnimateElement.h: + (WebCore::toSVGAnimateElement): + * svg/SVGAnimationElement.cpp: + (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): + 2013-08-19 Andreas Kling Page::progress() should return a reference. diff --git a/Source/WebCore/svg/SVGAnimateElement.cpp b/Source/WebCore/svg/SVGAnimateElement.cpp index 36bb723..dab7026 100644 --- a/Source/WebCore/svg/SVGAnimateElement.cpp +++ b/Source/WebCore/svg/SVGAnimateElement.cpp @@ -111,12 +111,7 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat ASSERT(m_fromType->type() == m_animatedPropertyType); ASSERT(m_toType); - ASSERT(resultElement->hasTagName(SVGNames::animateTag) - || resultElement->hasTagName(SVGNames::animateColorTag) - || resultElement->hasTagName(SVGNames::animateTransformTag) - || resultElement->hasTagName(SVGNames::setTag)); - - SVGAnimateElement* resultAnimationElement = static_cast(resultElement); + SVGAnimateElement* resultAnimationElement = toSVGAnimateElement(resultElement); ASSERT(resultAnimationElement->m_animatedType); ASSERT(resultAnimationElement->m_animatedPropertyType == m_animatedPropertyType); diff --git a/Source/WebCore/svg/SVGAnimateElement.h b/Source/WebCore/svg/SVGAnimateElement.h index d748fcc..5070d92 100644 --- a/Source/WebCore/svg/SVGAnimateElement.h +++ b/Source/WebCore/svg/SVGAnimateElement.h @@ -27,6 +27,7 @@ #include "SVGAnimatedType.h" #include "SVGAnimatedTypeAnimator.h" #include "SVGAnimationElement.h" +#include "SVGNames.h" #include namespace WebCore { @@ -75,6 +76,16 @@ private: OwnPtr m_animator; }; +inline SVGAnimateElement* toSVGAnimateElement(Element* element) +{ + ASSERT_WITH_SECURITY_IMPLICATION(!element + || element->hasTagName(SVGNames::animateTag) + || element->hasTagName(SVGNames::animateColorTag) + || element->hasTagName(SVGNames::animateTransformTag) + || element->hasTagName(SVGNames::setTag)); + return static_cast(element); +} + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp index 993f950..f5de47a3 100644 --- a/Source/WebCore/svg/SVGAnimationElement.cpp +++ b/Source/WebCore/svg/SVGAnimationElement.cpp @@ -501,8 +501,7 @@ void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& CalcMode calcMode = this->calcMode(); if (hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::animateColorTag)) { - SVGAnimateElement* animateElement = static_cast(this); - AnimatedPropertyType attributeType = animateElement->determineAnimatedPropertyType(targetElement()); + AnimatedPropertyType attributeType = toSVGAnimateElement(this)->determineAnimatedPropertyType(targetElement()); // Fall back to discrete animations for Strings. if (attributeType == AnimatedBoolean || attributeType == AnimatedEnumeration -- 1.8.3.1