OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 m_type = AnimatedUnknown; | 45 m_type = AnimatedUnknown; |
46 m_cssProperty = CSSPropertyInvalid; | 46 m_cssProperty = CSSPropertyInvalid; |
47 } | 47 } |
48 | 48 |
49 void SVGAnimatedTypeAnimator::reset(const SVGElement& contextElement) { | 49 void SVGAnimatedTypeAnimator::reset(const SVGElement& contextElement) { |
50 const QualifiedName& attributeName = m_animationElement->attributeName(); | 50 const QualifiedName& attributeName = m_animationElement->attributeName(); |
51 m_animatedProperty = contextElement.propertyFromAttribute(attributeName); | 51 m_animatedProperty = contextElement.propertyFromAttribute(attributeName); |
52 if (m_animatedProperty) { | 52 if (m_animatedProperty) { |
53 m_type = m_animatedProperty->type(); | 53 m_type = m_animatedProperty->type(); |
54 m_cssProperty = m_animatedProperty->cssPropertyId(); | 54 m_cssProperty = m_animatedProperty->cssPropertyId(); |
| 55 |
| 56 if (m_type == AnimatedTransformList) { |
| 57 // Only <animateTransform> is allowed to animate AnimatedTransformList. |
| 58 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties |
| 59 if (!isSVGAnimateTransformElement(*m_animationElement)) |
| 60 m_type = AnimatedUnknown; |
| 61 // Because of the syntactic mismatch between the CSS and SVGProperty |
| 62 // representations, disallow CSS animations of transform list for |
| 63 // now. (We also reject this case via |
| 64 // SVGAnimateTransformElement::hasValidAttributeType ATM.) |
| 65 m_cssProperty = CSSPropertyInvalid; |
| 66 } |
55 } else { | 67 } else { |
56 m_type = SVGElement::animatedPropertyTypeForCSSAttribute(attributeName); | 68 m_type = SVGElement::animatedPropertyTypeForCSSAttribute(attributeName); |
57 m_cssProperty = m_type != AnimatedUnknown | 69 m_cssProperty = m_type != AnimatedUnknown |
58 ? cssPropertyID(attributeName.localName()) | 70 ? cssPropertyID(attributeName.localName()) |
59 : CSSPropertyInvalid; | 71 : CSSPropertyInvalid; |
60 } | 72 DCHECK_NE(m_type, AnimatedTransformList); |
61 | |
62 // Only <animateTransform> is allowed to animate AnimatedTransformList. | |
63 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties | |
64 if (m_type == AnimatedTransformList && | |
65 !isSVGAnimateTransformElement(*m_animationElement)) { | |
66 m_type = AnimatedUnknown; | |
67 m_cssProperty = CSSPropertyInvalid; | |
68 } | 73 } |
69 | 74 |
70 DCHECK(m_type != AnimatedPoint && m_type != AnimatedStringList && | 75 DCHECK(m_type != AnimatedPoint && m_type != AnimatedStringList && |
71 m_type != AnimatedTransform); | 76 m_type != AnimatedTransform); |
72 } | 77 } |
73 | 78 |
74 SVGPropertyBase* SVGAnimatedTypeAnimator::createPropertyForAttributeAnimation( | 79 SVGPropertyBase* SVGAnimatedTypeAnimator::createPropertyForAttributeAnimation( |
75 const String& value) const { | 80 const String& value) const { |
76 // SVG DOM animVal animation code-path. | 81 // SVG DOM animVal animation code-path. |
77 if (m_type == AnimatedTransformList) { | 82 if (m_type == AnimatedTransformList) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 DCHECK_EQ(animatedValue->type(), m_type); | 162 DCHECK_EQ(animatedValue->type(), m_type); |
158 return animatedValue; | 163 return animatedValue; |
159 } | 164 } |
160 | 165 |
161 DEFINE_TRACE(SVGAnimatedTypeAnimator) { | 166 DEFINE_TRACE(SVGAnimatedTypeAnimator) { |
162 visitor->trace(m_animationElement); | 167 visitor->trace(m_animationElement); |
163 visitor->trace(m_animatedProperty); | 168 visitor->trace(m_animatedProperty); |
164 } | 169 } |
165 | 170 |
166 } // namespace blink | 171 } // namespace blink |
OLD | NEW |