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 |