OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CSSTokenizer_h | 5 #ifndef CSSTokenizer_h |
6 #define CSSTokenizer_h | 6 #define CSSTokenizer_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/css/parser/CSSParserToken.h" | 9 #include "core/css/parser/CSSParserToken.h" |
10 #include "core/html/parser/InputStreamPreprocessor.h" | 10 #include "core/html/parser/InputStreamPreprocessor.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 #include "wtf/text/StringView.h" |
12 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
13 | 14 |
14 #include <climits> | 15 #include <climits> |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 class CSSTokenizerInputStream; | 19 class CSSTokenizerInputStream; |
19 class CSSParserObserverWrapper; | 20 class CSSParserObserverWrapper; |
20 struct CSSParserString; | |
21 class CSSParserTokenRange; | 21 class CSSParserTokenRange; |
22 | 22 |
23 class CORE_EXPORT CSSTokenizer { | 23 class CORE_EXPORT CSSTokenizer { |
24 WTF_MAKE_NONCOPYABLE(CSSTokenizer); | 24 WTF_MAKE_NONCOPYABLE(CSSTokenizer); |
25 USING_FAST_MALLOC(CSSTokenizer); | 25 USING_FAST_MALLOC(CSSTokenizer); |
26 public: | 26 public: |
27 class CORE_EXPORT Scope { | 27 class CORE_EXPORT Scope { |
28 DISALLOW_NEW(); | 28 DISALLOW_NEW(); |
29 public: | 29 public: |
30 Scope(const String&); | 30 Scope(const String&); |
(...skipping 27 matching lines...) Expand all Loading... |
58 CSSParserToken consumeStringTokenUntil(UChar); | 58 CSSParserToken consumeStringTokenUntil(UChar); |
59 CSSParserToken consumeUnicodeRange(); | 59 CSSParserToken consumeUnicodeRange(); |
60 CSSParserToken consumeUrlToken(); | 60 CSSParserToken consumeUrlToken(); |
61 | 61 |
62 void consumeBadUrlRemnants(); | 62 void consumeBadUrlRemnants(); |
63 void consumeUntilNonWhitespace(); | 63 void consumeUntilNonWhitespace(); |
64 void consumeSingleWhitespaceIfNext(); | 64 void consumeSingleWhitespaceIfNext(); |
65 void consumeUntilCommentEndFound(); | 65 void consumeUntilCommentEndFound(); |
66 | 66 |
67 bool consumeIfNext(UChar); | 67 bool consumeIfNext(UChar); |
68 CSSParserString consumeName(); | 68 StringView consumeName(); |
69 UChar32 consumeEscape(); | 69 UChar32 consumeEscape(); |
70 | 70 |
71 bool nextTwoCharsAreValidEscape(); | 71 bool nextTwoCharsAreValidEscape(); |
72 bool nextCharsAreNumber(UChar); | 72 bool nextCharsAreNumber(UChar); |
73 bool nextCharsAreNumber(); | 73 bool nextCharsAreNumber(); |
74 bool nextCharsAreIdentifier(UChar); | 74 bool nextCharsAreIdentifier(UChar); |
75 bool nextCharsAreIdentifier(); | 75 bool nextCharsAreIdentifier(); |
76 CSSParserToken blockStart(CSSParserTokenType); | 76 CSSParserToken blockStart(CSSParserTokenType); |
77 CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType,
CSSParserString); | 77 CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType,
StringView); |
78 CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType); | 78 CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType); |
79 | 79 |
80 using CodePoint = CSSParserToken (CSSTokenizer::*)(UChar); | 80 using CodePoint = CSSParserToken (CSSTokenizer::*)(UChar); |
81 | 81 |
82 static const CodePoint codePoints[]; | 82 static const CodePoint codePoints[]; |
83 Vector<CSSParserTokenType> m_blockStack; | 83 Vector<CSSParserTokenType> m_blockStack; |
84 | 84 |
85 CSSParserToken whiteSpace(UChar); | 85 CSSParserToken whiteSpace(UChar); |
86 CSSParserToken leftParenthesis(UChar); | 86 CSSParserToken leftParenthesis(UChar); |
87 CSSParserToken rightParenthesis(UChar); | 87 CSSParserToken rightParenthesis(UChar); |
(...skipping 15 matching lines...) Expand all Loading... |
103 CSSParserToken verticalLine(UChar); | 103 CSSParserToken verticalLine(UChar); |
104 CSSParserToken tilde(UChar); | 104 CSSParserToken tilde(UChar); |
105 CSSParserToken commercialAt(UChar); | 105 CSSParserToken commercialAt(UChar); |
106 CSSParserToken reverseSolidus(UChar); | 106 CSSParserToken reverseSolidus(UChar); |
107 CSSParserToken asciiDigit(UChar); | 107 CSSParserToken asciiDigit(UChar); |
108 CSSParserToken letterU(UChar); | 108 CSSParserToken letterU(UChar); |
109 CSSParserToken nameStart(UChar); | 109 CSSParserToken nameStart(UChar); |
110 CSSParserToken stringStart(UChar); | 110 CSSParserToken stringStart(UChar); |
111 CSSParserToken endOfFile(UChar); | 111 CSSParserToken endOfFile(UChar); |
112 | 112 |
113 CSSParserString registerString(const String&); | 113 StringView registerString(const String&); |
114 | 114 |
115 CSSTokenizerInputStream& m_input; | 115 CSSTokenizerInputStream& m_input; |
116 Scope& m_scope; | 116 Scope& m_scope; |
117 }; | 117 }; |
118 | 118 |
119 | 119 |
120 | 120 |
121 } // namespace blink | 121 } // namespace blink |
122 | 122 |
123 #endif // CSSTokenizer_h | 123 #endif // CSSTokenizer_h |
OLD | NEW |