Share single calculateFromToValues/calculateFromByValues between all SVGAnimatedTypeA...
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Apr 2012 10:05:06 +0000 (10:05 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Apr 2012 10:05:06 +0000 (10:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84832

Reviewed by Antti Koivisto.

calculateFromAndToValues / calculateFromAndByValues don't need to be spread across all SVGAnimatedTypeAnimators.
Centralize these new implementations in SVGAnimatedTypeAnimator.h. Refactored addAnimatedTypes() from constructFromAndByValues.

calculateFromAndToValues:
    from = constructFromString(fromString)
    to = constructFromString(toString)

calculateFromAndByValues:
    from = constructFromString(fromString)
    to = constructFromString(byString)
    addAnimatedTypes(from, to)

Doesn't affect any tests, just refactors code.

* svg/SVGAnimateElement.cpp:
(WebCore::SVGAnimateElement::calculateFromAndToValues):
(WebCore::SVGAnimateElement::calculateFromAndByValues):
* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
* svg/SVGAnimatedAngle.h:
(SVGAnimatedAngleAnimator):
* svg/SVGAnimatedBoolean.cpp:
(WebCore::SVGAnimatedBooleanAnimator::addAnimatedTypes):
* svg/SVGAnimatedBoolean.h:
(SVGAnimatedBooleanAnimator):
* svg/SVGAnimatedColor.cpp:
(WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
* svg/SVGAnimatedColor.h:
(SVGAnimatedColorAnimator):
* svg/SVGAnimatedEnumeration.cpp:
(WebCore::SVGAnimatedEnumerationAnimator::addAnimatedTypes):
* svg/SVGAnimatedEnumeration.h:
(SVGAnimatedEnumerationAnimator):
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
* svg/SVGAnimatedInteger.h:
(SVGAnimatedIntegerAnimator):
* svg/SVGAnimatedIntegerOptionalInteger.cpp:
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
* svg/SVGAnimatedIntegerOptionalInteger.h:
(SVGAnimatedIntegerOptionalIntegerAnimator):
* svg/SVGAnimatedLength.cpp:
(WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
* svg/SVGAnimatedLength.h:
(SVGAnimatedLengthAnimator):
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
* svg/SVGAnimatedLengthList.h:
(SVGAnimatedLengthListAnimator):
* svg/SVGAnimatedNumber.cpp:
(WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
* svg/SVGAnimatedNumber.h:
(SVGAnimatedNumberAnimator):
* svg/SVGAnimatedNumberList.cpp:
(WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
* svg/SVGAnimatedNumberList.h:
(SVGAnimatedNumberListAnimator):
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
* svg/SVGAnimatedNumberOptionalNumber.h:
(SVGAnimatedNumberOptionalNumberAnimator):
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::constructFromString):
(WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
* svg/SVGAnimatedPath.h:
(SVGAnimatedPathAnimator):
* svg/SVGAnimatedPointList.cpp:
(WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
* svg/SVGAnimatedPointList.h:
(SVGAnimatedPointListAnimator):
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::addAnimatedTypes):
* svg/SVGAnimatedPreserveAspectRatio.h:
(SVGAnimatedPreserveAspectRatioAnimator):
* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
* svg/SVGAnimatedRect.h:
(SVGAnimatedRectAnimator):
* svg/SVGAnimatedString.cpp:
(WebCore::SVGAnimatedStringAnimator::addAnimatedTypes):
* svg/SVGAnimatedString.h:
(SVGAnimatedStringAnimator):
* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator):
(WebCore::SVGAnimatedTransformListAnimator::constructFromString):
(WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
(WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
* svg/SVGAnimatedTransformList.h:
(SVGAnimatedTransformListAnimator):
* svg/SVGAnimatedTypeAnimator.h:
(SVGAnimatedTypeAnimator):
(WebCore::SVGAnimatedTypeAnimator::calculateFromAndToValues):
(WebCore::SVGAnimatedTypeAnimator::calculateFromAndByValues):
(WebCore::SVGAnimatedTypeAnimator::setContextElement):

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

37 files changed:
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGAnimateElement.cpp
Source/WebCore/svg/SVGAnimatedAngle.cpp
Source/WebCore/svg/SVGAnimatedAngle.h
Source/WebCore/svg/SVGAnimatedBoolean.cpp
Source/WebCore/svg/SVGAnimatedBoolean.h
Source/WebCore/svg/SVGAnimatedColor.cpp
Source/WebCore/svg/SVGAnimatedColor.h
Source/WebCore/svg/SVGAnimatedEnumeration.cpp
Source/WebCore/svg/SVGAnimatedEnumeration.h
Source/WebCore/svg/SVGAnimatedInteger.cpp
Source/WebCore/svg/SVGAnimatedInteger.h
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h
Source/WebCore/svg/SVGAnimatedLength.cpp
Source/WebCore/svg/SVGAnimatedLength.h
Source/WebCore/svg/SVGAnimatedLengthList.cpp
Source/WebCore/svg/SVGAnimatedLengthList.h
Source/WebCore/svg/SVGAnimatedNumber.cpp
Source/WebCore/svg/SVGAnimatedNumber.h
Source/WebCore/svg/SVGAnimatedNumberList.cpp
Source/WebCore/svg/SVGAnimatedNumberList.h
Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp
Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.h
Source/WebCore/svg/SVGAnimatedPath.cpp
Source/WebCore/svg/SVGAnimatedPath.h
Source/WebCore/svg/SVGAnimatedPointList.cpp
Source/WebCore/svg/SVGAnimatedPointList.h
Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp
Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h
Source/WebCore/svg/SVGAnimatedRect.cpp
Source/WebCore/svg/SVGAnimatedRect.h
Source/WebCore/svg/SVGAnimatedString.cpp
Source/WebCore/svg/SVGAnimatedString.h
Source/WebCore/svg/SVGAnimatedTransformList.cpp
Source/WebCore/svg/SVGAnimatedTransformList.h
Source/WebCore/svg/SVGAnimatedTypeAnimator.h

index d1e2af2..4dbb5ea 100644 (file)
@@ -1,3 +1,105 @@
+2012-04-25  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Share single calculateFromToValues/calculateFromByValues between all SVGAnimatedTypeAnimators
+        https://bugs.webkit.org/show_bug.cgi?id=84832
+
+        Reviewed by Antti Koivisto.
+
+        calculateFromAndToValues / calculateFromAndByValues don't need to be spread across all SVGAnimatedTypeAnimators.
+        Centralize these new implementations in SVGAnimatedTypeAnimator.h. Refactored addAnimatedTypes() from constructFromAndByValues.
+
+        calculateFromAndToValues:
+            from = constructFromString(fromString)
+            to = constructFromString(toString)
+        
+        calculateFromAndByValues:
+            from = constructFromString(fromString)
+            to = constructFromString(byString)
+            addAnimatedTypes(from, to)
+
+        Doesn't affect any tests, just refactors code.
+
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::SVGAnimateElement::calculateFromAndToValues):
+        (WebCore::SVGAnimateElement::calculateFromAndByValues):
+        * svg/SVGAnimatedAngle.cpp:
+        (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedAngle.h:
+        (SVGAnimatedAngleAnimator):
+        * svg/SVGAnimatedBoolean.cpp:
+        (WebCore::SVGAnimatedBooleanAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedBoolean.h:
+        (SVGAnimatedBooleanAnimator):
+        * svg/SVGAnimatedColor.cpp:
+        (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedColor.h:
+        (SVGAnimatedColorAnimator):
+        * svg/SVGAnimatedEnumeration.cpp:
+        (WebCore::SVGAnimatedEnumerationAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedEnumeration.h:
+        (SVGAnimatedEnumerationAnimator):
+        * svg/SVGAnimatedInteger.cpp:
+        (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedInteger.h:
+        (SVGAnimatedIntegerAnimator):
+        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedIntegerOptionalInteger.h:
+        (SVGAnimatedIntegerOptionalIntegerAnimator):
+        * svg/SVGAnimatedLength.cpp:
+        (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedLength.h:
+        (SVGAnimatedLengthAnimator):
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedLengthList.h:
+        (SVGAnimatedLengthListAnimator):
+        * svg/SVGAnimatedNumber.cpp:
+        (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedNumber.h:
+        (SVGAnimatedNumberAnimator):
+        * svg/SVGAnimatedNumberList.cpp:
+        (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedNumberList.h:
+        (SVGAnimatedNumberListAnimator):
+        * svg/SVGAnimatedNumberOptionalNumber.cpp:
+        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedNumberOptionalNumber.h:
+        (SVGAnimatedNumberOptionalNumberAnimator):
+        * svg/SVGAnimatedPath.cpp:
+        (WebCore::SVGAnimatedPathAnimator::constructFromString):
+        (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedPath.h:
+        (SVGAnimatedPathAnimator):
+        * svg/SVGAnimatedPointList.cpp:
+        (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedPointList.h:
+        (SVGAnimatedPointListAnimator):
+        * svg/SVGAnimatedPreserveAspectRatio.cpp:
+        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedPreserveAspectRatio.h:
+        (SVGAnimatedPreserveAspectRatioAnimator):
+        * svg/SVGAnimatedRect.cpp:
+        (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedRect.h:
+        (SVGAnimatedRectAnimator):
+        * svg/SVGAnimatedString.cpp:
+        (WebCore::SVGAnimatedStringAnimator::addAnimatedTypes):
+        * svg/SVGAnimatedString.h:
+        (SVGAnimatedStringAnimator):
+        * svg/SVGAnimatedTransformList.cpp:
+        (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator):
+        (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
+        (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
+        (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
+        * svg/SVGAnimatedTransformList.h:
+        (SVGAnimatedTransformListAnimator):
+        * svg/SVGAnimatedTypeAnimator.h:
+        (SVGAnimatedTypeAnimator):
+        (WebCore::SVGAnimatedTypeAnimator::calculateFromAndToValues):
+        (WebCore::SVGAnimatedTypeAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedTypeAnimator::setContextElement):
+
 2012-04-25  Andreas Kling  <kling@webkit.org>
 
         Shrink RenderText by 8 bytes on 64-bit.
index 247c616..d85b40f 100644 (file)
@@ -209,6 +209,7 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
     if (!targetElement)
         return false;
 
+    determinePropertyValueTypes(fromString, toString); 
     ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString);
     ASSERT(m_animatedPropertyType == m_animator->type());
     return true;
@@ -222,6 +223,7 @@ bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const
 
     ASSERT(!hasTagName(SVGNames::setTag));
 
+    determinePropertyValueTypes(fromString, byString); 
     ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString);
     ASSERT(m_animatedPropertyType == m_animator->type());
     return true;
index 0f27ce8..f848124 100644 (file)
@@ -79,26 +79,10 @@ void SVGAnimatedAngleAnimator::animValDidChange(const Vector<SVGAnimatedProperty
     animValDidChangeForTypes<SVGAnimatedAngle, SVGAnimatedEnumeration>(properties);
 }
 
-void SVGAnimatedAngleAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedAngleAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedAngleAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedAngle);
+    ASSERT(from->type() == to->type());
 
     pair<SVGAngle, unsigned>& fromAngleAndEnumeration = from->angleAndEnumeration();
     pair<SVGAngle, unsigned>& toAngleAndEnumeration = to->angleAndEnumeration();
index 270c5e4..74685aa 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 168e4b0..5139ace 100644 (file)
@@ -64,23 +64,10 @@ void SVGAnimatedBooleanAnimator::animValDidChange(const Vector<SVGAnimatedProper
     animValDidChangeForType<SVGAnimatedBoolean>(properties);
 }
 
-void SVGAnimatedBooleanAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedBooleanAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedBooleanAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    // Not specified what to do on 'by'-animations with boolean. Fallback to 'to'-animation right now. 
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT_UNUSED(from, from->type() == AnimatedBoolean);
+    ASSERT_UNUSED(to, from->type() == to->type());
 }
 
 void SVGAnimatedBooleanAnimator::calculateAnimatedValue(float percentage, unsigned,
index ab2c1e4..f7b7a18 100644 (file)
@@ -49,8 +49,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 774264d..3ccc27a 100644 (file)
@@ -40,27 +40,12 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const
     return animtedType.release();
 }
 
-void SVGAnimatedColorAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedColorAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedColor);
+    ASSERT(from->type() == to->type());
 
+    // FIXME: We clamp too early.
     to->color() = ColorDistance::addColorsAndClamp(from->color(), to->color());
 }
 
index 9ef637e..7c02f30 100644 (file)
@@ -39,8 +39,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&) { }
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&) { }
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index d78755b..16d9a28 100644 (file)
@@ -140,23 +140,10 @@ void SVGAnimatedEnumerationAnimator::animValDidChange(const Vector<SVGAnimatedPr
     animValDidChangeForType<SVGAnimatedEnumeration>(properties);
 }
 
-void SVGAnimatedEnumerationAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedEnumerationAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedEnumerationAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    // Not specified what to do on 'by'-animations with enums. Fallback to 'to'-animation right now. 
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT_UNUSED(from, from->type() == AnimatedEnumeration);
+    ASSERT_UNUSED(to, from->type() == to->type());
 }
 
 void SVGAnimatedEnumerationAnimator::calculateAnimatedValue(float percentage, unsigned,
index 79f0402..aa77ed6 100644 (file)
@@ -48,8 +48,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 191bc73..1e156a5 100644 (file)
@@ -65,27 +65,11 @@ void SVGAnimatedIntegerAnimator::animValDidChange(const Vector<SVGAnimatedProper
     animValDidChangeForType<SVGAnimatedInteger>(properties);
 }
 
-void SVGAnimatedIntegerAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedIntegerAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
+    ASSERT(from->type() == AnimatedInteger);
+    ASSERT(from->type() == to->type());
 
-void SVGAnimatedIntegerAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
-    
     to->integer() += from->integer();
 }
 
index 95cceb9..68ad988 100644 (file)
@@ -42,7 +42,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute
 class SVGAnimationElement;
 
 class SVGAnimatedIntegerAnimator : public SVGAnimatedTypeAnimator {
-    
 public:
     SVGAnimatedIntegerAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedIntegerAnimator() { }
@@ -56,8 +55,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 0d375a5..070548a 100644 (file)
@@ -74,30 +74,14 @@ void SVGAnimatedIntegerOptionalIntegerAnimator::animValDidChange(const Vector<SV
     animValDidChangeForTypes<SVGAnimatedInteger, SVGAnimatedInteger>(properties);
 }
 
-void SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedIntegerOptionalInteger);
+    ASSERT(from->type() == to->type());
 
     pair<int, int>& fromNumberPair = from->integerOptionalInteger();
     pair<int, int>& toNumberPair = to->integerOptionalInteger();
-    
+
     toNumberPair.first += fromNumberPair.first;
     toNumberPair.second += fromNumberPair.second;
 }
index 544565d..dca5f1d 100644 (file)
@@ -39,8 +39,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 79ac410..7a97f4e 100644 (file)
@@ -72,30 +72,15 @@ void SVGAnimatedLengthAnimator::animValDidChange(const Vector<SVGAnimatedPropert
     animValDidChangeForType<SVGAnimatedLength>(properties);
 }
 
-void SVGAnimatedLengthAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedLengthAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
+    ASSERT(from->type() == AnimatedLength);
+    ASSERT(from->type() == to->type());
 
-void SVGAnimatedLengthAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
-    
     SVGLengthContext lengthContext(m_contextElement);
     SVGLength& fromLength = from->length();
     SVGLength& toLength = to->length();
+
     ExceptionCode ec = 0;
     toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext, ec);
     ASSERT(!ec);
index 2c136c6..82a80d0 100644 (file)
@@ -39,7 +39,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedLength, OwnerType, DOMAttribute, DOMAttribute.l
 class SVGAnimationElement;
 
 class SVGAnimatedLengthAnimator : public SVGAnimatedTypeAnimator {
-
 public:
     SVGAnimatedLengthAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedLengthAnimator() { }
@@ -51,8 +50,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index e9cae4b..3f87a95 100644 (file)
@@ -65,27 +65,11 @@ void SVGAnimatedLengthListAnimator::animValDidChange(const Vector<SVGAnimatedPro
     animValDidChangeForType<SVGAnimatedLengthList>(properties);
 }
 
-void SVGAnimatedLengthListAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedLengthListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
+    ASSERT(from->type() == AnimatedLengthList);
+    ASSERT(from->type() == to->type());
 
-void SVGAnimatedLengthListAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
-    
     SVGLengthList& fromLengthList = from->lengthList();
     SVGLengthList& toLengthList = to->lengthList();
     unsigned itemsCount = fromLengthList.size();
index 6683a29..812f1ff 100644 (file)
@@ -39,7 +39,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedLengthList, OwnerType, DOMAttribute, DOMAttribu
 class SVGAnimationElement;
 
 class SVGAnimatedLengthListAnimator : public SVGAnimatedTypeAnimator {
-    
 public:
     SVGAnimatedLengthListAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedLengthListAnimator() { }
@@ -51,8 +50,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 5daad6f..01bb2b7 100644 (file)
@@ -68,26 +68,10 @@ void SVGAnimatedNumberAnimator::animValDidChange(const Vector<SVGAnimatedPropert
     animValDidChangeForType<SVGAnimatedNumber>(properties);
 }
 
-void SVGAnimatedNumberAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedNumberAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedNumberAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedNumber);
+    ASSERT(from->type() == to->type());
 
     to->number() += from->number();
 }
index 8ae9b8f..cfab58c 100644 (file)
@@ -42,7 +42,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute,
 class SVGAnimationElement;
 
 class SVGAnimatedNumberAnimator : public SVGAnimatedTypeAnimator {
-
 public:
     SVGAnimatedNumberAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedNumberAnimator() { }
@@ -56,8 +55,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 257a09f..8ab3cb7 100644 (file)
@@ -64,23 +64,11 @@ void SVGAnimatedNumberListAnimator::animValDidChange(const Vector<SVGAnimatedPro
     animValDidChangeForType<SVGAnimatedNumberList>(properties);
 }
 
-void SVGAnimatedNumberListAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedNumberListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
+    ASSERT(from->type() == AnimatedNumberList);
+    ASSERT(from->type() == to->type());
 
-void SVGAnimatedNumberListAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
-    
     SVGNumberList& fromNumberList = from->numberList();
     SVGNumberList& toNumberList = to->numberList();
     
index 35d91ec..668d38f 100644 (file)
@@ -39,7 +39,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedNumberList, OwnerType, DOMAttribute, DOMAttribu
 class SVGAnimationElement;
 
 class SVGAnimatedNumberListAnimator : public SVGAnimatedTypeAnimator {
-    
 public:
     SVGAnimatedNumberListAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedNumberListAnimator() { }
@@ -51,8 +50,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index c46c791..46975b1 100644 (file)
@@ -71,26 +71,10 @@ void SVGAnimatedNumberOptionalNumberAnimator::animValDidChange(const Vector<SVGA
     animValDidChangeForTypes<SVGAnimatedNumber, SVGAnimatedNumber>(properties);
 }
 
-void SVGAnimatedNumberOptionalNumberAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, toString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedNumberOptionalNumberAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    animationElement->determinePropertyValueTypes(fromString, byString);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedNumberOptionalNumber);
+    ASSERT(from->type() == to->type());
 
     pair<float, float>& fromNumberPair = from->numberOptionalNumber();
     pair<float, float>& toNumberPair = to->numberOptionalNumber();
index fa25819..f02453d 100644 (file)
@@ -28,7 +28,6 @@ namespace WebCore {
 class SVGAnimationElement;
 
 class SVGAnimatedNumberOptionalNumberAnimator : public SVGAnimatedTypeAnimator {
-    
 public:
     SVGAnimatedNumberOptionalNumberAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedNumberOptionalNumberAnimator() { }
@@ -42,12 +41,12 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
index f1b7f9f..de9dbc8 100644 (file)
@@ -35,14 +35,8 @@ SVGAnimatedPathAnimator::SVGAnimatedPathAnimator(SVGAnimationElement* animationE
 
 PassOwnPtr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string)
 {
-    bool result = false;
-    return constructFromString(string, result);
-}
-
-PassOwnPtr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string, bool& result)
-{
     OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create();
-    result = SVGPathParserFactory::self()->buildSVGPathByteStreamFromString(string, byteStream.get(), UnalteredParsing);
+    SVGPathParserFactory::self()->buildSVGPathByteStreamFromString(string, byteStream.get(), UnalteredParsing);
     return SVGAnimatedType::createPath(byteStream.release());
 }
 
@@ -93,34 +87,12 @@ void SVGAnimatedPathAnimator::animValDidChange(const Vector<SVGAnimatedProperty*
     animValDidChangeForType<SVGAnimatedPathSegListPropertyTearOff>(properties);
 }
 
-void SVGAnimatedPathAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedPathAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-
-    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
-    AnimationMode animationMode = animationElement->animationMode();
-
-    bool success = false;
-    to = constructFromString(toString, success);
+    ASSERT_UNUSED(from, from->type() == AnimatedPath);
+    ASSERT_UNUSED(to, from->type() == to->type());
 
-    // For to-animations the from number is calculated later.
-    if (!success || animationMode == ToAnimation) {
-        from = SVGAnimatedType::createPath(SVGPathByteStream::create());
-        return;
-    }
-
-    from = constructFromString(fromString, success);
-    if (success)
-        return;
-
-    from = SVGAnimatedType::createPath(SVGPathByteStream::create());
-}
-
-void SVGAnimatedPathAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& by, const String& fromString, const String& byString)
-{
-    // Fallback to from-to animation, since from-by animation does not make sense.
-    calculateFromAndToValues(from, by, fromString, byString);
+    // FIXME: Add additive support.
 }
 
 void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
index 7e51acb..0aaca76 100644 (file)
@@ -39,14 +39,10 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
-
-private:
-    PassOwnPtr<SVGAnimatedType> constructFromString(const String&, bool &success);
 };
 
 } // namespace WebCore
index 8acabc4..0b2d332 100644 (file)
@@ -65,17 +65,11 @@ void SVGAnimatedPointListAnimator::animValDidChange(const Vector<SVGAnimatedProp
     animValDidChangeForType<SVGAnimatedPointList>(properties);
 }
 
-void SVGAnimatedPointListAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedPointListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
+    ASSERT(from->type() == AnimatedPoints);
+    ASSERT(from->type() == to->type());
 
-void SVGAnimatedPointListAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
-    
     SVGPointList& fromPointList = from->pointList();
     SVGPointList& toPointList = to->pointList();
     unsigned itemCount = fromPointList.size();
index a951df5..78a794b 100644 (file)
@@ -43,12 +43,12 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
index 9077c79..4dcf18d 100644 (file)
@@ -63,23 +63,10 @@ void SVGAnimatedPreserveAspectRatioAnimator::animValDidChange(const Vector<SVGAn
     animValDidChangeForType<SVGAnimatedPreserveAspectRatio>(properties);
 }
 
-void SVGAnimatedPreserveAspectRatioAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedPreserveAspectRatioAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedPreserveAspectRatioAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    // Not specified what to do on 'by'-animations with SVGPreserveAspectRatio. Fallback to 'to'-animation right now. 
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT_UNUSED(from, from->type() == AnimatedPreserveAspectRatio);
+    ASSERT_UNUSED(to, from->type() == to->type());
 }
 
 void SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue(float percentage, unsigned,
index f5a752b..de711e5 100644 (file)
@@ -39,7 +39,6 @@ DEFINE_ANIMATED_PROPERTY(AnimatedPreserveAspectRatio, OwnerType, DOMAttribute, D
 class SVGAnimationElement;
 
 class SVGAnimatedPreserveAspectRatioAnimator : public SVGAnimatedTypeAnimator {
-    
 public:
     SVGAnimatedPreserveAspectRatioAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedPreserveAspectRatioAnimator() { }
@@ -51,8 +50,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index 20a596c..f9baeb5 100644 (file)
@@ -64,18 +64,10 @@ void SVGAnimatedRectAnimator::animValDidChange(const Vector<SVGAnimatedProperty*
     animValDidChangeForType<SVGAnimatedRect>(properties);
 }
 
-void SVGAnimatedRectAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedRectAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedRectAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT(from->type() == AnimatedRect);
+    ASSERT(from->type() == to->type());
 
     to->rect() += from->rect();
 }
index b9b7340..fc07773 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index f913771..1be6d11 100644 (file)
@@ -63,23 +63,10 @@ void SVGAnimatedStringAnimator::animValDidChange(const Vector<SVGAnimatedPropert
     animValDidChangeForType<SVGAnimatedString>(properties);
 }
 
-void SVGAnimatedStringAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+void SVGAnimatedStringAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-
-    from = constructFromString(fromString);
-    to = constructFromString(toString);
-}
-
-void SVGAnimatedStringAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-{
-    ASSERT(m_contextElement);
-    ASSERT(m_animationElement);
-    
-    // Not specified what to do on 'by'-animations with string. Fallback to 'to'-animation right now. 
-    from = constructFromString(fromString);
-    to = constructFromString(byString);
+    ASSERT_UNUSED(from, from->type() == AnimatedString);
+    ASSERT_UNUSED(to, from->type() == to->type());
 }
 
 void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned,
index b07d4be..42ecf94 100644 (file)
@@ -50,8 +50,7 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
index a8abde7..e97b716 100644 (file)
@@ -35,6 +35,7 @@ namespace WebCore {
 
 SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
     : SVGAnimatedTypeAnimator(AnimatedTransformList, animationElement, contextElement)
+    , m_transformTypeString(SVGTransform::transformTypePrefixForParsing(static_cast<SVGAnimateTransformElement*>(animationElement)->transformType()))
 {
     // Only <animateTransform> uses this animator, as <animate> doesn't allow to animate transform lists directly.
     ASSERT(animationElement->hasTagName(SVGNames::animateTransformTag));
@@ -43,7 +44,7 @@ SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator(SVGAnimationE
 PassOwnPtr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
 {
     OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createTransformList(new SVGTransformList);
-    animatedType->transformList().parse(string);
+    animatedType->transformList().parse(m_transformTypeString + string + ')');
     ASSERT(animatedType->transformList().size() <= 1);
     return animatedType.release();
 }
@@ -58,12 +59,6 @@ void SVGAnimatedTransformListAnimator::stopAnimValAnimation(const Vector<SVGAnim
     stopAnimValAnimationForType<SVGAnimatedTransformList>(properties);
 }
 
-inline PassOwnPtr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(SVGAnimateTransformElement* animateTransformElement, const String& string)
-{
-    ASSERT(animateTransformElement);
-    return SVGAnimatedTransformListAnimator::constructFromString(SVGTransform::transformTypePrefixForParsing(animateTransformElement->transformType()) + string + ')');
-}
-
 void SVGAnimatedTransformListAnimator::resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>& properties, SVGAnimatedType* type)
 {
     resetFromBaseValue<SVGAnimatedTransformList>(properties, type, &SVGAnimatedType::transformList);
@@ -79,22 +74,10 @@ void SVGAnimatedTransformListAnimator::animValDidChange(const Vector<SVGAnimated
     animValDidChangeForType<SVGAnimatedTransformList>(properties);
 }
 
-void SVGAnimatedTransformListAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
-{
-    ASSERT(m_animationElement);
-    SVGAnimateTransformElement* animateTransformElement = static_cast<SVGAnimateTransformElement*>(m_animationElement);
-
-    from = constructFromString(animateTransformElement, fromString);
-    to = constructFromString(animateTransformElement, toString);
-}
-
-void SVGAnimatedTransformListAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
+void SVGAnimatedTransformListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
 {
-    ASSERT(m_animationElement);
-    SVGAnimateTransformElement* animateTransformElement = static_cast<SVGAnimateTransformElement*>(m_animationElement);
-
-    from = constructFromString(animateTransformElement, fromString);
-    to = constructFromString(animateTransformElement, byString);
+    ASSERT(from->type() == AnimatedTransformList);
+    ASSERT(from->type() == to->type());
 
     SVGTransformList& fromTransformList = from->transformList();
     SVGTransformList& toTransformList = to->transformList();
@@ -145,12 +128,11 @@ void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage,
 float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromString, const String& toString)
 {
     ASSERT(m_animationElement);
-    SVGAnimateTransformElement* animateTransformElement = static_cast<SVGAnimateTransformElement*>(m_animationElement);
 
     // FIXME: This is not correct in all cases. The spec demands that each component (translate x and y for example)
     // is paced separately. To implement this we need to treat each component as individual animation everywhere.
-    OwnPtr<SVGAnimatedType> from = constructFromString(animateTransformElement, fromString);
-    OwnPtr<SVGAnimatedType> to = constructFromString(animateTransformElement, toString);
+    OwnPtr<SVGAnimatedType> from = constructFromString(fromString);
+    OwnPtr<SVGAnimatedType> to = constructFromString(toString);
 
     SVGTransformList& fromTransformList = from->transformList();
     SVGTransformList& toTransformList = to->transformList();
index 3079a97..a8a4f80 100644 (file)
@@ -36,7 +36,6 @@ DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedTransformList, SVGTransformList, Upper
 DEFINE_ANIMATED_PROPERTY(AnimatedTransformList, OwnerType, DOMAttribute, DOMAttribute.localName(), UpperProperty, LowerProperty)
 
 class SVGAnimationElement;
-class SVGAnimateTransformElement;
 
 class SVGAnimatedTransformListAnimator : public SVGAnimatedTypeAnimator {
 public:
@@ -50,14 +49,13 @@ public:
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
     virtual float calculateDistance(const String& fromString, const String& toString);
 
 private:
-    PassOwnPtr<SVGAnimatedType> constructFromString(SVGAnimateTransformElement*, const String&);
+    const String& m_transformTypeString;
 };
 
 } // namespace WebCore
index 873baf4..14198fc 100644 (file)
@@ -41,14 +41,25 @@ public:
     virtual void resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>&, SVGAnimatedType*) = 0;
     virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&) = 0;
     virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&) = 0;
-    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString) = 0;
-    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString) = 0;
+    virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) = 0;
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
                                         OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue) = 0;
     virtual float calculateDistance(const String& fromString, const String& toString) = 0;
 
-    void setContextElement(SVGElement* contextElement) { m_contextElement = contextElement; }
+    void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+    {
+        from = constructFromString(fromString);
+        to = constructFromString(toString);
+    }
 
+    void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
+    {
+        from = constructFromString(fromString);
+        to = constructFromString(byString);
+        addAnimatedTypes(from.get(), to.get());
+    }
+
+    void setContextElement(SVGElement* contextElement) { m_contextElement = contextElement; }
     AnimatedPropertyType type() const { return m_type; }
 
     Vector<SVGAnimatedProperty*> findAnimatedPropertiesForAttributeName(SVGElement* targetElement, const QualifiedName& attributeName)