Title: [89661] trunk/Source/WebCore
Revision
89661
Author
[email protected]
Date
2011-06-24 03:21:27 -0700 (Fri, 24 Jun 2011)

Log Message

2011-06-24  Dirk Schulze  <[email protected]>

        Reviewed by Nikolas Zimmermann.

        Convert AnimatedString to SVGAnimatorFactory concept
        https://bugs.webkit.org/show_bug.cgi?id=63296

        Follow up of "SVGAnimation should use direct unit animation for SVGLength": https://bugs.webkit.org/show_bug.cgi?id=61368
        This patch continues the conversion to the new concept of SVGAnimatorFactory with SVGString.

        No new tests added. No change of functionality.

        * CMakeLists.txt: Added new file to build system.
        * GNUmakefile.list.am: Ditto.
        * WebCore.gypi: Ditto.
        * WebCore.pro: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * svg/SVGAllInOne.cpp: Ditto.
        * svg/SVGAnimateElement.cpp:
        (WebCore::SVGAnimateElement::calculateAnimatedValue):
        (WebCore::SVGAnimateElement::calculateFromAndToValues):
        (WebCore::SVGAnimateElement::calculateFromAndByValues):
        (WebCore::SVGAnimateElement::resetToBaseValue):
        (WebCore::SVGAnimateElement::applyResultsToTarget):
        (WebCore::SVGAnimateElement::calculateDistance):
        * svg/SVGAnimateElement.h:
        * svg/SVGAnimatedString.cpp: Added. Animator for SVGString.
        (WebCore::SVGAnimatedStringAnimator::SVGAnimatedStringAnimator):
        (WebCore::SVGAnimatedStringAnimator::constructFromString):
        (WebCore::SVGAnimatedStringAnimator::calculateFromAndToValues):
        (WebCore::SVGAnimatedStringAnimator::calculateFromAndByValues):
        (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
        (WebCore::SVGAnimatedStringAnimator::calculateDistance):
        * svg/SVGAnimatedString.h:
        (WebCore::SVGAnimatedStringAnimator::~SVGAnimatedStringAnimator):
        * svg/SVGAnimatedType.cpp:
        (WebCore::SVGAnimatedType::~SVGAnimatedType):
        (WebCore::SVGAnimatedType::createString):
        (WebCore::SVGAnimatedType::string):
        (WebCore::SVGAnimatedType::valueAsString):
        (WebCore::SVGAnimatedType::setValueAsString):
        * svg/SVGAnimatedType.h:
        * svg/SVGAnimatorFactory.h:
        (WebCore::SVGAnimatorFactory::create):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (89660 => 89661)


--- trunk/Source/WebCore/CMakeLists.txt	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-06-24 10:21:27 UTC (rev 89661)
@@ -1660,6 +1660,7 @@
         svg/SVGAnimatedNumber.cpp
         svg/SVGAnimatedPointList.cpp
         svg/SVGAnimatedRect.cpp
+        svg/SVGAnimatedString.cpp
         svg/SVGAnimatedType.cpp
         svg/SVGAnimateElement.cpp
         svg/SVGAnimateMotionElement.cpp

Modified: trunk/Source/WebCore/ChangeLog (89660 => 89661)


--- trunk/Source/WebCore/ChangeLog	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/ChangeLog	2011-06-24 10:21:27 UTC (rev 89661)
@@ -1,3 +1,48 @@
+2011-06-24  Dirk Schulze  <[email protected]>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Convert AnimatedString to SVGAnimatorFactory concept
+        https://bugs.webkit.org/show_bug.cgi?id=63296
+
+        Follow up of "SVGAnimation should use direct unit animation for SVGLength": https://bugs.webkit.org/show_bug.cgi?id=61368
+        This patch continues the conversion to the new concept of SVGAnimatorFactory with SVGString.
+
+        No new tests added. No change of functionality.
+
+        * CMakeLists.txt: Added new file to build system.
+        * GNUmakefile.list.am: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * svg/SVGAllInOne.cpp: Ditto.
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::SVGAnimateElement::calculateAnimatedValue):
+        (WebCore::SVGAnimateElement::calculateFromAndToValues):
+        (WebCore::SVGAnimateElement::calculateFromAndByValues):
+        (WebCore::SVGAnimateElement::resetToBaseValue):
+        (WebCore::SVGAnimateElement::applyResultsToTarget):
+        (WebCore::SVGAnimateElement::calculateDistance):
+        * svg/SVGAnimateElement.h:
+        * svg/SVGAnimatedString.cpp: Added. Animator for SVGString.
+        (WebCore::SVGAnimatedStringAnimator::SVGAnimatedStringAnimator):
+        (WebCore::SVGAnimatedStringAnimator::constructFromString):
+        (WebCore::SVGAnimatedStringAnimator::calculateFromAndToValues):
+        (WebCore::SVGAnimatedStringAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedStringAnimator::calculateDistance):
+        * svg/SVGAnimatedString.h:
+        (WebCore::SVGAnimatedStringAnimator::~SVGAnimatedStringAnimator):
+        * svg/SVGAnimatedType.cpp:
+        (WebCore::SVGAnimatedType::~SVGAnimatedType):
+        (WebCore::SVGAnimatedType::createString):
+        (WebCore::SVGAnimatedType::string):
+        (WebCore::SVGAnimatedType::valueAsString):
+        (WebCore::SVGAnimatedType::setValueAsString):
+        * svg/SVGAnimatedType.h:
+        * svg/SVGAnimatorFactory.h:
+        (WebCore::SVGAnimatorFactory::create):
+
 2011-06-24  Mario Sanchez Prada  <[email protected]>
 
         Reviewed by Chris Fleizach.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (89660 => 89661)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-06-24 10:21:27 UTC (rev 89661)
