OLD | NEW |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 { | 155 { |
156 SVGAnimatedTypeAnimator* animator = ensureAnimator(); | 156 SVGAnimatedTypeAnimator* animator = ensureAnimator(); |
157 | 157 |
158 SVGElement* targetElement = this->targetElement(); | 158 SVGElement* targetElement = this->targetElement(); |
159 const QualifiedName& attributeName = this->attributeName(); | 159 const QualifiedName& attributeName = this->attributeName(); |
160 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri
buteName); | 160 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri
buteName); |
161 | 161 |
162 if (shouldApply == DontApplyAnimation) | 162 if (shouldApply == DontApplyAnimation) |
163 return; | 163 return; |
164 | 164 |
165 if (shouldApply == ApplyXMLAnimation) { | 165 if (shouldApply == ApplyXMLAnimation || shouldApply == ApplyXMLandCSSAnimati
on) { |
166 // SVG DOM animVal animation code-path. | 166 // SVG DOM animVal animation code-path. |
167 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); | 167 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); |
168 ASSERT(!animatedElements.isEmpty()); | 168 ASSERT(!animatedElements.isEmpty()); |
169 | 169 |
170 for (SVGElement* element : animatedElements) | 170 for (SVGElement* element : animatedElements) |
171 addReferenceTo(element); | 171 addReferenceTo(element); |
172 | 172 |
173 if (!m_animatedProperty) | 173 if (!m_animatedProperty) |
174 m_animatedProperty = animator->startAnimValAnimation(animatedElement
s); | 174 m_animatedProperty = animator->startAnimValAnimation(animatedElement
s); |
175 else | 175 else |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) | 275 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) |
276 { | 276 { |
277 if (!m_animatedProperty) | 277 if (!m_animatedProperty) |
278 return; | 278 return; |
279 | 279 |
280 if (!targetElement) { | 280 if (!targetElement) { |
281 m_animatedProperty.clear(); | 281 m_animatedProperty.clear(); |
282 return; | 282 return; |
283 } | 283 } |
284 | 284 |
285 if (ensureAnimator()->isAnimatingCSSProperty()) { | 285 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri
buteName()); |
| 286 if (shouldApply == ApplyXMLandCSSAnimation) { |
| 287 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); |
| 288 } else if (ensureAnimator()->isAnimatingCSSProperty()) { |
286 // CSS properties animation code-path. | 289 // CSS properties animation code-path. |
287 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); | 290 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); |
288 m_animatedProperty.clear(); | 291 m_animatedProperty.clear(); |
289 return; | 292 return; |
290 } | 293 } |
291 | 294 |
292 // SVG DOM animVal animation code-path. | 295 // SVG DOM animVal animation code-path. |
293 if (m_animator) { | 296 if (m_animator) { |
294 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); | 297 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); |
295 m_animator->stopAnimValAnimation(animatedElements); | 298 m_animator->stopAnimValAnimation(animatedElements); |
296 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName(
)); | 299 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName(
)); |
297 } | 300 } |
298 | 301 |
299 m_animatedProperty.clear(); | 302 m_animatedProperty.clear(); |
300 } | 303 } |
301 | 304 |
302 void SVGAnimateElement::applyResultsToTarget() | 305 void SVGAnimateElement::applyResultsToTarget() |
303 { | 306 { |
304 ASSERT(m_animator); | 307 ASSERT(m_animator); |
305 ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransf
ormElement(*this)); | 308 ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransf
ormElement(*this)); |
306 ASSERT(animatedPropertyType() != AnimatedUnknown); | 309 ASSERT(animatedPropertyType() != AnimatedUnknown); |
307 | 310 |
308 // Early exit if our animated type got destructed by a previous endedActiveI
nterval(). | 311 // Early exit if our animated type got destructed by a previous endedActiveI
nterval(). |
309 if (!m_animatedProperty) | 312 if (!m_animatedProperty) |
310 return; | 313 return; |
311 | 314 |
312 if (m_animator->isAnimatingCSSProperty()) { | 315 // We do update the style and the animation property independent of each oth
er. |
| 316 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement(), att
ributeName()); |
| 317 if (shouldApply == ApplyXMLandCSSAnimation) { |
| 318 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m
_animatedProperty->valueAsString()); |
| 319 } else if (m_animator->isAnimatingCSSProperty()) { |
313 // CSS properties animation code-path. | 320 // CSS properties animation code-path. |
314 // Convert the result of the animation to a String and apply it as CSS p
roperty on the target & all instances. | 321 // Convert the result of the animation to a String and apply it as CSS p
roperty on the target & all instances. |
315 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m
_animatedProperty->valueAsString()); | 322 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m
_animatedProperty->valueAsString()); |
316 return; | 323 return; |
317 } | 324 } |
318 | 325 |
319 // SVG DOM animVal animation code-path. | 326 // SVG DOM animVal animation code-path. |
320 // At this point the SVG DOM values are already changed, unlike for CSS. | 327 // At this point the SVG DOM values are already changed, unlike for CSS. |
321 // We only have to trigger update notifications here. | 328 // We only have to trigger update notifications here. |
322 notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName())
; | 329 notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName())
; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 { | 395 { |
389 visitor->trace(m_fromProperty); | 396 visitor->trace(m_fromProperty); |
390 visitor->trace(m_toProperty); | 397 visitor->trace(m_toProperty); |
391 visitor->trace(m_toAtEndOfDurationProperty); | 398 visitor->trace(m_toAtEndOfDurationProperty); |
392 visitor->trace(m_animatedProperty); | 399 visitor->trace(m_animatedProperty); |
393 visitor->trace(m_animator); | 400 visitor->trace(m_animator); |
394 SVGAnimationElement::trace(visitor); | 401 SVGAnimationElement::trace(visitor); |
395 } | 402 } |
396 | 403 |
397 } | 404 } |
OLD | NEW |