Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2002, 2003 The Karbon Developers | 2 * Copyright (C) 2002, 2003 The Karbon Developers |
| 3 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 typedef pair<unsigned, unsigned> UnicodeRange; | 29 typedef pair<unsigned, unsigned> UnicodeRange; |
| 30 typedef Vector<UnicodeRange> UnicodeRanges; | 30 typedef Vector<UnicodeRange> UnicodeRanges; |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class FloatPoint; | 34 class FloatPoint; |
| 35 class FloatRect; | 35 class FloatRect; |
| 36 class SVGPointList; | 36 class SVGPointList; |
| 37 | 37 |
| 38 enum WhitespaceParsing { | |
| 39 STRICT = 0, | |
| 40 ALLOW_LEADING = 0x1, | |
| 41 ALLOW_TRAILING = 0x2, | |
| 42 ALLOW_LEADING_AND_TRAILING = ALLOW_LEADING | ALLOW_TRAILING | |
| 43 }; | |
| 44 | |
| 38 template <typename CharType> | 45 template <typename CharType> |
| 39 bool parseSVGNumber(CharType* ptr, size_t length, double& number); | 46 bool parseSVGNumber(CharType* ptr, size_t length, double& number); |
| 40 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, bool skip = true); | 47 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, WhitespaceP arsing mode = ALLOW_LEADING_AND_TRAILING); |
| 41 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); | 48 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, WhitespaceP arsing mode = ALLOW_LEADING_AND_TRAILING); |
| 42 bool parseNumberOptionalNumber(const String& s, float& h, float& v); | 49 bool parseNumberOptionalNumber(const String& s, float& h, float& v); |
| 50 bool parseNumberOrPercentage(const String& s, float& number); | |
| 43 bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag); | 51 bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag); |
| 44 bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); | 52 bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); |
| 45 | 53 |
| 46 template <typename CharType> | 54 template <typename CharType> |
| 47 bool parseFloatPoint(const CharType*& current, const CharType* end, FloatPoint&) ; | 55 bool parseFloatPoint(const CharType*& current, const CharType* end, FloatPoint&) ; |
| 48 template <typename CharType> | 56 template <typename CharType> |
| 49 bool parseFloatPoint2(const CharType*& current, const CharType* end, FloatPoint& , FloatPoint&); | 57 bool parseFloatPoint2(const CharType*& current, const CharType* end, FloatPoint& , FloatPoint&); |
| 50 template <typename CharType> | 58 template <typename CharType> |
| 51 bool parseFloatPoint3(const CharType*& current, const CharType* end, FloatPoint& , FloatPoint&, FloatPoint&); | 59 bool parseFloatPoint3(const CharType*& current, const CharType* end, FloatPoint& , FloatPoint&, FloatPoint&); |
| 52 | 60 |
| 53 // SVG allows several different whitespace characters: | 61 // SVG allows several different whitespace characters: |
| 54 // http://www.w3.org/TR/SVG/paths.html#PathDataBNF | 62 // http://www.w3.org/TR/SVG/paths.html#PathDataBNF |
| 55 template <typename CharType> | 63 template <typename CharType> |
| 56 inline bool isSVGSpace(CharType c) | 64 inline bool isSVGSpace(CharType c) |
| 57 { | 65 { |
| 58 return c == ' ' || c == '\t' || c == '\n' || c == '\r'; | 66 return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'; |
|
pdr.
2014/06/02 14:35:19
This now matches isHTMLSpace(). Do we need both?
Erik Dahlström (inactive)
2014/06/04 16:25:43
Replaced all instances of isSVGSpace with isHTMLSp
| |
| 59 } | 67 } |
| 60 | 68 |
| 61 template <typename CharType> | 69 template <typename CharType> |
| 62 inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end) | 70 inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end) |
| 63 { | 71 { |
| 64 while (ptr < end && isSVGSpace(*ptr)) | 72 while (ptr < end && isSVGSpace(*ptr)) |
| 65 ptr++; | 73 ptr++; |
| 66 return ptr < end; | 74 return ptr < end; |
| 67 } | 75 } |
| 68 | 76 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 84 bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<Stri ng>& stringList); | 92 bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<Stri ng>& stringList); |
| 85 bool parseGlyphName(const String& input, HashSet<String>& values); | 93 bool parseGlyphName(const String& input, HashSet<String>& values); |
| 86 | 94 |
| 87 template<typename CharType> | 95 template<typename CharType> |
| 88 bool parseAndSkipTransformType(const CharType*& ptr, const CharType* end, SVGTra nsformType&); | 96 bool parseAndSkipTransformType(const CharType*& ptr, const CharType* end, SVGTra nsformType&); |
| 89 SVGTransformType parseTransformType(const String&); | 97 SVGTransformType parseTransformType(const String&); |
| 90 | 98 |
| 91 } // namespace WebCore | 99 } // namespace WebCore |
| 92 | 100 |
| 93 #endif // SVGParserUtilities_h | 101 #endif // SVGParserUtilities_h |
| OLD | NEW |