Chromium Code Reviews| Index: Source/core/svg/SVGAnimationElement.cpp |
| diff --git a/Source/core/svg/SVGAnimationElement.cpp b/Source/core/svg/SVGAnimationElement.cpp |
| index a6681158c25c49ec0be2515c7ba144c262f7b72a..dfc9177b9de595210c4c1d349bd4677b4472fb28 100644 |
| --- a/Source/core/svg/SVGAnimationElement.cpp |
| +++ b/Source/core/svg/SVGAnimationElement.cpp |
| @@ -78,63 +78,51 @@ fail: |
| } |
| template<typename CharType> |
| -static void parseKeySplinesInternal(const String& string, Vector<UnitBezier>& result) |
| +static bool parseKeySplinesInternal(const String& string, Vector<UnitBezier>& result) |
| { |
| const CharType* ptr = string.getCharacters<CharType>(); |
| const CharType* end = ptr + string.length(); |
| skipOptionalSVGSpaces(ptr, end); |
| - bool delimParsed = false; |
| while (ptr < end) { |
| - delimParsed = false; |
| float posA = 0; |
| - if (!parseNumber(ptr, end, posA)) { |
| - result.clear(); |
| - return; |
| - } |
| + if (!parseNumber(ptr, end, posA)) |
| + return false; |
| float posB = 0; |
| - if (!parseNumber(ptr, end, posB)) { |
| - result.clear(); |
| - return; |
| - } |
| + if (!parseNumber(ptr, end, posB)) |
| + return false; |
| float posC = 0; |
| - if (!parseNumber(ptr, end, posC)) { |
| - result.clear(); |
| - return; |
| - } |
| + if (!parseNumber(ptr, end, posC)) |
| + return false; |
| float posD = 0; |
| - if (!parseNumber(ptr, end, posD, DisallowWhitespace)) { |
| - result.clear(); |
| - return; |
| - } |
| + if (!parseNumber(ptr, end, posD, DisallowWhitespace)) |
| + return false; |
| skipOptionalSVGSpaces(ptr, end); |
| - if (ptr < end && *ptr == ';') { |
| - delimParsed = true; |
| + if (ptr < end && *ptr == ';') |
| ptr++; |
| - } |
| skipOptionalSVGSpaces(ptr, end); |
| result.append(UnitBezier(posA, posB, posC, posD)); |
| } |
| - if (!(ptr == end && !delimParsed)) |
| - result.clear(); |
| + |
| + return ptr == end; |
| } |
| -static void parseKeySplines(const String& string, Vector<UnitBezier>& result) |
| +static bool parseKeySplines(const String& string, Vector<UnitBezier>& result) |
| { |
| result.clear(); |
| if (string.isEmpty()) |
| - return; |
| + return true; |
| if (string.is8Bit()) |
| - parseKeySplinesInternal<LChar>(string, result); |
| + return parseKeySplinesInternal<LChar>(string, result); |
| else |
| - parseKeySplinesInternal<UChar>(string, result); |
| + return parseKeySplinesInternal<UChar>(string, result); |
| } |
| bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) |
| @@ -188,7 +176,10 @@ void SVGAnimationElement::parseAttribute(const QualifiedName& name, const Atomic |
| } |
| if (name == SVGNames::keySplinesAttr) { |
| - parseKeySplines(value, m_keySplines); |
| + if (!parseKeySplines(value, m_keySplines)) { |
| + m_keySplines.clear(); |
|
pdr.
2014/09/18 19:19:05
Can you move the "m_keySplines.clear()" call into
|
| + reportAttributeParsingError(ParsingAttributeFailedError, name, value); |
| + } |
| return; |
| } |