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 CSSParserTokenRange_h | 5 #ifndef CSSParserTokenRange_h |
6 #define CSSParserTokenRange_h | 6 #define CSSParserTokenRange_h |
7 | 7 |
8 #include "core/css/parser/CSSParserToken.h" | 8 #include "core/css/parser/CSSParserToken.h" |
9 #include "wtf/Vector.h" | 9 #include "wtf/Vector.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 return *(m_first + offset); | 36 return *(m_first + offset); |
37 } | 37 } |
38 | 38 |
39 const CSSParserToken& consume() | 39 const CSSParserToken& consume() |
40 { | 40 { |
41 if (m_first == m_last) | 41 if (m_first == m_last) |
42 return staticEOFToken; | 42 return staticEOFToken; |
43 return *m_first++; | 43 return *m_first++; |
44 } | 44 } |
45 | 45 |
| 46 const CSSParserToken& consumeIncludingComments() |
| 47 { |
| 48 const CSSParserToken& result = consume(); |
| 49 while (peek().type() == CommentToken) |
| 50 ++m_first; |
| 51 return result; |
| 52 } |
| 53 |
| 54 const CSSParserToken& consumeIncludingWhitespaceAndComments() |
| 55 { |
| 56 const CSSParserToken& result = consume(); |
| 57 consumeWhitespaceAndComments(); |
| 58 return result; |
| 59 } |
| 60 |
46 void consumeComponentValue(); | 61 void consumeComponentValue(); |
47 void consumeWhitespaceAndComments(); | 62 void consumeWhitespaceAndComments(); |
48 | 63 |
49 static void initStaticEOFToken(); | 64 static void initStaticEOFToken(); |
50 | 65 |
51 private: | 66 private: |
52 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last) | 67 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last) |
53 : m_first(first) | 68 : m_first(first) |
54 , m_last(last) | 69 , m_last(last) |
55 { } | 70 { } |
56 | 71 |
57 const CSSParserToken* m_first; | 72 const CSSParserToken* m_first; |
58 const CSSParserToken* m_last; | 73 const CSSParserToken* m_last; |
59 }; | 74 }; |
60 | 75 |
61 } // namespace | 76 } // namespace |
62 | 77 |
63 #endif // CSSParserTokenRange_h | 78 #endif // CSSParserTokenRange_h |
OLD | NEW |