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

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

Issue 261603002: Prevent use of stale list length for to-animations of transform lists (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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-list-crash-2-expected.txt ('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 f449003ceaf88f8bc7daa7930d0812f93d5f58f4..f335bc27bd40c0ab6ba005caaaf05ff1a2b57890 100644
--- a/Source/core/svg/SVGTransformList.cpp
+++ b/Source/core/svg/SVGTransformList.cpp
@@ -313,18 +313,18 @@ void SVGTransformList::calculateAnimatedValue(SVGAnimationElement* animationElem
RefPtr<SVGTransformList> toList = toSVGTransformList(toValue);
RefPtr<SVGTransformList> toAtEndOfDurationList = toSVGTransformList(toAtEndOfDurationValue);
- size_t fromListSize = fromList->length();
size_t toListSize = toList->length();
-
if (!toListSize)
return;
+ // 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);
+
// Never resize the animatedTransformList to the toList size, instead either clear the list or append to it.
if (!isEmpty() && !animationElement->isAdditive())
clear();
- RefPtr<SVGTransform> toTransform = toList->at(0);
- RefPtr<SVGTransform> effectiveFrom = fromListSize ? fromList->at(0) : SVGTransform::create(toTransform->transformType(), SVGTransform::ConstructZeroTransform);
RefPtr<SVGTransform> currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
if (animationElement->isAccumulated() && repeatCount) {
RefPtr<SVGTransform> effectiveToAtEnd = !toAtEndOfDurationList->isEmpty() ? toAtEndOfDurationList->at(0) : SVGTransform::create(toTransform->transformType(), SVGTransform::ConstructZeroTransform);
« no previous file with comments | « LayoutTests/svg/animations/animateTransform-list-crash-2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698