Index: Source/core/svg/SVGParserUtilities.h |
diff --git a/Source/core/svg/SVGParserUtilities.h b/Source/core/svg/SVGParserUtilities.h |
index 8702e79a40fef900d02f9a5b304bf44b27aec1e2..6e2e423b1c24853051d320577abd82dd32a039fc 100644 |
--- a/Source/core/svg/SVGParserUtilities.h |
+++ b/Source/core/svg/SVGParserUtilities.h |
@@ -22,7 +22,6 @@ |
#ifndef SVGParserUtilities_h |
#define SVGParserUtilities_h |
-#include "core/html/parser/HTMLParserIdioms.h" |
#include "core/svg/SVGTransform.h" |
#include "platform/text/ParserUtilities.h" |
#include "wtf/HashSet.h" |
@@ -36,19 +35,11 @@ class FloatPoint; |
class FloatRect; |
class SVGPointList; |
-enum WhitespaceMode { |
- DisallowWhitespace = 0, |
- AllowLeadingWhitespace = 0x1, |
- AllowTrailingWhitespace = 0x2, |
- AllowLeadingAndTrailingWhitespace = AllowLeadingWhitespace | AllowTrailingWhitespace |
-}; |
- |
template <typename CharType> |
bool parseSVGNumber(CharType* ptr, size_t length, double& number); |
-bool parseNumber(const LChar*& ptr, const LChar* end, float& number, WhitespaceMode = AllowLeadingAndTrailingWhitespace); |
-bool parseNumber(const UChar*& ptr, const UChar* end, float& number, WhitespaceMode = AllowLeadingAndTrailingWhitespace); |
+bool parseNumber(const LChar*& ptr, const LChar* end, float& number, bool skip = true); |
+bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); |
bool parseNumberOptionalNumber(const String& s, float& h, float& v); |
-bool parseNumberOrPercentage(const String& s, float& number); |
bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag); |
bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); |
@@ -59,10 +50,18 @@ bool parseFloatPoint2(const CharType*& current, const CharType* end, FloatPoint& |
template <typename CharType> |
bool parseFloatPoint3(const CharType*& current, const CharType* end, FloatPoint&, FloatPoint&, FloatPoint&); |
+// SVG allows several different whitespace characters: |
+// http://www.w3.org/TR/SVG/paths.html#PathDataBNF |
+template <typename CharType> |
+inline bool isSVGSpace(CharType c) |
+{ |
+ return c == ' ' || c == '\t' || c == '\n' || c == '\r'; |
+} |
+ |
template <typename CharType> |
inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end) |
{ |
- while (ptr < end && isHTMLSpace<CharType>(*ptr)) |
+ while (ptr < end && isSVGSpace(*ptr)) |
ptr++; |
return ptr < end; |
} |
@@ -70,7 +69,7 @@ inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end) |
template <typename CharType> |
inline bool skipOptionalSVGSpacesOrDelimiter(const CharType*& ptr, const CharType* end, char delimiter = ',') |
{ |
- if (ptr < end && !isHTMLSpace<CharType>(*ptr) && *ptr != delimiter) |
+ if (ptr < end && !isSVGSpace(*ptr) && *ptr != delimiter) |
return false; |
if (skipOptionalSVGSpaces(ptr, end)) { |
if (ptr < end && *ptr == delimiter) { |