<https://webkit.org/b/119996> Introduce toSVGAnimateElement(), and use it
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Aug 2013 08:32:44 +0000 (08:32 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Aug 2013 08:32:44 +0000 (08:32 +0000)
Reviewed by Andreas Kling.

As a step to clean-up static_cast<SVGXXX>, static_cast<SVGAnimateElement*> 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
Source/WebCore/svg/SVGAnimateElement.cpp
Source/WebCore/svg/SVGAnimateElement.h
Source/WebCore/svg/SVGAnimationElement.cpp

index 3ca455f..5141996 100644 (file)
@@ -1,3 +1,19 @@
+2013-08-19  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        <https://webkit.org/b/119996> Introduce toSVGAnimateElement(), and use it
+
+        Reviewed by Andreas Kling.
+
+        As a step to clean-up static_cast<SVGXXX>, static_cast<SVGAnimateElement*> 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  <akling@apple.com>
 
         <https://webkit.org/b/119997> Page::progress() should return a reference.
index 36bb723..dab7026 100644 (file)
@@ -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<SVGAnimateElement*>(resultElement);
+    SVGAnimateElement* resultAnimationElement = toSVGAnimateElement(resultElement);
     ASSERT(resultAnimationElement->m_animatedType);
     ASSERT(resultAnimationElement->m_animatedPropertyType == m_animatedPropertyType);
 
index d748fcc..5070d92 100644 (file)
@@ -27,6 +27,7 @@
 #include "SVGAnimatedType.h"
 #include "SVGAnimatedTypeAnimator.h"
 #include "SVGAnimationElement.h"
+#include "SVGNames.h"
 #include <wtf/OwnPtr.h>
 
 namespace WebCore {
@@ -75,6 +76,16 @@ private:
     OwnPtr<SVGAnimatedTypeAnimator> 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<SVGAnimateElement*>(element);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
index 993f950..f5de47a 100644 (file)
@@ -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<SVGAnimateElement*>(this);
-        AnimatedPropertyType attributeType = animateElement->determineAnimatedPropertyType(targetElement());
+        AnimatedPropertyType attributeType = toSVGAnimateElement(this)->determineAnimatedPropertyType(targetElement());
         // Fall back to discrete animations for Strings.
         if (attributeType == AnimatedBoolean
             || attributeType == AnimatedEnumeration