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

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

Issue 1182933004: Split up inspector interfaces to CSSParser::parse(Sheet/DeclarationList) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/CSSParser.h ('k') | Source/core/css/parser/CSSParserImpl.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/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/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
11 #include "core/css/StyleRule.h" 11 #include "core/css/StyleRule.h"
12 #include "core/css/StyleSheetContents.h" 12 #include "core/css/StyleSheetContents.h"
13 #include "core/css/parser/CSSParserFastPaths.h" 13 #include "core/css/parser/CSSParserFastPaths.h"
14 #include "core/css/parser/CSSParserImpl.h" 14 #include "core/css/parser/CSSParserImpl.h"
15 #include "core/css/parser/CSSPropertyParser.h" 15 #include "core/css/parser/CSSPropertyParser.h"
16 #include "core/css/parser/CSSSelectorParser.h" 16 #include "core/css/parser/CSSSelectorParser.h"
17 #include "core/css/parser/CSSSupportsParser.h" 17 #include "core/css/parser/CSSSupportsParser.h"
18 #include "core/css/parser/CSSTokenizer.h" 18 #include "core/css/parser/CSSTokenizer.h"
19 #include "core/layout/LayoutTheme.h" 19 #include "core/layout/LayoutTheme.h"
20 20
21 namespace blink { 21 namespace blink {
22 22
23 bool CSSParser::parseDeclarationList(const CSSParserContext& context, MutableSty lePropertySet* propertySet, const String& declaration, CSSParserObserver* observ er) 23 bool CSSParser::parseDeclarationList(const CSSParserContext& context, MutableSty lePropertySet* propertySet, const String& declaration)
24 { 24 {
25 if (observer) {
26 CSSParserImpl::parseDeclarationListForInspector(declaration, context, *o bserver);
27 return true;
28 }
29 return CSSParserImpl::parseDeclarationList(propertySet, declaration, context ); 25 return CSSParserImpl::parseDeclarationList(propertySet, declaration, context );
30 } 26 }
31 27
28 void CSSParser::parseDeclarationListForInspector(const CSSParserContext& context , const String& declaration, CSSParserObserver& observer)
29 {
30 CSSParserImpl::parseDeclarationListForInspector(declaration, context, observ er);
31 }
32
32 void CSSParser::parseSelector(const CSSParserContext& context, const String& sel ector, CSSSelectorList& selectorList) 33 void CSSParser::parseSelector(const CSSParserContext& context, const String& sel ector, CSSSelectorList& selectorList)
33 { 34 {
34 CSSTokenizer::Scope scope(selector); 35 CSSTokenizer::Scope scope(selector);
35 CSSSelectorParser::parseSelector(scope.tokenRange(), context, starAtom, null ptr, selectorList); 36 CSSSelectorParser::parseSelector(scope.tokenRange(), context, starAtom, null ptr, selectorList);
36 } 37 }
37 38
38 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, const String& rule) 39 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, const String& rule)
39 { 40 {
40 return CSSParserImpl::parseRule(rule, context, CSSParserImpl::AllowImportRul es); 41 return CSSParserImpl::parseRule(rule, context, CSSParserImpl::AllowImportRul es);
41 } 42 }
42 43
43 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text, CSSParserObserver* observer) 44 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text)
44 { 45 {
45 if (observer)
46 return CSSParserImpl::parseStyleSheetForInspector(text, context, *observ er);
47 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); 46 return CSSParserImpl::parseStyleSheet(text, context, styleSheet);
48 } 47 }
49 48
49 void CSSParser::parseSheetForInspector(const CSSParserContext& context, const St ring& text, CSSParserObserver& observer)
50 {
51 return CSSParserImpl::parseStyleSheetForInspector(text, context, observer);
52 }
53
50 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u nresolvedProperty, const String& string, bool important, CSSParserMode parserMod e, StyleSheetContents* styleSheet) 54 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID u nresolvedProperty, const String& string, bool important, CSSParserMode parserMod e, StyleSheetContents* styleSheet)
51 { 55 {
52 if (string.isEmpty()) 56 if (string.isEmpty())
53 return false; 57 return false;
54 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); 58 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
55 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(res olvedProperty, string, parserMode); 59 RefPtrWillBeRawPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(res olvedProperty, string, parserMode);
56 if (value) 60 if (value)
57 return declaration->setProperty(CSSProperty(resolvedProperty, value.rele ase(), important)); 61 return declaration->setProperty(CSSProperty(resolvedProperty, value.rele ase(), important));
58 CSSParserContext context(parserMode, 0); 62 CSSParserContext context(parserMode, 0);
59 if (styleSheet) { 63 if (styleSheet) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 builder.appendLiteral(" : "); 166 builder.appendLiteral(" : ");
163 builder.append(propertyValue); 167 builder.append(propertyValue);
164 builder.appendLiteral("; }"); 168 builder.appendLiteral("; }");
165 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, builder.toString ()); 169 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, builder.toString ());
166 if (!rule || !rule->isFontFaceRule()) 170 if (!rule || !rule->isFontFaceRule())
167 return nullptr; 171 return nullptr;
168 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); 172 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID);
169 } 173 }
170 174
171 } // namespace blink 175 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParser.h ('k') | Source/core/css/parser/CSSParserImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698