| Index: Source/core/css/CSSPrimitiveValue.cpp
|
| diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
|
| index 606a36e4e8f21f6cee51163d50559a86d7f89fce..90ea24c595b4df57693cb4019c1330ed77ee0e60 100644
|
| --- a/Source/core/css/CSSPrimitiveValue.cpp
|
| +++ b/Source/core/css/CSSPrimitiveValue.cpp
|
| @@ -26,6 +26,7 @@
|
| #include "core/css/CSSHelper.h"
|
| #include "core/css/CSSMarkup.h"
|
| #include "core/css/CSSToLengthConversionData.h"
|
| +#include "core/css/CSSVariableData.h"
|
| #include "core/css/Counter.h"
|
| #include "core/css/Pair.h"
|
| #include "core/css/Rect.h"
|
| @@ -191,6 +192,7 @@ CSSPrimitiveValue::UnitType CSSPrimitiveValue::primitiveType() const
|
| return CSS_CALC_PERCENTAGE_WITH_LENGTH;
|
| case CalcTime:
|
| return CSS_MS;
|
| + case CalcVariable: // The type of a calculation containing a variable cannot be known until the value of the variable is determined.
|
| case CalcOther:
|
| return CSS_UNKNOWN;
|
| }
|
| @@ -248,6 +250,15 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type)
|
| m_value.string->ref();
|
| }
|
|
|
| +CSSPrimitiveValue::CSSPrimitiveValue(CSSVariableData* variableData)
|
| + : CSSValue(PrimitiveClass)
|
| +{
|
| + m_primitiveUnitType = CSSPrimitiveValue::CSS_VARIABLE_REFERENCE;
|
| + m_value.variableData = variableData;
|
| + if (m_value.variableData)
|
| + m_value.variableData->ref();
|
| +}
|
| +
|
| CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const ComputedStyle& style)
|
| : CSSValue(PrimitiveClass)
|
| {
|
| @@ -397,6 +408,10 @@ void CSSPrimitiveValue::cleanup()
|
| if (m_value.string)
|
| m_value.string->deref();
|
| break;
|
| + case CSS_VARIABLE_REFERENCE:
|
| + if (m_value.variableData)
|
| + m_value.variableData->deref();
|
| + break;
|
| case CSS_COUNTER:
|
| // We must not call deref() when oilpan is enabled because m_value.counter is traced.
|
| #if !ENABLE(OILPAN)
|
| @@ -819,6 +834,8 @@ String CSSPrimitiveValue::getStringValue() const
|
| return valueName(m_value.valueID);
|
| case CSS_PROPERTY_ID:
|
| return propertyName(m_value.propertyID);
|
| + case CSS_VARIABLE_REFERENCE:
|
| + return m_value.variableData->string();
|
| default:
|
| break;
|
| }
|
| @@ -927,6 +944,7 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
|
| case CSS_CALC_PERCENTAGE_WITH_NUMBER:
|
| case CSS_CALC_PERCENTAGE_WITH_LENGTH:
|
| case CSS_QEM:
|
| + case CSS_VARIABLE_REFERENCE:
|
| break;
|
| };
|
| ASSERT_NOT_REACHED();
|
| @@ -1044,6 +1062,9 @@ String CSSPrimitiveValue::customCSSText() const
|
| case CSS_SHAPE:
|
| text = m_value.shape->cssText();
|
| break;
|
| + case CSS_VARIABLE_REFERENCE:
|
| + text = "var(" + String(m_value.string) + ")";
|
| + break;
|
| }
|
|
|
| ASSERT(!cssTextCache().contains(this));
|
| @@ -1096,6 +1117,7 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
|
| case CSS_STRING:
|
| case CSS_URI:
|
| case CSS_ATTR:
|
| + case CSS_VARIABLE_REFERENCE:
|
| return equal(m_value.string, other.m_value.string);
|
| case CSS_COUNTER:
|
| return m_value.counter && other.m_value.counter && m_value.counter->equals(*other.m_value.counter);
|
|
|