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

Unified Diff: third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp

Issue 2272033002: Refactor SMIL animation value updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@smil-css-prop-update
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
index 9030a03e86711a6b5b03d48aede82491a1046654..323c800abc7cdb5bc72d8eb69382226eff1413e7 100644
--- a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
@@ -161,55 +161,32 @@ void SVGAnimatedTypeAnimator::calculateFromAndByValues(Member<SVGPropertyBase>&
to->add(from, m_contextElement);
}
-namespace {
-
-void setAnimatedValueOnAllTargetProperties(const SVGElementInstances& list, const QualifiedName& attributeName, SVGPropertyBase* value)
+SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimation()
{
- for (SVGElement* elementInstance : list) {
- if (SVGAnimatedPropertyBase* animatedProperty = elementInstance->propertyFromAttribute(attributeName))
- animatedProperty->setAnimatedValue(value);
- }
-}
-
-} // namespace
-
-SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimation(const SVGElementInstances& list)
-{
- ASSERT(isAnimatingSVGDom());
+ DCHECK(isAnimatingSVGDom());
+ DCHECK(m_contextElement);
SVGPropertyBase* animatedValue = m_animatedProperty->createAnimatedValue();
- ASSERT(animatedValue->type() == m_type);
- setAnimatedValueOnAllTargetProperties(list, m_animatedProperty->attributeName(), animatedValue);
-
+ DCHECK_EQ(animatedValue->type(), m_type);
+ m_contextElement->setAnimatedAttribute(m_animatedProperty->attributeName(), animatedValue);
return animatedValue;
}
-SVGPropertyBase* SVGAnimatedTypeAnimator::startAnimValAnimation(const SVGElementInstances& list)
+SVGPropertyBase* SVGAnimatedTypeAnimator::startAnimValAnimation()
{
- ASSERT(isAnimatingSVGDom());
- SVGElement::InstanceUpdateBlocker blocker(m_contextElement);
-
- return resetAnimation(list);
+ return resetAnimation();
}
-void SVGAnimatedTypeAnimator::stopAnimValAnimation(const SVGElementInstances& list)
+void SVGAnimatedTypeAnimator::stopAnimValAnimation()
{
if (!isAnimatingSVGDom())
return;
-
- ASSERT(m_contextElement);
- SVGElement::InstanceUpdateBlocker blocker(m_contextElement);
-
- for (SVGElement* elementInstance : list) {
- if (SVGAnimatedPropertyBase* animatedProperty = elementInstance->propertyFromAttribute(m_animatedProperty->attributeName()))
- animatedProperty->animationEnded();
- }
+ DCHECK(m_contextElement);
+ m_contextElement->clearAnimatedAttribute(m_animatedProperty->attributeName());
}
-SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimValToBaseVal(const SVGElementInstances& list)
+SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimValToBaseVal()
{
- SVGElement::InstanceUpdateBlocker blocker(m_contextElement);
-
- return resetAnimation(list);
+ return resetAnimation();
}
class ParsePropertyFromString {
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h ('k') | third_party/WebKit/Source/core/svg/SVGAnimationElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698