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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAnimationElement) | 48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAnimationElement) |
49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
51 END_REGISTER_ANIMATED_PROPERTIES | 51 END_REGISTER_ANIMATED_PROPERTIES |
52 | 52 |
53 SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document*
document) | 53 SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document*
document) |
54 : SVGSMILElement(tagName, document) | 54 : SVGSMILElement(tagName, document) |
55 , m_fromPropertyValueType(RegularPropertyValue) | 55 , m_fromPropertyValueType(RegularPropertyValue) |
56 , m_toPropertyValueType(RegularPropertyValue) | 56 , m_toPropertyValueType(RegularPropertyValue) |
57 , m_animationValid(false) | 57 , m_animationValid(false) |
| 58 , m_attributeType(AttributeTypeAuto) |
| 59 , m_hasInvalidCSSAttributeType(false) |
58 { | 60 { |
59 registerAnimatedPropertiesForSVGAnimationElement(); | 61 registerAnimatedPropertiesForSVGAnimationElement(); |
60 } | 62 } |
61 | 63 |
62 static void parseKeyTimes(const String& parse, Vector<float>& result, bool verif
yOrder) | 64 static void parseKeyTimes(const String& parse, Vector<float>& result, bool verif
yOrder) |
63 { | 65 { |
64 result.clear(); | 66 result.clear(); |
65 Vector<String> parseList; | 67 Vector<String> parseList; |
66 parse.split(';', parseList); | 68 parse.split(';', parseList); |
67 for (unsigned n = 0; n < parseList.size(); ++n) { | 69 for (unsigned n = 0; n < parseList.size(); ++n) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) | 140 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) |
139 { | 141 { |
140 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 142 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
141 if (supportedAttributes.isEmpty()) { | 143 if (supportedAttributes.isEmpty()) { |
142 SVGTests::addSupportedAttributes(supportedAttributes); | 144 SVGTests::addSupportedAttributes(supportedAttributes); |
143 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 145 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
144 supportedAttributes.add(SVGNames::valuesAttr); | 146 supportedAttributes.add(SVGNames::valuesAttr); |
145 supportedAttributes.add(SVGNames::keyTimesAttr); | 147 supportedAttributes.add(SVGNames::keyTimesAttr); |
146 supportedAttributes.add(SVGNames::keyPointsAttr); | 148 supportedAttributes.add(SVGNames::keyPointsAttr); |
147 supportedAttributes.add(SVGNames::keySplinesAttr); | 149 supportedAttributes.add(SVGNames::keySplinesAttr); |
| 150 supportedAttributes.add(SVGNames::attributeTypeAttr); |
148 } | 151 } |
149 return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslato
r>(attrName); | 152 return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslato
r>(attrName); |
150 } | 153 } |
151 | 154 |
152 void SVGAnimationElement::parseAttribute(const Attribute& attribute) | 155 void SVGAnimationElement::parseAttribute(const Attribute& attribute) |
153 { | 156 { |
154 if (!isSupportedAttribute(attribute.name())) { | 157 if (!isSupportedAttribute(attribute.name())) { |
155 SVGSMILElement::parseAttribute(attribute); | 158 SVGSMILElement::parseAttribute(attribute); |
156 return; | 159 return; |
157 } | 160 } |
(...skipping 20 matching lines...) Expand all Loading... |
178 parseKeyTimes(attribute.value(), m_keyPoints, false); | 181 parseKeyTimes(attribute.value(), m_keyPoints, false); |
179 } | 182 } |
180 return; | 183 return; |
181 } | 184 } |
182 | 185 |
183 if (attribute.name() == SVGNames::keySplinesAttr) { | 186 if (attribute.name() == SVGNames::keySplinesAttr) { |
184 parseKeySplines(attribute.value(), m_keySplines); | 187 parseKeySplines(attribute.value(), m_keySplines); |
185 return; | 188 return; |
186 } | 189 } |
187 | 190 |
| 191 if (attribute.name() == SVGNames::attributeTypeAttr) { |
| 192 setAttributeType(attribute.value()); |
| 193 return; |
| 194 } |
| 195 |
188 if (SVGTests::parseAttribute(attribute)) | 196 if (SVGTests::parseAttribute(attribute)) |
189 return; | 197 return; |
190 if (SVGExternalResourcesRequired::parseAttribute(attribute)) | 198 if (SVGExternalResourcesRequired::parseAttribute(attribute)) |
191 return; | 199 return; |
192 | 200 |
193 ASSERT_NOT_REACHED(); | 201 ASSERT_NOT_REACHED(); |
194 } | 202 } |
195 | 203 |
196 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) | 204 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) |
197 { | 205 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return CalcModeDiscrete; | 282 return CalcModeDiscrete; |
275 if (value == linear) | 283 if (value == linear) |
276 return CalcModeLinear; | 284 return CalcModeLinear; |
277 if (value == paced) | 285 if (value == paced) |
278 return CalcModePaced; | 286 return CalcModePaced; |
279 if (value == spline) | 287 if (value == spline) |
280 return CalcModeSpline; | 288 return CalcModeSpline; |
281 return hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLine
ar; | 289 return hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLine
ar; |
282 } | 290 } |
283 | 291 |
284 SVGAnimationElement::AttributeType SVGAnimationElement::attributeType() const | 292 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) |
285 { | 293 { |
286 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); | 294 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); |
287 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); | 295 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); |
288 const AtomicString& value = fastGetAttribute(SVGNames::attributeTypeAttr); | 296 if (attributeType == css) |
289 if (value == css) | 297 m_attributeType = AttributeTypeCSS; |
290 return AttributeTypeCSS; | 298 else if (attributeType == xml) |
291 if (value == xml) | 299 m_attributeType = AttributeTypeXML; |
292 return AttributeTypeXML; | 300 else |
293 return AttributeTypeAuto; | 301 m_attributeType = AttributeTypeAuto; |
| 302 checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); |
294 } | 303 } |
295 | 304 |
296 String SVGAnimationElement::toValue() const | 305 String SVGAnimationElement::toValue() const |
297 { | 306 { |
298 return fastGetAttribute(SVGNames::toAttr); | 307 return fastGetAttribute(SVGNames::toAttr); |
299 } | 308 } |
300 | 309 |
301 String SVGAnimationElement::byValue() const | 310 String SVGAnimationElement::byValue() const |
302 { | 311 { |
303 return fastGetAttribute(SVGNames::byAttr); | 312 return fastGetAttribute(SVGNames::byAttr); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 SVGElement* targetElement = this->targetElement(); | 650 SVGElement* targetElement = this->targetElement(); |
642 ASSERT(targetElement); | 651 ASSERT(targetElement); |
643 | 652 |
644 const QualifiedName& attributeName = this->attributeName(); | 653 const QualifiedName& attributeName = this->attributeName(); |
645 if (inheritsFromProperty(targetElement, attributeName, from)) | 654 if (inheritsFromProperty(targetElement, attributeName, from)) |
646 m_fromPropertyValueType = InheritValue; | 655 m_fromPropertyValueType = InheritValue; |
647 if (inheritsFromProperty(targetElement, attributeName, to)) | 656 if (inheritsFromProperty(targetElement, attributeName, to)) |
648 m_toPropertyValueType = InheritValue; | 657 m_toPropertyValueType = InheritValue; |
649 } | 658 } |
650 | 659 |
| 660 void SVGAnimationElement::targetElementWillChange(SVGElement* currentTarget, SVG
Element* newTarget) |
| 661 { |
| 662 SVGSMILElement::targetElementWillChange(currentTarget, newTarget); |
| 663 |
| 664 checkInvalidCSSAttributeType(newTarget); |
| 665 } |
| 666 |
| 667 void SVGAnimationElement::setAttributeName(const QualifiedName& attributeName) |
| 668 { |
| 669 SVGSMILElement::setAttributeName(attributeName); |
| 670 |
| 671 checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); |
| 672 } |
| 673 |
| 674 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) |
| 675 { |
| 676 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut
eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa
me()); |
| 677 } |
| 678 |
651 } | 679 } |
652 | 680 |
653 #endif // ENABLE(SVG) | 681 #endif // ENABLE(SVG) |
OLD | NEW |