Index: Source/core/css/CSSCalculationValue.cpp |
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp |
index 998fba4d322d019fc2069e1f42690de038ab1169..840dfa1948e774633e18472dba5907290a9bf6bc 100644 |
--- a/Source/core/css/CSSCalculationValue.cpp |
+++ b/Source/core/css/CSSCalculationValue.cpp |
@@ -32,6 +32,7 @@ |
#include "core/css/CSSCalculationValue.h" |
#include "core/css/CSSPrimitiveValueMappings.h" |
+#include "core/css/parser/CSSPropertyParser.h" |
#include "core/css/resolver/StyleResolver.h" |
#include "wtf/MathExtras.h" |
#include "wtf/OwnPtr.h" |
@@ -135,6 +136,7 @@ static bool hasDoubleValue(CSSPrimitiveValue::UnitType type) |
case CSSPrimitiveValue::CSS_PROPERTY_ID: |
case CSSPrimitiveValue::CSS_VALUE_ID: |
case CSSPrimitiveValue::CSS_QEM: |
+ case CSSPrimitiveValue::CSS_VARIABLE_REFERENCE: |
return false; |
}; |
ASSERT_NOT_REACHED(); |
@@ -635,10 +637,21 @@ private: |
bool parseValue(CSSParserValueList* tokens, unsigned* index, Value* result) |
{ |
CSSParserValue* parserValue = tokens->valueAt(*index); |
- if (parserValue->unit >= CSSParserValue::Operator) |
- return false; |
+ |
+ if (parserValue->unit >= CSSParserValue::Operator) { |
+ // We still have to check for variables, which are parser values |
+ if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSPropertyParser::isVariableReference(parserValue)) |
+ return false; |
+ |
+ result->value = CSSCalcPrimitiveValue::create( |
alancutter (OOO until 2018)
2015/07/14 06:12:57
Is this ever hit? Don't we short circuit variable
|
+ CSSPrimitiveValue::create(parserValue->function->args->valueAt(0)->string, CSSPrimitiveValue::CSS_VARIABLE_REFERENCE), parserValue->isInt); |
+ ++*index; |
+ |
+ return true; |
+ } |
CSSPrimitiveValue::UnitType type = static_cast<CSSPrimitiveValue::UnitType>(parserValue->unit); |
+ |
if (unitCategory(type) == CalcOther) |
return false; |