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

Side by Side Diff: Source/core/css/parser/CSSTokenizer.cpp

Issue 825063004: CSS Parser: Support CDO and CDC tokens (<!--, -->) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@lang
Patch Set: Created 5 years, 11 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
« no previous file with comments | « Source/core/css/parser/CSSTokenizer.h ('k') | Source/core/css/parser/CSSTokenizerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSTokenizer.h" 6 #include "core/css/parser/CSSTokenizer.h"
7 7
8 namespace blink { 8 namespace blink {
9 #include "core/CSSTokenizerCodepoints.cpp" 9 #include "core/CSSTokenizerCodepoints.cpp"
10 } 10 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 CSSParserToken CSSTokenizer::asterisk(UChar cc) 143 CSSParserToken CSSTokenizer::asterisk(UChar cc)
144 { 144 {
145 ASSERT(cc == '*'); 145 ASSERT(cc == '*');
146 if (consumeIfNext('=')) 146 if (consumeIfNext('='))
147 return CSSParserToken(SubstringMatchToken); 147 return CSSParserToken(SubstringMatchToken);
148 return CSSParserToken(DelimiterToken, '*'); 148 return CSSParserToken(DelimiterToken, '*');
149 } 149 }
150 150
151 CSSParserToken CSSTokenizer::lessThan(UChar cc)
152 {
153 ASSERT(cc == '<');
154 if (m_input.peek(0) == '!' && m_input.peek(1) == '-' && m_input.peek(2) == ' -') {
155 consume(3);
156 return CSSParserToken(CDOToken);
157 }
158 return CSSParserToken(DelimiterToken, '<');
159 }
160
151 CSSParserToken CSSTokenizer::comma(UChar cc) 161 CSSParserToken CSSTokenizer::comma(UChar cc)
152 { 162 {
153 return CSSParserToken(CommaToken); 163 return CSSParserToken(CommaToken);
154 } 164 }
155 165
156 CSSParserToken CSSTokenizer::hyphenMinus(UChar cc) 166 CSSParserToken CSSTokenizer::hyphenMinus(UChar cc)
157 { 167 {
158 if (nextCharsAreNumber(cc)) { 168 if (nextCharsAreNumber(cc)) {
159 reconsume(cc); 169 reconsume(cc);
160 return consumeNumericToken(); 170 return consumeNumericToken();
161 } 171 }
172 if (m_input.peek(0) == '-' && m_input.peek(1) == '>') {
173 consume(2);
174 return CSSParserToken(CDCToken);
175 }
162 if (nextCharsAreIdentifier(cc)) { 176 if (nextCharsAreIdentifier(cc)) {
163 reconsume(cc); 177 reconsume(cc);
164 return consumeIdentLikeToken(); 178 return consumeIdentLikeToken();
165 } 179 }
166 return CSSParserToken(DelimiterToken, cc); 180 return CSSParserToken(DelimiterToken, cc);
167 } 181 }
168 182
169 CSSParserToken CSSTokenizer::solidus(UChar cc) 183 CSSParserToken CSSTokenizer::solidus(UChar cc)
170 { 184 {
171 if (consumeIfNext('*')) { 185 if (consumeIfNext('*')) {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 707
694 bool CSSTokenizer::nextCharsAreIdentifier() 708 bool CSSTokenizer::nextCharsAreIdentifier()
695 { 709 {
696 UChar first = consume(); 710 UChar first = consume();
697 bool areIdentifier = nextCharsAreIdentifier(first); 711 bool areIdentifier = nextCharsAreIdentifier(first);
698 reconsume(first); 712 reconsume(first);
699 return areIdentifier; 713 return areIdentifier;
700 } 714 }
701 715
702 } // namespace blink 716 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSTokenizer.h ('k') | Source/core/css/parser/CSSTokenizerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698