| 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 14 matching lines...) Expand all Loading... |
| 25 #include "core/svg/SVGAnimateElement.h" | 25 #include "core/svg/SVGAnimateElement.h" |
| 26 | 26 |
| 27 #include "CSSPropertyNames.h" | 27 #include "CSSPropertyNames.h" |
| 28 #include "SVGNames.h" | 28 #include "SVGNames.h" |
| 29 #include "core/css/CSSParser.h" | 29 #include "core/css/CSSParser.h" |
| 30 #include "core/css/StylePropertySet.h" | 30 #include "core/css/StylePropertySet.h" |
| 31 #include "core/dom/QualifiedName.h" | 31 #include "core/dom/QualifiedName.h" |
| 32 #include "core/svg/SVGAnimatedType.h" | 32 #include "core/svg/SVGAnimatedType.h" |
| 33 #include "core/svg/SVGAnimatedTypeAnimator.h" | 33 #include "core/svg/SVGAnimatedTypeAnimator.h" |
| 34 #include "core/svg/SVGAnimatorFactory.h" | 34 #include "core/svg/SVGAnimatorFactory.h" |
| 35 #include "core/svg/SVGDocumentExtensions.h" | |
| 36 | 35 |
| 37 namespace WebCore { | 36 namespace WebCore { |
| 38 | 37 |
| 39 SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document& doc
ument) | 38 SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document& doc
ument) |
| 40 : SVGAnimationElement(tagName, document) | 39 : SVGAnimationElement(tagName, document) |
| 41 , m_animatedPropertyType(AnimatedString) | 40 , m_animatedPropertyType(AnimatedString) |
| 42 { | 41 { |
| 43 ASSERT(hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::setTag) || h
asTagName(SVGNames::animateColorTag) || hasTagName(SVGNames::animateTransformTag
)); | 42 ASSERT(hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::setTag) || h
asTagName(SVGNames::animateColorTag) || hasTagName(SVGNames::animateTransformTag
)); |
| 44 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
| 45 } | 44 } |
| 46 | 45 |
| 47 PassRefPtr<SVGAnimateElement> SVGAnimateElement::create(const QualifiedName& tag
Name, Document& document) | 46 PassRefPtr<SVGAnimateElement> SVGAnimateElement::create(const QualifiedName& tag
Name, Document& document) |
| 48 { | 47 { |
| 49 return adoptRef(new SVGAnimateElement(tagName, document)); | 48 return adoptRef(new SVGAnimateElement(tagName, document)); |
| 50 } | 49 } |
| 51 | 50 |
| 52 SVGAnimateElement::~SVGAnimateElement() | 51 SVGAnimateElement::~SVGAnimateElement() |
| 53 { | 52 { |
| 54 if (targetElement()) | |
| 55 clearAnimatedType(targetElement()); | |
| 56 } | 53 } |
| 57 | 54 |
| 58 bool SVGAnimateElement::hasValidAttributeType() | 55 bool SVGAnimateElement::hasValidAttributeType() |
| 59 { | 56 { |
| 60 SVGElement* targetElement = this->targetElement(); | 57 SVGElement* targetElement = this->targetElement(); |
| 61 if (!targetElement) | 58 if (!targetElement) |
| 62 return false; | 59 return false; |
| 63 | 60 |
| 64 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT
ype(); | 61 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT
ype(); |
| 65 } | 62 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 SVGElement* targetElement = this->targetElement(); | 204 SVGElement* targetElement = this->targetElement(); |
| 208 const QualifiedName& attributeName = this->attributeName(); | 205 const QualifiedName& attributeName = this->attributeName(); |
| 209 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri
buteName); | 206 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attri
buteName); |
| 210 | 207 |
| 211 if (shouldApply == DontApplyAnimation) | 208 if (shouldApply == DontApplyAnimation) |
| 212 return; | 209 return; |
| 213 | 210 |
| 214 if (shouldApply == ApplyXMLAnimation) { | 211 if (shouldApply == ApplyXMLAnimation) { |
| 215 // SVG DOM animVal animation code-path. | 212 // SVG DOM animVal animation code-path. |
| 216 m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(
targetElement, attributeName); | 213 m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(
targetElement, attributeName); |
| 217 SVGElementAnimatedPropertyList::const_iterator end = m_animatedPropertie
s.end(); | |
| 218 for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedPrope
rties.begin(); it != end; ++it) | |
| 219 document().accessSVGExtensions()->addElementReferencingTarget(this,
it->element); | |
| 220 | |
| 221 ASSERT(!m_animatedProperties.isEmpty()); | 214 ASSERT(!m_animatedProperties.isEmpty()); |
| 222 | 215 |
| 223 ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProp
erties)); | 216 ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProp
erties)); |
| 224 if (!m_animatedType) | 217 if (!m_animatedType) |
| 225 m_animatedType = animator->startAnimValAnimation(m_animatedPropertie
s); | 218 m_animatedType = animator->startAnimValAnimation(m_animatedPropertie
s); |
| 226 else { | 219 else { |
| 227 animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType
.get()); | 220 animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType
.get()); |
| 228 animator->animValDidChange(m_animatedProperties); | 221 animator->animValDidChange(m_animatedProperties); |
| 229 } | 222 } |
| 230 return; | 223 return; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 429 |
| 437 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() | 430 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() |
| 438 { | 431 { |
| 439 if (!m_animator) | 432 if (!m_animator) |
| 440 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate
dPropertyType); | 433 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate
dPropertyType); |
| 441 ASSERT(m_animatedPropertyType == m_animator->type()); | 434 ASSERT(m_animatedPropertyType == m_animator->type()); |
| 442 return m_animator.get(); | 435 return m_animator.get(); |
| 443 } | 436 } |
| 444 | 437 |
| 445 } | 438 } |
| OLD | NEW |