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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 bool SVGAnimateElement::hasValidAttributeType() | 56 bool SVGAnimateElement::hasValidAttributeType() |
57 { | 57 { |
58 SVGElement* targetElement = this->targetElement(); | 58 SVGElement* targetElement = this->targetElement(); |
59 if (!targetElement) | 59 if (!targetElement) |
60 return false; | 60 return false; |
61 | 61 |
62 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT
ype(); | 62 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeT
ype(); |
63 } | 63 } |
64 | 64 |
65 AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement
* targetElement) const | |
66 { | |
67 ASSERT(targetElement); | |
68 | |
69 Vector<AnimatedPropertyType> propertyTypes; | |
70 targetElement->animatedPropertyTypeForAttribute(attributeName(), propertyTyp
es); | |
71 if (propertyTypes.isEmpty()) | |
72 return AnimatedUnknown; | |
73 | |
74 ASSERT(propertyTypes.size() <= 2); | |
75 AnimatedPropertyType type = propertyTypes[0]; | |
76 | |
77 // Animations of transform lists are not allowed for <animate> or <set> | |
78 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties | |
79 if (type == AnimatedTransformList && !hasTagName(SVGNames::animateTransformT
ag)) | |
80 return AnimatedUnknown; | |
81 | |
82 if (propertyTypes.size() == 2) | |
83 ASSERT(propertyTypes[0] == propertyTypes[1]); | |
84 | |
85 return type; | |
86 } | |
87 | |
88 void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
Count, SVGSMILElement* resultElement) | 65 void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
Count, SVGSMILElement* resultElement) |
89 { | 66 { |
90 ASSERT(resultElement); | 67 ASSERT(resultElement); |
91 SVGElement* targetElement = this->targetElement(); | 68 SVGElement* targetElement = this->targetElement(); |
92 if (!targetElement || !isSVGAnimateElement(*resultElement)) | 69 if (!targetElement || !isSVGAnimateElement(*resultElement)) |
93 return; | 70 return; |
94 | 71 |
95 ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(targetElement
)); | 72 ASSERT(m_animatedPropertyType == determineAnimatedPropertyType()); |
96 | 73 |
97 ASSERT(percentage >= 0 && percentage <= 1); | 74 ASSERT(percentage >= 0 && percentage <= 1); |
98 ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGName
s::animateTransformTag)); | 75 ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGName
s::animateTransformTag)); |
99 ASSERT(m_animatedPropertyType != AnimatedUnknown); | 76 ASSERT(m_animatedPropertyType != AnimatedUnknown); |
100 ASSERT(m_animator); | 77 ASSERT(m_animator); |
101 ASSERT(m_animator->type() == m_animatedPropertyType); | 78 ASSERT(m_animator->type() == m_animatedPropertyType); |
102 ASSERT(m_fromProperty); | 79 ASSERT(m_fromProperty); |
103 ASSERT(m_fromProperty->type() == m_animatedPropertyType); | 80 ASSERT(m_fromProperty->type() == m_animatedPropertyType); |
104 ASSERT(m_toProperty); | 81 ASSERT(m_toProperty); |
105 | 82 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 resetAnimatedPropertyType(); | 388 resetAnimatedPropertyType(); |
412 } | 389 } |
413 | 390 |
414 void SVGAnimateElement::resetAnimatedPropertyType() | 391 void SVGAnimateElement::resetAnimatedPropertyType() |
415 { | 392 { |
416 ASSERT(!m_animatedProperty); | 393 ASSERT(!m_animatedProperty); |
417 m_fromProperty.clear(); | 394 m_fromProperty.clear(); |
418 m_toProperty.clear(); | 395 m_toProperty.clear(); |
419 m_toAtEndOfDurationProperty.clear(); | 396 m_toAtEndOfDurationProperty.clear(); |
420 m_animator.clear(); | 397 m_animator.clear(); |
421 m_animatedPropertyType = targetElement() ? determineAnimatedPropertyType(tar
getElement()) : AnimatedString; | 398 m_animatedPropertyType = determineAnimatedPropertyType(); |
422 } | 399 } |
423 | 400 |
424 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() | 401 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() |
425 { | 402 { |
426 if (!m_animator) | 403 if (!m_animator) |
427 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate
dPropertyType); | 404 m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animate
dPropertyType); |
428 ASSERT(m_animatedPropertyType == m_animator->type()); | 405 ASSERT(m_animatedPropertyType == m_animator->type()); |
429 return m_animator.get(); | 406 return m_animator.get(); |
430 } | 407 } |
431 | 408 |
432 } | 409 } |
OLD | NEW |