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

Unified Diff: Source/WebCore/svg/SVGAnimateElement.cpp

Issue 9568017: Merge 108134 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months 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
« no previous file with comments | « Source/WebCore/svg/SVGAnimateElement.h ('k') | Source/WebCore/svg/SVGAnimatedTypeAnimator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/svg/SVGAnimateElement.cpp
===================================================================
--- Source/WebCore/svg/SVGAnimateElement.cpp (revision 109357)
+++ Source/WebCore/svg/SVGAnimateElement.cpp (working copy)
@@ -109,7 +109,7 @@
if (!targetElement)
return false;
- return determineAnimatedPropertyType(targetElement) != AnimatedUnknown;
+ return m_animatedPropertyType != AnimatedUnknown;
}
AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement* targetElement) const
@@ -159,12 +159,20 @@
void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement)
{
ASSERT(resultElement);
+ SVGElement* targetElement = this->targetElement();
+ if (!targetElement)
+ return;
+
+ ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(targetElement));
+
ASSERT(percentage >= 0 && percentage <= 1);
ASSERT(m_animatedPropertyType != AnimatedEnumeration);
ASSERT(m_animatedPropertyType != AnimatedTransformList);
ASSERT(m_animatedPropertyType != AnimatedUnknown);
ASSERT(m_animator);
+ ASSERT(m_animator->type() == m_animatedPropertyType);
ASSERT(m_fromType);
+ ASSERT(m_fromType->type() == m_animatedPropertyType);
ASSERT(m_toType);
SVGAnimateElement* resultAnimationElement = static_cast<SVGAnimateElement*>(resultElement);
@@ -177,10 +185,6 @@
if (hasTagName(SVGNames::setTag))
percentage = 1;
- SVGElement* targetElement = this->targetElement();
- if (!targetElement)
- return;
-
// Target element might have changed.
m_animator->setContextElement(targetElement);
m_animator->calculateAnimatedValue(percentage, repeat, m_fromType, m_toType, resultAnimationElement->m_animatedType);
@@ -192,9 +196,8 @@
if (!targetElement)
return false;
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return true;
}
@@ -205,22 +208,19 @@
return false;
ASSERT(!hasTagName(SVGNames::setTag));
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return true;
}
void SVGAnimateElement::resetToBaseValue(const String& baseString)
{
- SVGElement* targetElement = this->targetElement();
- ASSERT(targetElement);
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
if (!m_animatedType)
m_animatedType = ensureAnimator()->constructFromString(baseString);
else
m_animatedType->setValueAsString(attributeName(), baseString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
}
void SVGAnimateElement::applyResultsToTarget()
@@ -239,15 +239,24 @@
SVGElement* targetElement = this->targetElement();
if (!targetElement)
return -1;
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
+
return ensureAnimator()->calculateDistance(fromString, toString);
}
+void SVGAnimateElement::targetElementDidChange(SVGElement* targetElement)
+{
+ m_animatedType.clear();
+ m_fromType.clear();
+ m_toType.clear();
+ m_animator.clear();
+ m_animatedPropertyType = targetElement ? determineAnimatedPropertyType(targetElement) : AnimatedString;
+}
+
SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
{
if (!m_animator)
m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animatedPropertyType);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return m_animator.get();
}
« no previous file with comments | « Source/WebCore/svg/SVGAnimateElement.h ('k') | Source/WebCore/svg/SVGAnimatedTypeAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698