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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp

Issue 2310823002: Skeleton implementation of CSS Properties and Values API (Closed)
Patch Set: fix stylevardata copy ctor Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp
index 7cd474d33fe7a59601a491bd30e1937504877a69..0aaf813f7e93ca06ed8866e6325f05e4d848dad6 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp
@@ -5,6 +5,7 @@
#include "core/css/parser/CSSVariableParser.h"
#include "core/css/CSSCustomPropertyDeclaration.h"
+#include "core/css/CSSVariableReferenceValue.h"
#include "core/css/parser/CSSParserTokenRange.h"
namespace blink {
@@ -137,4 +138,21 @@ CSSCustomPropertyDeclaration* CSSVariableParser::parseDeclarationValue(const Ato
return CSSCustomPropertyDeclaration::create(variableName, type);
}
+CSSVariableReferenceValue* CSSVariableParser::parseRegisteredPropertyValue(CSSParserTokenRange range, bool requireVarReference)
+{
+ if (range.atEnd())
+ return nullptr;
+
+ bool hasReferences;
+ bool hasAtApplyRule;
+ CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule);
+
+ if (type != CSSValueInternalVariableValue)
+ return nullptr; // Invalid or a css-wide keyword
+ if (requireVarReference && !hasReferences)
+ return nullptr;
+ // TODO(timloh): Should this be hasReferences || hasAtApplyRule?
+ return CSSVariableReferenceValue::create(CSSVariableData::create(range, hasReferences));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698