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

Side by Side Diff: Source/core/css/parser/CSSParserImpl.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.cpp ('k') | Source/core/inspector/InspectorStyleSheet.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/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool result = !m_parsedProperties.isEmpty(); 163 bool result = !m_parsedProperties.isEmpty();
164 m_parsedProperties.clear(); 164 m_parsedProperties.clear();
165 return result; 165 return result;
166 } 166 }
167 167
168 void CSSParserImpl::parseDeclarationListForInspector(const String& declaration, const CSSParserContext& context, CSSParserObserver& observer) 168 void CSSParserImpl::parseDeclarationListForInspector(const String& declaration, const CSSParserContext& context, CSSParserObserver& observer)
169 { 169 {
170 CSSParserImpl parser(context); 170 CSSParserImpl parser(context);
171 CSSParserObserverWrapper wrapper(observer); 171 CSSParserObserverWrapper wrapper(observer);
172 parser.m_observerWrapper = &wrapper; 172 parser.m_observerWrapper = &wrapper;
173 CSSTokenizer::Scope scope(declaration, *parser.m_observerWrapper); 173 CSSTokenizer::Scope scope(declaration, wrapper);
174 observer.startRuleHeader(StyleRule::Style, 0); 174 observer.startRuleHeader(StyleRule::Style, 0);
175 observer.endRuleHeader(1); 175 observer.endRuleHeader(1);
176 parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style); 176 parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style);
177 } 177 }
178 178
179 void CSSParserImpl::parseStyleSheetForInspector(const String& string, const CSSP arserContext& context, CSSParserObserver& observer) 179 void CSSParserImpl::parseStyleSheetForInspector(const String& string, const CSSP arserContext& context, CSSParserObserver& observer)
180 { 180 {
181 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(st rictCSSParserContext()); 181 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(st rictCSSParserContext());
182 CSSParserImpl parser(context, sheet.get()); 182 CSSParserImpl parser(context, sheet.get());
183 CSSParserObserverWrapper wrapper(observer); 183 CSSParserObserverWrapper wrapper(observer);
184 parser.m_observerWrapper = &wrapper; 184 parser.m_observerWrapper = &wrapper;
185 CSSTokenizer::Scope scope(string, *parser.m_observerWrapper); 185 CSSTokenizer::Scope scope(string, wrapper);
186 parser.consumeRuleList(scope.tokenRange(), TopLevelRuleList, [](PassRefPtrWi llBeRawPtr<StyleRuleBase> rule) { }); 186 parser.consumeRuleList(scope.tokenRange(), TopLevelRuleList, [](PassRefPtrWi llBeRawPtr<StyleRuleBase> rule) { });
187 } 187 }
188 188
189 static CSSParserImpl::AllowedRulesType computeNewAllowedRules(CSSParserImpl::All owedRulesType allowedRules, StyleRuleBase* rule) 189 static CSSParserImpl::AllowedRulesType computeNewAllowedRules(CSSParserImpl::All owedRulesType allowedRules, StyleRuleBase* rule)
190 { 190 {
191 if (!rule || allowedRules == CSSParserImpl::KeyframeRules || allowedRules == CSSParserImpl::NoRules) 191 if (!rule || allowedRules == CSSParserImpl::KeyframeRules || allowedRules == CSSParserImpl::NoRules)
192 return allowedRules; 192 return allowedRules;
193 ASSERT(allowedRules <= CSSParserImpl::RegularRules); 193 ASSERT(allowedRules <= CSSParserImpl::RegularRules);
194 if (rule->isCharsetRule() || rule->isImportRule()) 194 if (rule->isCharsetRule() || rule->isImportRule())
195 return CSSParserImpl::AllowImportRules; 195 return CSSParserImpl::AllowImportRules;
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 else 720 else
721 return nullptr; // Parser error, invalid value in keyframe selector 721 return nullptr; // Parser error, invalid value in keyframe selector
722 if (range.atEnd()) 722 if (range.atEnd())
723 return result.release(); 723 return result.release();
724 if (range.consume().type() != CommaToken) 724 if (range.consume().type() != CommaToken)
725 return nullptr; // Parser error 725 return nullptr; // Parser error
726 } 726 }
727 } 727 }
728 728
729 } // namespace blink 729 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParser.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698