Index: Source/core/css/CSSPrimitiveValue.cpp |
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp |
index 58513f96ef008040bfe4d41135b4599416277d8b..fec15fe9d83c3c8b14f2e87723252607520862d0 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" |
@@ -245,6 +246,15 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type) |
m_value.string->ref(); |
} |
+CSSPrimitiveValue::CSSPrimitiveValue(CSSVariableData* variableData) |
alancutter (OOO until 2018)
2015/08/05 08:01:43
This should be CSSPrimitiveValue::init(PassRefPtr<
|
+ : CSSValue(PrimitiveClass) |
+{ |
+ init(UnitType::VariableReference); |
+ m_value.variableData = variableData; |
+ ASSERT(m_value.variableData); |
+ m_value.variableData->ref(); |
+} |
+ |
CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const ComputedStyle& style) |
: CSSValue(PrimitiveClass) |
{ |
@@ -439,6 +449,11 @@ void CSSPrimitiveValue::cleanup() |
m_value.shape->deref(); |
#endif |
break; |
+ case UnitType::VariableReference: |
+#if !ENABLE(OILPAN) |
+ m_value.variableData->deref(); |
+#endif |
+ break; |
case UnitType::Number: |
case UnitType::Integer: |
case UnitType::Percentage: |
@@ -928,6 +943,7 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type) |
case UnitType::CalcPercentageWithNumber: |
case UnitType::CalcPercentageWithLength: |
case UnitType::QuirkyEms: |
+ case UnitType::VariableReference: |
break; |
}; |
ASSERT_NOT_REACHED(); |
@@ -1048,6 +1064,9 @@ String CSSPrimitiveValue::customCSSText() const |
case UnitType::Shape: |
text = m_value.shape->cssText(); |
break; |
+ case UnitType::VariableReference: |
+ text = "var(" + m_value.variableData->string() + ")"; |
alancutter (OOO until 2018)
2015/08/05 08:01:43
This should serialize the tokens, I don't think re
|
+ break; |
case UnitType::CalcPercentageWithNumber: |
case UnitType::CalcPercentageWithLength: |
case UnitType::QuirkyEms: |
@@ -1120,6 +1139,8 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const |
return m_value.calc && other.m_value.calc && m_value.calc->equals(*other.m_value.calc); |
case UnitType::Shape: |
return m_value.shape && other.m_value.shape && m_value.shape->equals(*other.m_value.shape); |
+ case UnitType::VariableReference: |
+ return m_value.variableData == other.m_value.variableData; |
case UnitType::Integer: |
case UnitType::Chs: |
case UnitType::CalcPercentageWithNumber: |