Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Unified Diff: Source/core/svg/SVGAnimatedType.cpp

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGAnimatedType.cpp
diff --git a/Source/core/svg/SVGAnimatedType.cpp b/Source/core/svg/SVGAnimatedType.cpp
index eb6b456bdf4a24896ca5f8a7a190653485262c45..a9b45da7294bae29ac857b0c0106f7ae38c3b648 100644
--- a/Source/core/svg/SVGAnimatedType.cpp
+++ b/Source/core/svg/SVGAnimatedType.cpp
@@ -52,12 +52,6 @@ SVGAnimatedType::~SVGAnimatedType()
case AnimatedIntegerOptionalInteger:
delete m_data.integerOptionalInteger;
break;
- case AnimatedLength:
- delete m_data.length;
- break;
- case AnimatedLengthList:
- delete m_data.lengthList;
- break;
case AnimatedNumber:
delete m_data.number;
break;
@@ -85,6 +79,9 @@ SVGAnimatedType::~SVGAnimatedType()
case AnimatedTransformList:
delete m_data.transformList;
break;
+ // Below properties have migrated to new property implementation.
+ case AnimatedLength:
+ case AnimatedLengthList:
case AnimatedNewProperty:
// handled by RefPtr
break;
@@ -142,22 +139,6 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(pair<i
return animatedType.release();
}
-PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createLength(SVGLength* length)
-{
- ASSERT(length);
- OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedLength));
- animatedType->m_data.length = length;
- return animatedType.release();
-}
-
-PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createLengthList(SVGLengthList* lengthList)
-{
- ASSERT(lengthList);
- OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedLengthList));
- animatedType->m_data.lengthList = lengthList;
- return animatedType.release();
-}
-
PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createNumber(float* number)
{
ASSERT(number);
@@ -230,10 +211,10 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createTransformList(SVGTransformLis
return animatedType.release();
}
-PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createNewProperty(PassRefPtr<NewSVGPropertyBase> newProperty)
+PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createNewProperty(PassRefPtr<NewSVGPropertyBase> newProperty, AnimatedPropertyType propertyType)
{
ASSERT(newProperty);
- OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedNewProperty));
+ OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(propertyType));
animatedType->m_newProperty = newProperty;
return animatedType.release();
}
@@ -244,12 +225,6 @@ String SVGAnimatedType::valueAsString()
case AnimatedColor:
ASSERT(m_data.color);
return m_data.color->serialized();
- case AnimatedLength:
- ASSERT(m_data.length);
- return m_data.length->valueAsString();
- case AnimatedLengthList:
- ASSERT(m_data.lengthList);
- return m_data.lengthList->valueAsString();
case AnimatedNumber:
ASSERT(m_data.number);
return String::number(*m_data.number);
@@ -260,6 +235,9 @@ String SVGAnimatedType::valueAsString()
case AnimatedString:
ASSERT(m_data.string);
return *m_data.string;
+ // Below properties have migrated to new property implementation.
+ case AnimatedLength:
+ case AnimatedLengthList:
case AnimatedNewProperty:
return m_newProperty->valueAsString();
@@ -291,16 +269,6 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
ASSERT(m_data.color);
*m_data.color = value.isEmpty() ? Color() : SVGColor::colorFromRGBColorString(value);
break;
- case AnimatedLength: {
- ASSERT(m_data.length);
- TrackExceptionState exceptionState;
- m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), exceptionState);
- return !exceptionState.hadException();
- }
- case AnimatedLengthList:
- ASSERT(m_data.lengthList);
- m_data.lengthList->parse(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName));
- break;
case AnimatedNumber:
ASSERT(m_data.number);
parseNumberFromString(value, *m_data.number);
@@ -313,6 +281,9 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
ASSERT(m_data.string);
*m_data.string = value;
break;
+ // Below properties have migrated to new property implementation.
+ case AnimatedLength:
+ case AnimatedLengthList:
case AnimatedNewProperty:
// always use createForAnimation call path for NewSVGProperty implementations.
return false;

Powered by Google App Engine
This is Rietveld 408576698