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

Side by Side Diff: Source/WebCore/svg/SVGAnimateElement.cpp

Issue 11184044: Merge 130777 - Prevent animation when CSS attributeType is invalid. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 SVGAnimateElement::~SVGAnimateElement() 50 SVGAnimateElement::~SVGAnimateElement()
51 { 51 {
52 } 52 }
53 53
54 bool SVGAnimateElement::hasValidAttributeType() 54 bool SVGAnimateElement::hasValidAttributeType()
55 { 55 {
56 SVGElement* targetElement = this->targetElement(); 56 SVGElement* targetElement = this->targetElement();
57 if (!targetElement) 57 if (!targetElement)
58 return false; 58 return false;
59 59
60 return m_animatedPropertyType != AnimatedUnknown; 60 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT ype();
61 } 61 }
62 62
63 AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement * targetElement) const 63 AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement * targetElement) const
64 { 64 {
65 ASSERT(targetElement); 65 ASSERT(targetElement);
66 66
67 Vector<AnimatedPropertyType> propertyTypes; 67 Vector<AnimatedPropertyType> propertyTypes;
68 targetElement->animatedPropertyTypeForAttribute(attributeName(), propertyTyp es); 68 targetElement->animatedPropertyTypeForAttribute(attributeName(), propertyTyp es);
69 if (propertyTypes.isEmpty()) 69 if (propertyTypes.isEmpty())
70 return AnimatedUnknown; 70 return AnimatedUnknown;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // FIXME: A return value of float is not enough to support paced animations on lists. 391 // FIXME: A return value of float is not enough to support paced animations on lists.
392 SVGElement* targetElement = this->targetElement(); 392 SVGElement* targetElement = this->targetElement();
393 if (!targetElement) 393 if (!targetElement)
394 return -1; 394 return -1;
395 395
396 return ensureAnimator()->calculateDistance(fromString, toString); 396 return ensureAnimator()->calculateDistance(fromString, toString);
397 } 397 }
398 398
399 void SVGAnimateElement::targetElementWillChange(SVGElement* currentTarget, SVGEl ement* newTarget) 399 void SVGAnimateElement::targetElementWillChange(SVGElement* currentTarget, SVGEl ement* newTarget)
400 { 400 {
401 SVGSMILElement::targetElementWillChange(currentTarget, newTarget); 401 SVGAnimationElement::targetElementWillChange(currentTarget, newTarget);
402 402
403 ASSERT(!m_animatedType); 403 ASSERT(!m_animatedType);
404 m_fromType.clear(); 404 m_fromType.clear();
405 m_toType.clear(); 405 m_toType.clear();
406 m_toAtEndOfDurationType.clear(); 406 m_toAtEndOfDurationType.clear();
407 m_animator.clear(); 407 m_animator.clear();
408 m_animatedPropertyType = newTarget ? determineAnimatedPropertyType(newTarget ) : AnimatedString; 408 m_animatedPropertyType = newTarget ? determineAnimatedPropertyType(newTarget ) : AnimatedString;
409 } 409 }
410 410
411 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() 411 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
412 { 412 {
413 if (!m_animator) 413 if (!m_animator)
414 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType); 414 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType);
415 ASSERT(m_animatedPropertyType == m_animator->type()); 415 ASSERT(m_animatedPropertyType == m_animator->type());
416 return m_animator.get(); 416 return m_animator.get();
417 } 417 }
418 418
419 } 419 }
420 420
421 #endif // ENABLE(SVG) 421 #endif // ENABLE(SVG)
OLDNEW
« no previous file with comments | « LayoutTests/svg/animations/script-tests/animate-css-xml-attributeType.js ('k') | Source/WebCore/svg/SVGAnimationElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698