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

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

Issue 298873003: SVG: SVGAnimateElement should not cache |m_animatedElements| (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove more asserts Created 6 years, 7 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/svg/SVGAnimateElement.h ('k') | Source/core/svg/SVGAnimatedAngle.cpp » ('j') | 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 SVGElement* targetElement = this->targetElement(); 171 SVGElement* targetElement = this->targetElement();
172 const QualifiedName& attributeName = this->attributeName(); 172 const QualifiedName& attributeName = this->attributeName();
173 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri buteName); 173 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri buteName);
174 174
175 if (shouldApply == DontApplyAnimation) 175 if (shouldApply == DontApplyAnimation)
176 return; 176 return;
177 177
178 if (shouldApply == ApplyXMLAnimation) { 178 if (shouldApply == ApplyXMLAnimation) {
179 // SVG DOM animVal animation code-path. 179 // SVG DOM animVal animation code-path.
180 m_animatedElements = findElementInstances(targetElement); 180 WillBeHeapVector<RawPtrWillBeMember<SVGElement> > animatedElements = fin dElementInstances(targetElement);
181 ASSERT(!m_animatedElements.isEmpty()); 181 ASSERT(!animatedElements.isEmpty());
182 182
183 WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator end = m_animatedElements.end(); 183 WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator end = animatedElements.end();
184 for (WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator i t = m_animatedElements.begin(); it != end; ++it) 184 for (WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator i t = animatedElements.begin(); it != end; ++it)
185 document().accessSVGExtensions().addElementReferencingTarget(this, * it); 185 document().accessSVGExtensions().addElementReferencingTarget(this, * it);
186 186
187 if (!m_animatedProperty) 187 if (!m_animatedProperty)
188 m_animatedProperty = animator->startAnimValAnimation(m_animatedEleme nts); 188 m_animatedProperty = animator->startAnimValAnimation(animatedElement s);
189 else 189 else
190 m_animatedProperty = animator->resetAnimValToBaseVal(m_animatedEleme nts); 190 m_animatedProperty = animator->resetAnimValToBaseVal(animatedElement s);
191 191
192 return; 192 return;
193 } 193 }
194 194
195 // CSS properties animation code-path. 195 // CSS properties animation code-path.
196 ASSERT(m_animatedElements.isEmpty());
197 String baseValue; 196 String baseValue;
198 197
199 if (shouldApply == ApplyCSSAnimation) { 198 if (shouldApply == ApplyCSSAnimation) {
200 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); 199 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName));
201 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local Name()), baseValue); 200 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local Name()), baseValue);
202 } 201 }
203 202
204 m_animatedProperty = animator->constructFromString(baseValue); 203 m_animatedProperty = animator->constructFromString(baseValue);
205 } 204 }
206 205
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) 294 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement)
296 { 295 {
297 if (!m_animatedProperty) 296 if (!m_animatedProperty)
298 return; 297 return;
299 298
300 if (!targetElement) { 299 if (!targetElement) {
301 m_animatedProperty.clear(); 300 m_animatedProperty.clear();
302 return; 301 return;
303 } 302 }
304 303
305 if (m_animatedElements.isEmpty()) { 304 if (ensureAnimator()->isAnimatingCSSProperty()) {
306 // CSS properties animation code-path. 305 // CSS properties animation code-path.
307 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); 306 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName());
308 m_animatedProperty.clear(); 307 m_animatedProperty.clear();
309 return; 308 return;
310 } 309 }
311 310
312 // SVG DOM animVal animation code-path. 311 // SVG DOM animVal animation code-path.
313 if (m_animator) { 312 if (m_animator) {
314 m_animator->stopAnimValAnimation(m_animatedElements); 313 WillBeHeapVector<RawPtrWillBeMember<SVGElement> > animatedElements = fin dElementInstances(targetElement);
314 m_animator->stopAnimValAnimation(animatedElements);
315 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName( )); 315 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName( ));
316 } 316 }
317 317
318 m_animatedElements.clear();
319 m_animatedProperty.clear(); 318 m_animatedProperty.clear();
320 } 319 }
321 320
322 void SVGAnimateElement::applyResultsToTarget() 321 void SVGAnimateElement::applyResultsToTarget()
323 { 322 {
324 ASSERT(m_animatedPropertyType != AnimatedTransformList || isSVGAnimateTransf ormElement(*this)); 323 ASSERT(m_animatedPropertyType != AnimatedTransformList || isSVGAnimateTransf ormElement(*this));
325 ASSERT(m_animatedPropertyType != AnimatedUnknown); 324 ASSERT(m_animatedPropertyType != AnimatedUnknown);
326 ASSERT(m_animator); 325 ASSERT(m_animator);
327 326
328 // Early exit if our animated type got destructed by a previous endedActiveI nterval(). 327 // Early exit if our animated type got destructed by a previous endedActiveI nterval().
329 if (!m_animatedProperty) 328 if (!m_animatedProperty)
330 return; 329 return;
331 330
332 if (m_animatedElements.isEmpty()) { 331 if (ensureAnimator()->isAnimatingCSSProperty()) {
333 // CSS properties animation code-path. 332 // CSS properties animation code-path.
334 // Convert the result of the animation to a String and apply it as CSS p roperty on the target & all instances. 333 // Convert the result of the animation to a String and apply it as CSS p roperty on the target & all instances.
335 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m _animatedProperty->valueAsString()); 334 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m _animatedProperty->valueAsString());
336 return; 335 return;
337 } 336 }
338 337
339 // SVG DOM animVal animation code-path. 338 // SVG DOM animVal animation code-path.
340 // At this point the SVG DOM values are already changed, unlike for CSS. 339 // At this point the SVG DOM values are already changed, unlike for CSS.
341 // We only have to trigger update notifications here. 340 // We only have to trigger update notifications here.
342 notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName()) ; 341 notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName()) ;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() 400 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
402 { 401 {
403 if (!m_animator) 402 if (!m_animator)
404 m_animator = SVGAnimatedTypeAnimator::create(m_animatedPropertyType, thi s, targetElement()); 403 m_animator = SVGAnimatedTypeAnimator::create(m_animatedPropertyType, thi s, targetElement());
405 ASSERT(m_animatedPropertyType == m_animator->type()); 404 ASSERT(m_animatedPropertyType == m_animator->type());
406 return m_animator.get(); 405 return m_animator.get();
407 } 406 }
408 407
409 void SVGAnimateElement::trace(Visitor* visitor) 408 void SVGAnimateElement::trace(Visitor* visitor)
410 { 409 {
411 #if ENABLE(OILPAN)
412 visitor->trace(m_animatedElements);
413 #endif
414 visitor->trace(m_animator); 410 visitor->trace(m_animator);
415 SVGAnimationElement::trace(visitor); 411 SVGAnimationElement::trace(visitor);
416 } 412 }
417 413
418 } 414 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAnimateElement.h ('k') | Source/core/svg/SVGAnimatedAngle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698