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

Side by Side Diff: Source/core/css/parser/CSSParserImpl.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
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/CSSParserImpl.h" 6 #include "core/css/parser/CSSParserImpl.h"
7 7
8 #include "core/css/CSSKeyframesRule.h" 8 #include "core/css/CSSKeyframesRule.h"
9 #include "core/css/CSSStyleSheet.h" 9 #include "core/css/CSSStyleSheet.h"
10 #include "core/css/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 while (!range.atEnd()) { 152 while (!range.atEnd()) {
153 switch (range.peek().type()) { 153 switch (range.peek().type()) {
154 case WhitespaceToken: 154 case WhitespaceToken:
155 case CommentToken: 155 case CommentToken:
156 range.consumeWhitespaceAndComments(); 156 range.consumeWhitespaceAndComments();
157 break; 157 break;
158 case AtKeywordToken: 158 case AtKeywordToken:
159 if (PassRefPtrWillBeRawPtr<StyleRuleBase> rule = consumeAtRule(range , allowedRules)) 159 if (PassRefPtrWillBeRawPtr<StyleRuleBase> rule = consumeAtRule(range , allowedRules))
160 result.append(rule); 160 result.append(rule);
161 break; 161 break;
162 case CDOToken:
163 case CDCToken:
164 if (ruleListType == TopLevelRuleList) {
165 range.consume();
166 break;
167 }
168 // fallthrough
162 default: 169 default:
163 // FIXME: TopLevelRuleList should skip <CDO-token> and <CDC-token>
164 if (PassRefPtrWillBeRawPtr<StyleRuleBase> rule = consumeQualifiedRul e(range, allowedRules)) 170 if (PassRefPtrWillBeRawPtr<StyleRuleBase> rule = consumeQualifiedRul e(range, allowedRules))
165 result.append(rule); 171 result.append(rule);
166 break; 172 break;
167 } 173 }
168 } 174 }
169 175
170 return result; 176 return result;
171 } 177 }
172 178
173 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParserImpl::consumeAtRule(CSSParserToke nRange& range, AllowedRulesType& allowedRules) 179 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParserImpl::consumeAtRule(CSSParserToke nRange& range, AllowedRulesType& allowedRules)
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 else 474 else
469 return nullptr; // Parser error, invalid value in keyframe selector 475 return nullptr; // Parser error, invalid value in keyframe selector
470 if (range.atEnd()) 476 if (range.atEnd())
471 return result.release(); 477 return result.release();
472 if (range.consume().type() != CommaToken) 478 if (range.consume().type() != CommaToken)
473 return nullptr; // Parser error 479 return nullptr; // Parser error
474 } 480 }
475 } 481 }
476 482
477 } // namespace blink 483 } // namespace blink
OLDNEW
« no previous file with comments | « Source/build/scripts/make_css_tokenizer_codepoints.py ('k') | Source/core/css/parser/CSSParserToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698