@@ -3419,6 +3419,7 @@
 	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.h \
 	Source/WebCore/svg/SVGAnimatedType.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (89660 => 89661)


--- trunk/Source/WebCore/WebCore.gypi	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/WebCore.gypi	2011-06-24 10:21:27 UTC (rev 89661)
@@ -5715,6 +5715,7 @@
             'svg/SVGAnimatedNumber.cpp',
             'svg/SVGAnimatedPointList.cpp',
             'svg/SVGAnimatedRect.cpp',
+            'svg/SVGAnimatedString.cpp',
             'svg/SVGAnimatedType.cpp',
             'svg/SVGAnimateElement.cpp',
             'svg/SVGAnimateElement.h',

Modified: trunk/Source/WebCore/WebCore.pro (89660 => 89661)


--- trunk/Source/WebCore/WebCore.pro	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/WebCore.pro	2011-06-24 10:21:27 UTC (rev 89661)
@@ -3340,6 +3340,7 @@
               svg/SVGAnimatedNumber.cpp \
               svg/SVGAnimatedPointList.cpp \
               svg/SVGAnimatedRect.cpp \
+              svg/SVGAnimatedString.cpp \
               svg/SVGAnimatedType.cpp \
               svg/SVGAnimateElement.cpp \
               svg/SVGAnimateMotionElement.cpp \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (89660 => 89661)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-24 10:21:27 UTC (rev 89661)
@@ -997,6 +997,7 @@
 		43A0F0B613ACCCFF00A5F0A7 /* SVGAnimatedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */; };
 		43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */; };
 		43A625F913B3304000AC94B8 /* SVGAnimatedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */; };
+		43A6266713B3D11000AC94B8 /* SVGAnimatedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */; };
 		43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */; };
 		43B9336A13B261B1004584BF /* SVGAnimatedPointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */; };
 		43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; };
@@ -7484,6 +7485,7 @@
 		43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedType.cpp; sourceTree = "<group>"; };
 		43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColor.h; sourceTree = "<group>"; };
 		43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColor.cpp; sourceTree = "<group>"; };
+		43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedString.cpp; sourceTree = "<group>"; };
 		43B9336713B261B1004584BF /* SVGAnimatedPointList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPointList.h; sourceTree = "<group>"; };
 		43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPointList.cpp; sourceTree = "<group>"; };
 		43C092B912D9E4EE00A989C3 /* RenderSVGForeignObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGForeignObject.cpp; sourceTree = "<group>"; };
@@ -17417,6 +17419,7 @@
 				43142E7913B1E97700F1C871 /* SVGAnimatedRect.cpp */,
 				08C859BF1274575300A5728D /* SVGAnimatedRect.h */,
 				B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
