Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGAnimatedNewPropertyAnimator.cpp
index 3daced3..328f822 100644 (file)
 #include "config.h"
 #include "core/svg/SVGAnimatedNewPropertyAnimator.h"
 
+#include "core/svg/SVGAnimatedColor.h"
 #include "core/svg/SVGAnimationElement.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGLength.h"
 #include "core/svg/SVGLengthList.h"
 #include "core/svg/SVGNumber.h"
 #include "core/svg/SVGPointList.h"
+#include "core/svg/SVGString.h"
 
 namespace WebCore {
 
@@ -72,6 +74,8 @@ PassRefPtr<NewSVGPropertyBase> SVGAnimatedNewPropertyAnimator::createPropertyFor
     // The instance will not have full context info. (e.g. SVGLengthMode)
 
     switch (m_type) {
+    case AnimatedColor:
+        return SVGColorProperty::create(value.isEmpty() ? StyleColor::currentColor() : SVGColor::colorFromRGBColorString(value));
     case AnimatedNumber: {
         RefPtr<SVGNumber> property = SVGNumber::create();
         property->setValueAsString(value, IGNORE_EXCEPTION);
@@ -87,6 +91,11 @@ PassRefPtr<NewSVGPropertyBase> SVGAnimatedNewPropertyAnimator::createPropertyFor
         property->setValueAsString(value, IGNORE_EXCEPTION);
         return property.release();
     }
+    case AnimatedString: {
+        RefPtr<SVGString> property = SVGString::create();
+        property->setValueAsString(value, IGNORE_EXCEPTION);
+        return property.release();
+    }
 
     // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need support.
     case AnimatedBoolean:
@@ -99,13 +108,12 @@ PassRefPtr<NewSVGPropertyBase> SVGAnimatedNewPropertyAnimator::createPropertyFor
 
     // These properties are not yet migrated to NewProperty implementation. see http://crbug.com/308818
     case AnimatedAngle:
-    case AnimatedColor:
     case AnimatedEnumeration:
     case AnimatedInteger:
     case AnimatedIntegerOptionalInteger:
     case AnimatedPath:
     case AnimatedPreserveAspectRatio:
-    case AnimatedString:
+    case AnimatedStringList:
     case AnimatedTransformList:
         ASSERT_NOT_REACHED();
 
@@ -132,7 +140,8 @@ void invokeMethodOnAllTargetProperties(const SVGElementAnimatedPropertyList& lis
     SVGElementAnimatedPropertyList::const_iterator itEnd = list.end();
     for (; it != itEnd; ++it) {
         RefPtr<NewSVGAnimatedPropertyBase> animatedProperty = it->element->propertyFromAttribute(attributeName);
-        (animatedProperty.get()->*method)();
+        if (animatedProperty)
+            (animatedProperty.get()->*method)();
     }
 }
 
@@ -144,7 +153,8 @@ void setAnimatedValueOnAllTargetProperties(const SVGElementAnimatedPropertyList&
     SVGElementAnimatedPropertyList::const_iterator itEnd = list.end();
     for (; it != itEnd; ++it) {
         RefPtr<NewSVGAnimatedPropertyBase> animatedProperty = it->element->propertyFromAttribute(attributeName);
-        animatedProperty->setAnimatedValue(value);
+        if (animatedProperty)
+            animatedProperty->setAnimatedValue(value);
     }
 }