Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1688)

Unified Diff: Source/core/svg/SVGAnimationElement.cpp

Issue 539383002: Handle semicolons at end of keySplines value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/svg/custom/script-tests/keySplines-parsing-error.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGAnimationElement.cpp
diff --git a/Source/core/svg/SVGAnimationElement.cpp b/Source/core/svg/SVGAnimationElement.cpp
index a6681158c25c49ec0be2515c7ba144c262f7b72a..3c98af35c7eceead84eec947cc95a26de95f52ef 100644
--- a/Source/core/svg/SVGAnimationElement.cpp
+++ b/Source/core/svg/SVGAnimationElement.cpp
@@ -78,63 +78,57 @@ 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;
+ bool parsed = true;
if (string.is8Bit())
- parseKeySplinesInternal<LChar>(string, result);
+ parsed = parseKeySplinesInternal<LChar>(string, result);
else
- parseKeySplinesInternal<UChar>(string, result);
+ parsed = parseKeySplinesInternal<UChar>(string, result);
+ if (!parsed) {
+ result.clear();
+ return false;
+ }
+ return true;
}
bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName)
@@ -188,7 +182,8 @@ void SVGAnimationElement::parseAttribute(const QualifiedName& name, const Atomic
}
if (name == SVGNames::keySplinesAttr) {
- parseKeySplines(value, m_keySplines);
+ if (!parseKeySplines(value, m_keySplines))
+ reportAttributeParsingError(ParsingAttributeFailedError, name, value);
return;
}
« no previous file with comments | « LayoutTests/svg/custom/script-tests/keySplines-parsing-error.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698