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

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

Issue 790593004: CSS Parser: Implement selector parsing [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years 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/core.gypi ('k') | Source/core/css/parser/CSSParserTokenRange.h » ('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/CSSParser.h" 6 #include "core/css/parser/CSSParser.h"
7 7
8 #include "core/css/CSSKeyframeRule.h" 8 #include "core/css/CSSKeyframeRule.h"
9 #include "core/css/StyleColor.h" 9 #include "core/css/StyleColor.h"
10 #include "core/css/StyleRule.h" 10 #include "core/css/StyleRule.h"
11 #include "core/css/StyleSheetContents.h" 11 #include "core/css/StyleSheetContents.h"
12 #include "core/css/parser/CSSParserFastPaths.h" 12 #include "core/css/parser/CSSParserFastPaths.h"
13 #include "core/css/parser/CSSParserImpl.h" 13 #include "core/css/parser/CSSParserImpl.h"
14 #include "core/css/parser/CSSSelectorParser.h"
15 #include "core/css/parser/CSSTokenizer.h"
14 16
15 namespace blink { 17 namespace blink {
16 18
17 CSSParser::CSSParser(const CSSParserContext& context) 19 CSSParser::CSSParser(const CSSParserContext& context)
18 : m_bisonParser(context) 20 : m_bisonParser(context)
19 { 21 {
20 } 22 }
21 23
22 bool CSSParser::parseDeclaration(MutableStylePropertySet* propertySet, const Str ing& declaration, CSSParserObserver* observer, StyleSheetContents* styleSheet) 24 bool CSSParser::parseDeclaration(MutableStylePropertySet* propertySet, const Str ing& declaration, CSSParserObserver* observer, StyleSheetContents* styleSheet)
23 { 25 {
24 // FIXME: Add inspector observer support in the new CSS parser 26 // FIXME: Add inspector observer support in the new CSS parser
25 if (!observer && RuntimeEnabledFeatures::newCSSParserEnabled()) 27 if (!observer && RuntimeEnabledFeatures::newCSSParserEnabled())
26 return CSSParserImpl::parseDeclaration(propertySet, declaration, m_bison Parser.m_context); 28 return CSSParserImpl::parseDeclaration(propertySet, declaration, m_bison Parser.m_context);
27 return m_bisonParser.parseDeclaration(propertySet, declaration, observer, st yleSheet); 29 return m_bisonParser.parseDeclaration(propertySet, declaration, observer, st yleSheet);
28 } 30 }
29 31
30 void CSSParser::parseSelector(const String& selector, CSSSelectorList& selectorL ist) 32 void CSSParser::parseSelector(const String& selector, CSSSelectorList& selectorL ist)
31 { 33 {
34 if (RuntimeEnabledFeatures::newCSSParserEnabled()) {
35 Vector<CSSParserToken> tokens;
36 CSSTokenizer::tokenize(selector, tokens);
37 CSSSelectorParser::parseSelector(tokens, m_bisonParser.m_context, select orList);
38 return;
39 }
32 m_bisonParser.parseSelector(selector, selectorList); 40 m_bisonParser.parseSelector(selector, selectorList);
33 } 41 }
34 42
35 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule) 43 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule)
36 { 44 {
37 return BisonCSSParser(context).parseRule(styleSheet, rule); 45 return BisonCSSParser(context).parseRule(styleSheet, rule);
38 } 46 }
39 47
40 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text, const TextPosition& startPosition, CSSParserObse rver* observer, bool logErrors) 48 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text, const TextPosition& startPosition, CSSParserObse rver* observer, bool logErrors)
41 { 49 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 { 120 {
113 return BisonCSSParser::colorFromRGBColorString(string); 121 return BisonCSSParser::colorFromRGBColorString(string);
114 } 122 }
115 123
116 bool CSSParser::parseSystemColor(RGBA32& color, const String& colorString) 124 bool CSSParser::parseSystemColor(RGBA32& color, const String& colorString)
117 { 125 {
118 return BisonCSSParser::parseSystemColor(color, colorString); 126 return BisonCSSParser::parseSystemColor(color, colorString);
119 } 127 }
120 128
121 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/parser/CSSParserTokenRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698