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

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

Issue 330813002: Fix computation of animated transform w/ different from/to transform types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixup comment. Created 6 years, 6 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 | « LayoutTests/svg/animations/animateTransform-to-mismatched-types-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGTransformList.cpp
diff --git a/Source/core/svg/SVGTransformList.cpp b/Source/core/svg/SVGTransformList.cpp
index 1dc862b24170d78adba7124939c49eb2e5accda3..3a5bb20d177aad88dfa150c89e5a9157740cd63f 100644
--- a/Source/core/svg/SVGTransformList.cpp
+++ b/Source/core/svg/SVGTransformList.cpp
@@ -319,10 +319,15 @@ void SVGTransformList::calculateAnimatedValue(SVGAnimationElement* animationElem
// Get a reference to the from value before potentially cleaning it out (in the case of a To animation.)
RefPtr<SVGTransform> toTransform = toList->at(0);
- RefPtr<SVGTransform> effectiveFrom = fromList->length() ? fromList->at(0) : SVGTransform::create(toTransform->transformType(), SVGTransform::ConstructZeroTransform);
+ RefPtr<SVGTransform> effectiveFrom;
+ // If there's an existing 'from'/underlying value of the same type use that, else use a "zero transform".
+ if (fromList->length() && fromList->at(0)->transformType() == toTransform->transformType())
+ effectiveFrom = fromList->at(0);
+ else
+ effectiveFrom = SVGTransform::create(toTransform->transformType(), SVGTransform::ConstructZeroTransform);
// Never resize the animatedTransformList to the toList size, instead either clear the list or append to it.
- if (!isEmpty() && !animationElement->isAdditive())
+ if (!isEmpty() && (!animationElement->isAdditive() || isToAnimation))
clear();
RefPtr<SVGTransform> currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
« no previous file with comments | « LayoutTests/svg/animations/animateTransform-to-mismatched-types-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698