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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGParserUtilities.h

Issue 1667353003: Error reporting for number-or-percentage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 enum WhitespaceMode { 29 enum WhitespaceMode {
30 DisallowWhitespace = 0, 30 DisallowWhitespace = 0,
31 AllowLeadingWhitespace = 0x1, 31 AllowLeadingWhitespace = 0x1,
32 AllowTrailingWhitespace = 0x2, 32 AllowTrailingWhitespace = 0x2,
33 AllowLeadingAndTrailingWhitespace = AllowLeadingWhitespace | AllowTrailingWh itespace 33 AllowLeadingAndTrailingWhitespace = AllowLeadingWhitespace | AllowTrailingWh itespace
34 }; 34 };
35 35
36 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, WhitespaceM ode = AllowLeadingAndTrailingWhitespace); 36 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, WhitespaceM ode = AllowLeadingAndTrailingWhitespace);
37 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, WhitespaceM ode = AllowLeadingAndTrailingWhitespace); 37 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, WhitespaceM ode = AllowLeadingAndTrailingWhitespace);
38 bool parseNumberOptionalNumber(const String& s, float& h, float& v); 38 bool parseNumberOptionalNumber(const String& s, float& h, float& v);
39 bool parseNumberOrPercentage(const String& s, float& number);
40 bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag); 39 bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag);
41 bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); 40 bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
42 41
43 template <typename CharType> 42 template <typename CharType>
44 inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end) 43 inline bool skipOptionalSVGSpaces(const CharType*& ptr, const CharType* end)
45 { 44 {
46 while (ptr < end && isHTMLSpace<CharType>(*ptr)) 45 while (ptr < end && isHTMLSpace<CharType>(*ptr))
47 ptr++; 46 ptr++;
48 return ptr < end; 47 return ptr < end;
49 } 48 }
50 49
51 template <typename CharType> 50 template <typename CharType>
52 inline bool skipOptionalSVGSpacesOrDelimiter(const CharType*& ptr, const CharTyp e* end, char delimiter = ',') 51 inline bool skipOptionalSVGSpacesOrDelimiter(const CharType*& ptr, const CharTyp e* end, char delimiter = ',')
53 { 52 {
54 if (ptr < end && !isHTMLSpace<CharType>(*ptr) && *ptr != delimiter) 53 if (ptr < end && !isHTMLSpace<CharType>(*ptr) && *ptr != delimiter)
55 return false; 54 return false;
56 if (skipOptionalSVGSpaces(ptr, end)) { 55 if (skipOptionalSVGSpaces(ptr, end)) {
57 if (ptr < end && *ptr == delimiter) { 56 if (ptr < end && *ptr == delimiter) {
58 ptr++; 57 ptr++;
59 skipOptionalSVGSpaces(ptr, end); 58 skipOptionalSVGSpaces(ptr, end);
60 } 59 }
61 } 60 }
62 return ptr < end; 61 return ptr < end;
63 } 62 }
64 63
65 } // namespace blink 64 } // namespace blink
66 65
67 #endif // SVGParserUtilities_h 66 #endif // SVGParserUtilities_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGNumber.cpp ('k') | third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698