| 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) | |
| 60 { | 58 { |
| 61 registerAnimatedPropertiesForSVGAnimationElement(); | 59 registerAnimatedPropertiesForSVGAnimationElement(); |
| 62 } | 60 } |
| 63 | 61 |
| 64 static void parseKeyTimes(const String& parse, Vector<float>& result, bool verif
yOrder) | 62 static void parseKeyTimes(const String& parse, Vector<float>& result, bool verif
yOrder) |
| 65 { | 63 { |
| 66 result.clear(); | 64 result.clear(); |
| 67 Vector<String> parseList; | 65 Vector<String> parseList; |
| 68 parse.split(';', parseList); | 66 parse.split(';', parseList); |
| 69 for (unsigned n = 0; n < parseList.size(); ++n) { | 67 for (unsigned n = 0; n < parseList.size(); ++n) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) | 138 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) |
| 141 { | 139 { |
| 142 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 140 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 143 if (supportedAttributes.isEmpty()) { | 141 if (supportedAttributes.isEmpty()) { |
| 144 SVGTests::addSupportedAttributes(supportedAttributes); | 142 SVGTests::addSupportedAttributes(supportedAttributes); |
| 145 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 143 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 146 supportedAttributes.add(SVGNames::valuesAttr); | 144 supportedAttributes.add(SVGNames::valuesAttr); |
| 147 supportedAttributes.add(SVGNames::keyTimesAttr); | 145 supportedAttributes.add(SVGNames::keyTimesAttr); |
| 148 supportedAttributes.add(SVGNames::keyPointsAttr); | 146 supportedAttributes.add(SVGNames::keyPointsAttr); |
| 149 supportedAttributes.add(SVGNames::keySplinesAttr); | 147 supportedAttributes.add(SVGNames::keySplinesAttr); |
| 150 supportedAttributes.add(SVGNames::attributeTypeAttr); | |
| 151 } | 148 } |
| 152 return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslato
r>(attrName); | 149 return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslato
r>(attrName); |
| 153 } | 150 } |
| 154 | 151 |
| 155 void SVGAnimationElement::parseAttribute(const Attribute& attribute) | 152 void SVGAnimationElement::parseAttribute(const Attribute& attribute) |
| 156 { | 153 { |
| 157 if (!isSupportedAttribute(attribute.name())) { | 154 if (!isSupportedAttribute(attribute.name())) { |
| 158 SVGSMILElement::parseAttribute(attribute); | 155 SVGSMILElement::parseAttribute(attribute); |
| 159 return; | 156 return; |
| 160 } | 157 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 181 parseKeyTimes(attribute.value(), m_keyPoints, false); | 178 parseKeyTimes(attribute.value(), m_keyPoints, false); |
| 182 } | 179 } |
| 183 return; | 180 return; |
| 184 } | 181 } |
| 185 | 182 |
| 186 if (attribute.name() == SVGNames::keySplinesAttr) { | 183 if (attribute.name() == SVGNames::keySplinesAttr) { |
| 187 parseKeySplines(attribute.value(), m_keySplines); | 184 parseKeySplines(attribute.value(), m_keySplines); |
| 188 return; | 185 return; |
| 189 } | 186 } |
| 190 | 187 |
| 191 if (attribute.name() == SVGNames::attributeTypeAttr) { | |
| 192 setAttributeType(attribute.value()); | |
| 193 return; | |
| 194 } | |
| 195 | |
| 196 if (SVGTests::parseAttribute(attribute)) | 188 if (SVGTests::parseAttribute(attribute)) |
| 197 return; | 189 return; |
| 198 if (SVGExternalResourcesRequired::parseAttribute(attribute)) | 190 if (SVGExternalResourcesRequired::parseAttribute(attribute)) |
| 199 return; | 191 return; |
| 200 | 192 |
| 201 ASSERT_NOT_REACHED(); | 193 ASSERT_NOT_REACHED(); |
| 202 } | 194 } |
| 203 | 195 |
| 204 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) | 196 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) |
| 205 { | 197 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return CalcModeDiscrete; | 274 return CalcModeDiscrete; |
| 283 if (value == linear) | 275 if (value == linear) |
| 284 return CalcModeLinear; | 276 return CalcModeLinear; |
| 285 if (value == paced) | 277 if (value == paced) |
| 286 return CalcModePaced; | 278 return CalcModePaced; |
| 287 if (value == spline) | 279 if (value == spline) |
| 288 return CalcModeSpline; | 280 return CalcModeSpline; |
| 289 return hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLine
ar; | 281 return hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLine
ar; |
| 290 } | 282 } |
| 291 | 283 |
| 292 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) | 284 SVGAnimationElement::AttributeType SVGAnimationElement::attributeType() const |
| 293 { | 285 { |
| 294 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); | 286 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); |
| 295 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); | 287 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); |
| 296 if (attributeType == css) | 288 const AtomicString& value = fastGetAttribute(SVGNames::attributeTypeAttr); |
| 297 m_attributeType = AttributeTypeCSS; | 289 if (value == css) |
| 298 else if (attributeType == xml) | 290 return AttributeTypeCSS; |
| 299 m_attributeType = AttributeTypeXML; | 291 if (value == xml) |
| 300 else | 292 return AttributeTypeXML; |
| 301 m_attributeType = AttributeTypeAuto; | 293 return AttributeTypeAuto; |
| 302 checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); | |
| 303 } | 294 } |
| 304 | 295 |
| 305 String SVGAnimationElement::toValue() const | 296 String SVGAnimationElement::toValue() const |
| 306 { | 297 { |
| 307 return fastGetAttribute(SVGNames::toAttr); | 298 return fastGetAttribute(SVGNames::toAttr); |
| 308 } | 299 } |
| 309 | 300 |
| 310 String SVGAnimationElement::byValue() const | 301 String SVGAnimationElement::byValue() const |
| 311 { | 302 { |
| 312 return fastGetAttribute(SVGNames::byAttr); | 303 return fastGetAttribute(SVGNames::byAttr); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 SVGElement* targetElement = this->targetElement(); | 641 SVGElement* targetElement = this->targetElement(); |
| 651 ASSERT(targetElement); | 642 ASSERT(targetElement); |
| 652 | 643 |
| 653 const QualifiedName& attributeName = this->attributeName(); | 644 const QualifiedName& attributeName = this->attributeName(); |
| 654 if (inheritsFromProperty(targetElement, attributeName, from)) | 645 if (inheritsFromProperty(targetElement, attributeName, from)) |
| 655 m_fromPropertyValueType = InheritValue; | 646 m_fromPropertyValueType = InheritValue; |
| 656 if (inheritsFromProperty(targetElement, attributeName, to)) | 647 if (inheritsFromProperty(targetElement, attributeName, to)) |
| 657 m_toPropertyValueType = InheritValue; | 648 m_toPropertyValueType = InheritValue; |
| 658 } | 649 } |
| 659 | 650 |
| 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 | |
| 679 } | 651 } |
| 680 | 652 |
| 681 #endif // ENABLE(SVG) | 653 #endif // ENABLE(SVG) |
| OLD | NEW |