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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 goto fail; | 71 goto fail; |
| 72 } | 72 } |
| 73 result.append(time); | 73 result.append(time); |
| 74 } | 74 } |
| 75 return; | 75 return; |
| 76 fail: | 76 fail: |
| 77 result.clear(); | 77 result.clear(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 template<typename CharType> | 80 template<typename CharType> |
| 81 static void parseKeySplinesInternal(const String& string, Vector<UnitBezier>& re sult) | 81 static bool parseKeySplinesInternal(const String& string, Vector<UnitBezier>& re sult) |
| 82 { | 82 { |
| 83 const CharType* ptr = string.getCharacters<CharType>(); | 83 const CharType* ptr = string.getCharacters<CharType>(); |
| 84 const CharType* end = ptr + string.length(); | 84 const CharType* end = ptr + string.length(); |
| 85 | 85 |
| 86 skipOptionalSVGSpaces(ptr, end); | 86 skipOptionalSVGSpaces(ptr, end); |
| 87 | 87 |
| 88 bool delimParsed = false; | |
| 89 while (ptr < end) { | 88 while (ptr < end) { |
| 90 delimParsed = false; | |
| 91 float posA = 0; | 89 float posA = 0; |
| 92 if (!parseNumber(ptr, end, posA)) { | 90 if (!parseNumber(ptr, end, posA)) |
| 93 result.clear(); | 91 return false; |
| 94 return; | |
| 95 } | |
| 96 | 92 |
| 97 float posB = 0; | 93 float posB = 0; |
| 98 if (!parseNumber(ptr, end, posB)) { | 94 if (!parseNumber(ptr, end, posB)) |
| 99 result.clear(); | 95 return false; |
| 100 return; | |
| 101 } | |
| 102 | 96 |
| 103 float posC = 0; | 97 float posC = 0; |
| 104 if (!parseNumber(ptr, end, posC)) { | 98 if (!parseNumber(ptr, end, posC)) |
| 105 result.clear(); | 99 return false; |
| 106 return; | |
| 107 } | |
| 108 | 100 |
| 109 float posD = 0; | 101 float posD = 0; |
| 110 if (!parseNumber(ptr, end, posD, DisallowWhitespace)) { | 102 if (!parseNumber(ptr, end, posD, DisallowWhitespace)) |
| 111 result.clear(); | 103 return false; |
| 112 return; | |
| 113 } | |
| 114 | 104 |
| 115 skipOptionalSVGSpaces(ptr, end); | 105 skipOptionalSVGSpaces(ptr, end); |
| 116 | 106 |
| 117 if (ptr < end && *ptr == ';') { | 107 if (ptr < end && *ptr == ';') |
| 118 delimParsed = true; | |
| 119 ptr++; | 108 ptr++; |
| 120 } | |
| 121 skipOptionalSVGSpaces(ptr, end); | 109 skipOptionalSVGSpaces(ptr, end); |
| 122 | 110 |
| 123 result.append(UnitBezier(posA, posB, posC, posD)); | 111 result.append(UnitBezier(posA, posB, posC, posD)); |
| 124 } | 112 } |
| 125 if (!(ptr == end && !delimParsed)) | 113 |
| 126 result.clear(); | 114 return ptr == end; |
| 127 } | 115 } |
| 128 | 116 |
| 129 static void parseKeySplines(const String& string, Vector<UnitBezier>& result) | 117 static bool parseKeySplines(const String& string, Vector<UnitBezier>& result) |
| 130 { | 118 { |
| 131 result.clear(); | 119 result.clear(); |
| 132 if (string.isEmpty()) | 120 if (string.isEmpty()) |
| 133 return; | 121 return true; |
| 134 if (string.is8Bit()) | 122 if (string.is8Bit()) |
| 135 parseKeySplinesInternal<LChar>(string, result); | 123 return parseKeySplinesInternal<LChar>(string, result); |
| 136 else | 124 else |
| 137 parseKeySplinesInternal<UChar>(string, result); | 125 return parseKeySplinesInternal<UChar>(string, result); |
| 138 } | 126 } |
| 139 | 127 |
| 140 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) | 128 bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) |
| 141 { | 129 { |
| 142 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 130 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 143 if (supportedAttributes.isEmpty()) { | 131 if (supportedAttributes.isEmpty()) { |
| 144 supportedAttributes.add(SVGNames::valuesAttr); | 132 supportedAttributes.add(SVGNames::valuesAttr); |
| 145 supportedAttributes.add(SVGNames::keyTimesAttr); | 133 supportedAttributes.add(SVGNames::keyTimesAttr); |
| 146 supportedAttributes.add(SVGNames::keyPointsAttr); | 134 supportedAttributes.add(SVGNames::keyPointsAttr); |
| 147 supportedAttributes.add(SVGNames::keySplinesAttr); | 135 supportedAttributes.add(SVGNames::keySplinesAttr); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 if (name == SVGNames::keyPointsAttr) { | 169 if (name == SVGNames::keyPointsAttr) { |
| 182 if (isSVGAnimateMotionElement(*this)) { | 170 if (isSVGAnimateMotionElement(*this)) { |
| 183 // This is specified to be an animateMotion attribute only but it is simpler to put it here | 171 // This is specified to be an animateMotion attribute only but it is simpler to put it here |
| 184 // where the other timing calculatations are. | 172 // where the other timing calculatations are. |
| 185 parseKeyTimes(value, m_keyPoints, false); | 173 parseKeyTimes(value, m_keyPoints, false); |
| 186 } | 174 } |
| 187 return; | 175 return; |
| 188 } | 176 } |
| 189 | 177 |
| 190 if (name == SVGNames::keySplinesAttr) { | 178 if (name == SVGNames::keySplinesAttr) { |
| 191 parseKeySplines(value, m_keySplines); | 179 if (!parseKeySplines(value, m_keySplines)) { |
| 180 m_keySplines.clear(); | |
|
pdr.
2014/09/18 19:19:05
Can you move the "m_keySplines.clear()" call into
| |
| 181 reportAttributeParsingError(ParsingAttributeFailedError, name, value ); | |
| 182 } | |
| 192 return; | 183 return; |
| 193 } | 184 } |
| 194 | 185 |
| 195 if (name == SVGNames::attributeTypeAttr) { | 186 if (name == SVGNames::attributeTypeAttr) { |
| 196 setAttributeType(value); | 187 setAttributeType(value); |
| 197 return; | 188 return; |
| 198 } | 189 } |
| 199 | 190 |
| 200 if (name == SVGNames::calcModeAttr) { | 191 if (name == SVGNames::calcModeAttr) { |
| 201 setCalcMode(value); | 192 setCalcMode(value); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 SVGSMILElement::setAttributeName(attributeName); | 678 SVGSMILElement::setAttributeName(attributeName); |
| 688 checkInvalidCSSAttributeType(targetElement()); | 679 checkInvalidCSSAttributeType(targetElement()); |
| 689 } | 680 } |
| 690 | 681 |
| 691 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) | 682 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) |
| 692 { | 683 { |
| 693 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa me()); | 684 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa me()); |
| 694 } | 685 } |
| 695 | 686 |
| 696 } | 687 } |
| OLD | NEW |