Index: Source/core/svg/SVGAngle.cpp |
diff --git a/Source/core/svg/SVGAngle.cpp b/Source/core/svg/SVGAngle.cpp |
index 7e91ef5049b310d911a361c838d39a01af558d6f..3916118024492aa1127b6e37f7b2386bb832c463 100644 |
--- a/Source/core/svg/SVGAngle.cpp |
+++ b/Source/core/svg/SVGAngle.cpp |
@@ -157,14 +157,14 @@ static SVGAngle::SVGAngleType stringToAngleType(const CharType*& ptr, const Char |
// If the unit contains only one character, the angle type is unknown. |
++ptr; |
if (ptr == end) |
- return SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
+ return isSVGSpace(firstChar) ? SVGAngle::SVG_ANGLETYPE_UNSPECIFIED : SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
const CharType secondChar = *ptr; |
// If the unit contains only two characters, the angle type is unknown. |
++ptr; |
if (ptr == end) |
- return SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
+ return isSVGSpace(firstChar) && isSVGSpace(secondChar) ? SVGAngle::SVG_ANGLETYPE_UNSPECIFIED : SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
const CharType thirdChar = *ptr; |
if (firstChar == 'd' && secondChar == 'e' && thirdChar == 'g') |
@@ -175,12 +175,23 @@ static SVGAngle::SVGAngleType stringToAngleType(const CharType*& ptr, const Char |
// If the unit contains three characters, but is not deg or rad, then it's unknown. |
pdr.
2014/06/02 14:35:19
Can you update these comments to say something lik
Erik Dahlström (inactive)
2014/06/04 16:25:43
I went with a rewrite to hopefully make it more cl
|
++ptr; |
if (ptr == end) |
- return SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
+ return isSVGSpace(firstChar) && isSVGSpace(secondChar) && isSVGSpace(thirdChar) ? SVGAngle::SVG_ANGLETYPE_UNSPECIFIED : SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
const CharType fourthChar = *ptr; |
if (firstChar == 'g' && secondChar == 'r' && thirdChar == 'a' && fourthChar == 'd') |
return SVGAngle::SVG_ANGLETYPE_GRAD; |
+ if (firstChar == 't' && secondChar == 'u' && thirdChar == 'r' && fourthChar == 'n') |
+ return SVGAngle::SVG_ANGLETYPE_TURN; |
+ |
+ if (isSVGSpace(firstChar) |
+ && isSVGSpace(secondChar) |
+ && isSVGSpace(thirdChar) |
+ && isSVGSpace(fourthChar)) { |
+ skipOptionalSVGSpaces(++ptr, end); |
+ if (ptr == end) |
+ return SVGAngle::SVG_ANGLETYPE_UNSPECIFIED; |
+ } |
return SVGAngle::SVG_ANGLETYPE_UNKNOWN; |
} |
@@ -215,7 +226,7 @@ static bool parseValue(const String& value, float& valueInSpecifiedUnits, SVGAng |
const CharType* ptr = value.getCharacters<CharType>(); |
const CharType* end = ptr + value.length(); |
- if (!parseNumber(ptr, end, valueInSpecifiedUnits, false)) |
+ if (!parseNumber(ptr, end, valueInSpecifiedUnits, ALLOW_LEADING)) |
return false; |
unitType = stringToAngleType(ptr, end); |