Chromium Code Reviews| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 parsed = parseKeySplinesInternal<LChar>(string, result); | 151 parsed = parseKeySplinesInternal<LChar>(string, result); |
| 152 else | 152 else |
| 153 parsed = parseKeySplinesInternal<UChar>(string, result); | 153 parsed = parseKeySplinesInternal<UChar>(string, result); |
| 154 if (!parsed) { | 154 if (!parsed) { |
| 155 result.clear(); | 155 result.clear(); |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) | |
| 162 { | |
| 163 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 164 if (supportedAttributes.isEmpty()) { | |
| 165 supportedAttributes.add(SVGNames::valuesAttr); | |
| 166 supportedAttributes.add(SVGNames::keyTimesAttr); | |
| 167 supportedAttributes.add(SVGNames::keyPointsAttr); | |
| 168 supportedAttributes.add(SVGNames::keySplinesAttr); | |
| 169 supportedAttributes.add(SVGNames::attributeTypeAttr); | |
| 170 supportedAttributes.add(SVGNames::calcModeAttr); | |
| 171 supportedAttributes.add(SVGNames::fromAttr); | |
| 172 supportedAttributes.add(SVGNames::toAttr); | |
| 173 supportedAttributes.add(SVGNames::byAttr); | |
| 174 } | |
| 175 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 176 } | |
| 177 | |
| 178 void SVGAnimationElement::parseAttribute(const QualifiedName& name, const Atomic String& value) | 161 void SVGAnimationElement::parseAttribute(const QualifiedName& name, const Atomic String& value) |
| 179 { | 162 { |
| 180 if (!isSupportedAttribute(name)) { | |
| 181 SVGSMILElement::parseAttribute(name, value); | |
| 182 return; | |
| 183 } | |
| 184 | |
| 185 if (name == SVGNames::valuesAttr) { | 163 if (name == SVGNames::valuesAttr) { |
| 186 if (!parseValues(value, m_values)) { | 164 if (!parseValues(value, m_values)) { |
| 187 reportAttributeParsingError(ParsingAttributeFailedError, name, value ); | 165 reportAttributeParsingError(ParsingAttributeFailedError, name, value ); |
| 188 return; | 166 return; |
| 189 } | 167 } |
| 190 updateAnimationMode(); | 168 updateAnimationMode(); |
| 191 return; | 169 return; |
| 192 } | 170 } |
| 193 | 171 |
| 194 if (name == SVGNames::keyTimesAttr) { | 172 if (name == SVGNames::keyTimesAttr) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 221 if (name == SVGNames::calcModeAttr) { | 199 if (name == SVGNames::calcModeAttr) { |
| 222 setCalcMode(value); | 200 setCalcMode(value); |
| 223 return; | 201 return; |
| 224 } | 202 } |
| 225 | 203 |
| 226 if (name == SVGNames::fromAttr || name == SVGNames::toAttr || name == SVGNam es::byAttr) { | 204 if (name == SVGNames::fromAttr || name == SVGNames::toAttr || name == SVGNam es::byAttr) { |
| 227 updateAnimationMode(); | 205 updateAnimationMode(); |
| 228 return; | 206 return; |
| 229 } | 207 } |
| 230 | 208 |
| 231 ASSERT_NOT_REACHED(); | 209 SVGSMILElement::parseAttribute(name, value); |
| 210 SVGTests::parseAttribute(name, value); | |
|
fs
2015/04/10 14:25:23
The SVGTests constructor adds all its attributes t
Erik Dahlström (inactive)
2015/04/10 15:33:43
Done.
| |
| 232 } | 211 } |
| 233 | 212 |
| 234 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) | 213 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) |
| 235 { | 214 { |
| 236 if (!isSupportedAttribute(attrName)) { | 215 if (attrName == SVGNames::valuesAttr |
| 237 SVGSMILElement::svgAttributeChanged(attrName); | 216 || attrName == SVGNames::byAttr |
| 217 || attrName == SVGNames::fromAttr | |
| 218 || attrName == SVGNames::toAttr | |
| 219 || attrName == SVGNames::calcModeAttr | |
| 220 || attrName == SVGNames::attributeTypeAttr | |
| 221 || attrName == SVGNames::keySplinesAttr | |
| 222 || attrName == SVGNames::keyPointsAttr | |
| 223 || attrName == SVGNames::keyTimesAttr) { | |
| 224 animationAttributeChanged(); | |
| 238 return; | 225 return; |
| 239 } | 226 } |
| 240 | 227 |
| 241 animationAttributeChanged(); | 228 SVGSMILElement::svgAttributeChanged(attrName); |
| 242 } | 229 } |
| 243 | 230 |
| 244 void SVGAnimationElement::animationAttributeChanged() | 231 void SVGAnimationElement::animationAttributeChanged() |
| 245 { | 232 { |
| 246 // Assumptions may not hold after an attribute change. | 233 // Assumptions may not hold after an attribute change. |
| 247 m_animationValid = false; | 234 m_animationValid = false; |
| 248 m_lastValuesAnimationFrom = String(); | 235 m_lastValuesAnimationFrom = String(); |
| 249 m_lastValuesAnimationTo = String(); | 236 m_lastValuesAnimationTo = String(); |
| 250 setInactive(); | 237 setInactive(); |
| 251 } | 238 } |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 if (!hasInvalidCSSAttributeType) | 713 if (!hasInvalidCSSAttributeType) |
| 727 schedule(); | 714 schedule(); |
| 728 } | 715 } |
| 729 | 716 |
| 730 // Clear values that may depend on the previous target. | 717 // Clear values that may depend on the previous target. |
| 731 if (targetElement()) | 718 if (targetElement()) |
| 732 clearAnimatedType(); | 719 clearAnimatedType(); |
| 733 } | 720 } |
| 734 | 721 |
| 735 } | 722 } |
| OLD | NEW |