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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSParserImpl.cpp
diff --git a/Source/core/css/parser/CSSParserImpl.cpp b/Source/core/css/parser/CSSParserImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ea6ee5000fc159b14d5f8a47a4c98bb18c544dd3
--- /dev/null
+++ b/Source/core/css/parser/CSSParserImpl.cpp
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/css/parser/CSSParserImpl.h"
+
+#include "core/css/StylePropertySet.h"
+#include "core/css/parser/CSSParserValues.h"
+#include "core/css/parser/CSSPropertyParser.h"
+#include "core/css/parser/CSSTokenizer.h"
+
+namespace blink {
+
+CSSParserImpl::CSSParserImpl(const CSSParserContext& context, const String& s)
+: m_context(context)
+{
+ CSSTokenizer::tokenize(s, m_tokens);
+}
+
+bool CSSParserImpl::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
+{
+ CSSParserImpl parser(context, string);
+ CSSRuleSourceData::Type ruleType = CSSRuleSourceData::STYLE_RULE;
+ if (declaration->cssParserMode() == CSSViewportRuleMode)
+ ruleType = CSSRuleSourceData::VIEWPORT_RULE;
+ parser.consumeDeclarationValue(parser.m_tokens.begin(), parser.m_tokens.end() - 1, propertyID, important, ruleType);
+ if (parser.m_parsedProperties.isEmpty())
+ return false;
+ declaration->addParsedProperties(parser.m_parsedProperties);
+ return true;
+}
+
+void CSSParserImpl::consumeDeclarationValue(CSSParserTokenIterator start, CSSParserTokenIterator end, CSSPropertyID propertyID, bool important, CSSRuleSourceData::Type ruleType)
+{
+ CSSParserValueList valueList(start, end);
+ if (!valueList.size())
+ return; // Parser error
+ bool inViewport = ruleType == CSSRuleSourceData::VIEWPORT_RULE;
+ CSSPropertyParser::parseValue(propertyID, important, &valueList, m_context, inViewport, m_parsedProperties, ruleType);
+}
+
+} // namespace blink
« 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