+				43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */,
 				084DB59A128008CC002A6D64 /* SVGAnimatedString.h */,
 				B22277F60D00BF1F0071B782 /* SVGAnimatedString.idl */,
 				08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */,
@@ -25823,6 +25826,7 @@
 				43142E7A13B1E97700F1C871 /* SVGAnimatedRect.cpp in Sources */,
 				43B9336A13B261B1004584BF /* SVGAnimatedPointList.cpp in Sources */,
 				43A625F913B3304000AC94B8 /* SVGAnimatedColor.cpp in Sources */,
+				43A6266713B3D11000AC94B8 /* SVGAnimatedString.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/svg/SVGAllInOne.cpp (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAllInOne.cpp	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAllInOne.cpp	2011-06-24 10:21:27 UTC (rev 89661)
@@ -36,6 +36,7 @@
 #include "SVGAnimatedNumber.cpp"
 #include "SVGAnimatedPointList.cpp"
 #include "SVGAnimatedRect.cpp"
+#include "SVGAnimatedString.cpp"
 #include "SVGAnimatedType.cpp"
 #include "SVGAnimateElement.cpp"
 #include "SVGAnimateMotionElement.cpp"

Modified: trunk/Source/WebCore/svg/SVGAnimateElement.cpp (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimateElement.cpp	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimateElement.cpp	2011-06-24 10:21:27 UTC (rev 89661)
@@ -200,7 +200,8 @@
     case AnimatedLength:
     case AnimatedNumber:
     case AnimatedPoints:
-    case AnimatedRect: {
+    case AnimatedRect:
+    case AnimatedString: {
         ASSERT(m_animator);
         ASSERT(results->m_animatedType);
         // Target element might have changed.
@@ -211,13 +212,7 @@
     default:
         break;
     }
-    ASSERT(animationMode == FromToAnimation || animationMode == ToAnimation || animationMode == ValuesAnimation);
-    if ((animationMode == FromToAnimation && percentage > 0.5) || animationMode == ToAnimation || percentage == 1)
-        results->m_animatedString = m_toString;
-    else
-        results->m_animatedString = m_fromString;
-    // Higher priority replace animation overrides any additive results so far.
-    results->m_animatedAttributeType = AnimatedString;
+    ASSERT_NOT_REACHED();
 }
 
 static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
@@ -281,15 +276,14 @@
     case AnimatedNumber:
     case AnimatedPoints:
     case AnimatedRect:
+    case AnimatedString:
         ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString);
         return true;
     default:
         break;
     }
-    m_fromString = fromString;
-    m_toString = toString;
-    m_animatedAttributeType = AnimatedString;
-    return true;
+    ASSERT_NOT_REACHED();
+    return false;
 }
 
 bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const String& byString)
@@ -307,19 +301,20 @@
     case AnimatedNumber:
     case AnimatedPoints:
     case AnimatedRect:
+    case AnimatedString:
         ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString);
         return true;
     default:
         break;
     }
-    return true;
+    ASSERT_NOT_REACHED();
+    return false;
 }
 
 void SVGAnimateElement::resetToBaseValue(const String& baseString)
 {
     SVGElement* targetElement = this->targetElement();
     ASSERT(targetElement);
-    m_animatedString = baseString;
     m_animatedAttributeType = determineAnimatedAttributeType(targetElement);
     switch (m_animatedAttributeType) {
     case AnimatedPath: {
@@ -334,7 +329,8 @@
     case AnimatedLength:
     case AnimatedNumber:
     case AnimatedPoints:
-    case AnimatedRect: {
+    case AnimatedRect:
+    case AnimatedString: {
         if (!m_animatedType)
             m_animatedType = ensureAnimator()->constructFromString(baseString);
         else
@@ -344,7 +340,7 @@
     default:
         break;
     }
-    m_animatedAttributeType = AnimatedString;
+    ASSERT_NOT_REACHED();
 }
     
 void SVGAnimateElement::applyResultsToTarget()
@@ -353,7 +349,7 @@
     switch (m_animatedAttributeType) {
     case AnimatedPath: {
         if (!m_animatedPathPointer || m_animatedPathPointer->isEmpty())
-            valueToApply = m_animatedString;
+            valueToApply = String();
         else {
             // We need to keep going to string and back because we are currently only able to paint
             // "processed" paths where complex shapes are replaced with simpler ones. Path 
@@ -370,10 +366,11 @@
     case AnimatedNumber:
     case AnimatedPoints:
     case AnimatedRect:
+    case AnimatedString:
         valueToApply = m_animatedType->valueAsString();
         break;
     default:
-        valueToApply = m_animatedString;
+        ASSERT_NOT_REACHED();
     }
     setTargetAttributeAnimatedValue(valueToApply);
 }
@@ -392,10 +389,12 @@
     case AnimatedNumber:
     case AnimatedPoints:
     case AnimatedRect:
+    case AnimatedString:
         return ensureAnimator()->calculateDistance(fromString, toString);
     default:
         break;
     }
+    ASSERT_NOT_REACHED();
     return -1;
 }
 

Modified: trunk/Source/WebCore/svg/SVGAnimateElement.h (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimateElement.h	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimateElement.h	2011-06-24 10:21:27 UTC (rev 89661)
@@ -74,9 +74,6 @@
 
     AnimatedPropertyValueType m_fromPropertyValueType;
     AnimatedPropertyValueType m_toPropertyValueType;
-    String m_fromString;
-    String m_toString;
-    String m_animatedString;
     OwnPtr<SVGPathByteStream> m_fromPath;
     OwnPtr<SVGPathByteStream> m_toPath;
     OwnPtr<SVGPathByteStream> m_animatedPath;

Added: trunk/Source/WebCore/svg/SVGAnimatedString.cpp (0 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimatedString.cpp	                        (rev 0)
+++ trunk/Source/WebCore/svg/SVGAnimatedString.cpp	2011-06-24 10:21:27 UTC (rev 89661)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
+#include "SVGAnimatedString.h"
+
+#include "SVGAnimateElement.h"
+
+namespace WebCore {
+
+SVGAnimatedStringAnimator::SVGAnimatedStringAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
+    : SVGAnimatedTypeAnimator(AnimatedString, animationElement, contextElement)
+{
+}
+
+PassOwnPtr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
+{
+    OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createString(new String);
+    animatedType->string() = string;
+    return animatedType.release();
+}
+
+void SVGAnimatedStringAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+{
+    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);
+}
+
+void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned,
+                                                       OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+{
+    ASSERT(m_animationElement);
+    ASSERT(m_contextElement);
+    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
+    
+    AnimationMode animationMode = animationElement->animationMode();
+    String& animateString = animated->string();
+    if ((animationMode == FromToAnimation && percentage > 0.5) || animationMode == ToAnimation || percentage == 1)
+        animateString = to->string();
+    else
+        animateString = from->string();
+}
+
+float SVGAnimatedStringAnimator::calculateDistance(const String&, const String&)
+{
+    // No paced animations for strings.
+    return -1;
+}
+
+}
+
+#endif // ENABLE(SVG) && ENABLE(SVG_ANIMATION)

Modified: trunk/Source/WebCore/svg/SVGAnimatedString.h (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimatedString.h	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimatedString.h	2011-06-24 10:21:27 UTC (rev 89661)
@@ -23,6 +23,7 @@
 #if ENABLE(SVG)
 #include "SVGAnimatedPropertyMacros.h"
 #include "SVGAnimatedStaticPropertyTearOff.h"
+#include "SVGAnimatedTypeAnimator.h"
 
 namespace WebCore {
 
@@ -35,7 +36,25 @@
 #define DEFINE_ANIMATED_STRING(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedString, String, UpperProperty, LowerProperty)
 
+#if ENABLE(SVG_ANIMATION)
+class SVGAnimationElement;
+
+class SVGAnimatedStringAnimator : public SVGAnimatedTypeAnimator {
+    
+public:
+    SVGAnimatedStringAnimator(SVGAnimationElement*, SVGElement*);
+    virtual ~SVGAnimatedStringAnimator() { }
+    
+    virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
+    
+    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 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_ANIMATION)
 #endif // ENABLE(SVG)
 #endif

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.cpp (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2011-06-24 10:21:27 UTC (rev 89661)
@@ -57,6 +57,9 @@
     case AnimatedRect:
         delete m_data.rect;
         break;
+    case AnimatedString:
+        delete m_data.string;
+        break;
     default:
         ASSERT_NOT_REACHED();
         break;
@@ -111,6 +114,14 @@
     return animatedType.release();
 }
 
+PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createString(String* string)
+{
+    ASSERT(string);
+    OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedString));
+    animatedType->m_data.string = string;
+    return animatedType.release();
+}
+
 SVGAngle& SVGAnimatedType::angle()
 {
     ASSERT(m_type == AnimatedAngle);
@@ -147,6 +158,12 @@
     return *m_data.rect;
 }
 
+String& SVGAnimatedType::string()
+{
+    ASSERT(m_type == AnimatedString);
+    return *m_data.string;
+}
+
 String SVGAnimatedType::valueAsString()
 {
     switch (m_type) {
@@ -169,6 +186,9 @@
         ASSERT(m_data.rect);
         return String::number(m_data.rect->x()) + ' ' + String::number(m_data.rect->y()) + ' '
              + String::number(m_data.rect->width()) + ' ' + String::number(m_data.rect->height());
+    case AnimatedString:
+        ASSERT(m_data.string);
+        return *m_data.string;
     default:
         break;
     }
@@ -205,6 +225,10 @@
         ASSERT(m_data.rect);
         parseRect(value, *m_data.rect);
         break;
+    case AnimatedString:
+        ASSERT(m_data.string);
+        *m_data.string = value;
+        break;
     default:
         ASSERT_NOT_REACHED();
         break;

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.h (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimatedType.h	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.h	2011-06-24 10:21:27 UTC (rev 89661)
@@ -42,6 +42,7 @@
     static PassOwnPtr<SVGAnimatedType> createNumber(float*);
     static PassOwnPtr<SVGAnimatedType> createPointList(SVGPointList*);
     static PassOwnPtr<SVGAnimatedType> createRect(FloatRect*);
+    static PassOwnPtr<SVGAnimatedType> createString(String*);
     
     AnimatedAttributeType type() const { return m_type; }
 
@@ -51,6 +52,7 @@
     float& number();
     SVGPointList& pointList();
     FloatRect& rect();
+    String& string();
 
     String valueAsString();
     bool setValueAsString(const QualifiedName&, const String&);
@@ -73,6 +75,7 @@
         float* number;
         SVGPointList* pointList;
         FloatRect* rect;
+        String* string;
     } m_data;
 };
     

Modified: trunk/Source/WebCore/svg/SVGAnimatorFactory.h (89660 => 89661)


--- trunk/Source/WebCore/svg/SVGAnimatorFactory.h	2011-06-24 09:06:32 UTC (rev 89660)
+++ trunk/Source/WebCore/svg/SVGAnimatorFactory.h	2011-06-24 10:21:27 UTC (rev 89661)
@@ -27,6 +27,7 @@
 #include "SVGAnimatedNumber.h"
 #include "SVGAnimatedPointList.h"
 #include "SVGAnimatedRect.h"
+#include "SVGAnimatedString.h"
 
 namespace WebCore {
 
@@ -53,9 +54,11 @@
             return adoptPtr(new SVGAnimatedPointListAnimator(animationElement, contextElement));
         case AnimatedRect:
             return adoptPtr(new SVGAnimatedRectAnimator(animationElement, contextElement));
+        case AnimatedString:
+            return adoptPtr(new SVGAnimatedStringAnimator(animationElement, contextElement));
         default:
             ASSERT_NOT_REACHED();
-            return adoptPtr(new SVGAnimatedLengthAnimator(animationElement, contextElement));
+            return nullptr;
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to