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

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

Issue 647483009: CSS Parser: Implement parseValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase / update Created 6 years, 1 month 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/CSSParserImpl.h ('k') | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/css/parser/CSSParserImpl.h"
7
8 #include "core/css/StylePropertySet.h"
9 #include "core/css/parser/CSSParserValues.h"
10 #include "core/css/parser/CSSPropertyParser.h"
11 #include "core/css/parser/CSSTokenizer.h"
12
13 namespace blink {
14
15 CSSParserImpl::CSSParserImpl(const CSSParserContext& context, const String& s)
16 : m_context(context)
17 {
18 CSSTokenizer::tokenize(s, m_tokens);
19 }
20
21 bool CSSParserImpl::parseValue(MutableStylePropertySet* declaration, CSSProperty ID propertyID, const String& string, bool important, const CSSParserContext& con text)
22 {
23 CSSParserImpl parser(context, string);
24 CSSRuleSourceData::Type ruleType = CSSRuleSourceData::STYLE_RULE;
25 if (declaration->cssParserMode() == CSSViewportRuleMode)
26 ruleType = CSSRuleSourceData::VIEWPORT_RULE;
27 parser.consumeDeclarationValue(parser.m_tokens.begin(), parser.m_tokens.end( ) - 1, propertyID, important, ruleType);
28 if (parser.m_parsedProperties.isEmpty())
29 return false;
30 declaration->addParsedProperties(parser.m_parsedProperties);
31 return true;
32 }
33
34 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenIterator start, CSSPar serTokenIterator end, CSSPropertyID propertyID, bool important, CSSRuleSourceDat a::Type ruleType)
35 {
36 CSSParserValueList valueList(start, end);
37 if (!valueList.size())
38 return; // Parser error
39 bool inViewport = ruleType == CSSRuleSourceData::VIEWPORT_RULE;
40 CSSPropertyParser::parseValue(propertyID, important, &valueList, m_context, inViewport, m_parsedProperties, ruleType);
41 }
42
43 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserImpl.h ('k') | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698