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

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

Issue 174293005: Fix crash in which elementData() might be null. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 ASSERT(m_animatedPropertyType == animator->type()); 195 ASSERT(m_animatedPropertyType == animator->type());
196 196
197 SVGElement* targetElement = this->targetElement(); 197 SVGElement* targetElement = this->targetElement();
198 const QualifiedName& attributeName = this->attributeName(); 198 const QualifiedName& attributeName = this->attributeName();
199 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri buteName); 199 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri buteName);
200 200
201 if (shouldApply == DontApplyAnimation) 201 if (shouldApply == DontApplyAnimation)
202 return; 202 return;
203 203
204 if (shouldApply == ApplyXMLAnimation) { 204 if (shouldApply == ApplyXMLAnimation) {
205 targetElement->invalidateSVGAttributes();
adamk 2014/02/24 21:33:01 Why did you put this here instead of next to the s
chrishtr 2014/02/24 21:46:19 It is indeed the case that not all callers of thes
chrishtr 2014/02/24 22:30:46 Done.
205 // SVG DOM animVal animation code-path. 206 // SVG DOM animVal animation code-path.
206 m_animatedProperties = animator->findAnimatedPropertiesForAttributeName( targetElement, attributeName); 207 m_animatedProperties = animator->findAnimatedPropertiesForAttributeName( targetElement, attributeName);
207 SVGElementAnimatedPropertyList::const_iterator end = m_animatedPropertie s.end(); 208 SVGElementAnimatedPropertyList::const_iterator end = m_animatedPropertie s.end();
208 for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedPrope rties.begin(); it != end; ++it) 209 for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedPrope rties.begin(); it != end; ++it)
209 document().accessSVGExtensions()->addElementReferencingTarget(this, it->element); 210 document().accessSVGExtensions()->addElementReferencingTarget(this, it->element);
210 211
211 ASSERT(!m_animatedProperties.isEmpty()); 212 ASSERT(!m_animatedProperties.isEmpty());
212 213
213 ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProp erties)); 214 ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProp erties));
214 if (!m_animatedType) 215 if (!m_animatedType)
215 m_animatedType = animator->startAnimValAnimation(m_animatedPropertie s); 216 m_animatedType = animator->startAnimValAnimation(m_animatedPropertie s);
216 else { 217 else {
217 animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType .get()); 218 animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType .get());
218 animator->animValDidChange(m_animatedProperties); 219 animator->animValDidChange(m_animatedProperties);
219 } 220 }
220 return; 221 return;
221 } 222 }
222 223
223 // CSS properties animation code-path. 224 // CSS properties animation code-path.
224 ASSERT(m_animatedProperties.isEmpty()); 225 ASSERT(m_animatedProperties.isEmpty());
225 String baseValue; 226 String baseValue;
226 227
227 if (shouldApply == ApplyCSSAnimation) { 228 if (shouldApply == ApplyCSSAnimation) {
229 targetElement->invalidateSVGAttributes();
adamk 2014/02/24 21:33:01 Same question as above.
chrishtr 2014/02/24 22:30:46 Done.
228 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); 230 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName));
229 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local Name()), baseValue); 231 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local Name()), baseValue);
230 } 232 }
231 233
232 if (!m_animatedType || !m_animatedType->setValueAsString(attributeName, base Value)) 234 if (!m_animatedType || !m_animatedType->setValueAsString(attributeName, base Value))
233 m_animatedType = animator->constructFromString(baseValue); 235 m_animatedType = animator->constructFromString(baseValue);
234 } 236 }
235 237
236 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSProper tyID id, const String& value) 238 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSProper tyID id, const String& value)
237 { 239 {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 426
425 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() 427 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
426 { 428 {
427 if (!m_animator) 429 if (!m_animator)
428 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType); 430 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate dPropertyType);
429 ASSERT(m_animatedPropertyType == m_animator->type()); 431 ASSERT(m_animatedPropertyType == m_animator->type());
430 return m_animator.get(); 432 return m_animator.get();
431 } 433 }
432 434
433 } 435 }
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698