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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return; | 183 return; |
184 if (shouldApply == ApplyXMLAnimation || shouldApply == ApplyXMLandCSSAnimati
on) { | 184 if (shouldApply == ApplyXMLAnimation || shouldApply == ApplyXMLandCSSAnimati
on) { |
185 // SVG DOM animVal animation code-path. | 185 // SVG DOM animVal animation code-path. |
186 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); | 186 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); |
187 ASSERT(!animatedElements.isEmpty()); | 187 ASSERT(!animatedElements.isEmpty()); |
188 | 188 |
189 for (SVGElement* element : animatedElements) | 189 for (SVGElement* element : animatedElements) |
190 addReferenceTo(element); | 190 addReferenceTo(element); |
191 | 191 |
192 if (!m_animatedProperty) | 192 if (!m_animatedProperty) |
193 m_animatedProperty = m_animator.startAnimValAnimation(animatedElemen
ts); | 193 m_animatedProperty = m_animator.startAnimValAnimation(); |
194 else | 194 else |
195 m_animatedProperty = m_animator.resetAnimValToBaseVal(animatedElemen
ts); | 195 m_animatedProperty = m_animator.resetAnimValToBaseVal(); |
196 | 196 |
197 return; | 197 return; |
198 } | 198 } |
| 199 DCHECK_EQ(shouldApply, ApplyCSSAnimation); |
199 | 200 |
200 // CSS properties animation code-path. | 201 // CSS properties animation code-path. |
201 String baseValue; | 202 String baseValue; |
202 | 203 DCHECK(isTargetAttributeCSSProperty(targetElement, attributeName)); |
203 if (shouldApply == ApplyCSSAnimation) { | 204 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName
()), baseValue); |
204 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement,
attributeName)); | |
205 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local
Name()), baseValue); | |
206 } | |
207 | 205 |
208 m_animatedProperty = m_animator.constructFromString(baseValue); | 206 m_animatedProperty = m_animator.constructFromString(baseValue); |
209 } | 207 } |
210 | 208 |
211 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElemen
t, const QualifiedName& attributeName, const String& valueAsString) | 209 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElemen
t, const QualifiedName& attributeName, const String& valueAsString) |
212 { | 210 { |
213 ASSERT(targetElement); | 211 ASSERT(targetElement); |
214 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) | 212 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) |
215 return; | 213 return; |
216 | 214 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } else if (m_animator.isAnimatingCSSProperty()) { | 273 } else if (m_animator.isAnimatingCSSProperty()) { |
276 // CSS properties animation code-path. | 274 // CSS properties animation code-path. |
277 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); | 275 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); |
278 m_animatedProperty.clear(); | 276 m_animatedProperty.clear(); |
279 m_animator.clear(); | 277 m_animator.clear(); |
280 return; | 278 return; |
281 } | 279 } |
282 | 280 |
283 // SVG DOM animVal animation code-path. | 281 // SVG DOM animVal animation code-path. |
284 if (m_animatedProperty) { | 282 if (m_animatedProperty) { |
285 SVGElementInstances animatedElements = findElementInstances(targetElemen
t); | 283 m_animator.stopAnimValAnimation(); |
286 m_animator.stopAnimValAnimation(animatedElements); | |
287 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName(
)); | 284 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName(
)); |
288 } | 285 } |
289 | 286 |
290 m_animatedProperty.clear(); | 287 m_animatedProperty.clear(); |
291 m_animator.clear(); | 288 m_animator.clear(); |
292 } | 289 } |
293 | 290 |
294 void SVGAnimateElement::applyResultsToTarget() | 291 void SVGAnimateElement::applyResultsToTarget() |
295 { | 292 { |
296 ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransf
ormElement(*this)); | 293 ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransf
ormElement(*this)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 { | 374 { |
378 visitor->trace(m_fromProperty); | 375 visitor->trace(m_fromProperty); |
379 visitor->trace(m_toProperty); | 376 visitor->trace(m_toProperty); |
380 visitor->trace(m_toAtEndOfDurationProperty); | 377 visitor->trace(m_toAtEndOfDurationProperty); |
381 visitor->trace(m_animatedProperty); | 378 visitor->trace(m_animatedProperty); |
382 visitor->trace(m_animator); | 379 visitor->trace(m_animator); |
383 SVGAnimationElement::trace(visitor); | 380 SVGAnimationElement::trace(visitor); |
384 } | 381 } |
385 | 382 |
386 } // namespace blink | 383 } // namespace blink |
OLD | NEW |