Chromium Code Reviews| Index: Source/core/css/CSSPrimitiveValue.cpp |
| diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp |
| index 58513f96ef008040bfe4d41135b4599416277d8b..251008998f5946d6ea74c4706f1df781afb736db 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) |
| + : CSSValue(PrimitiveClass) |
| +{ |
| + init(UnitType::VariableReference); |
| + m_value.variableData = variableData; |
| + ASSERT(m_value.variableData); |
| + m_value.variableData->ref(); |
| +} |
|
alancutter (OOO until 2018)
2015/08/25 01:59:08
This should be done in an init(PassRefPtrWillBeRaw
|
| + |
| 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,15 @@ String CSSPrimitiveValue::customCSSText() const |
| case UnitType::Shape: |
| text = m_value.shape->cssText(); |
| break; |
| + case UnitType::VariableReference: { |
| + StringBuilder result; |
| + result.appendLiteral("var("); |
|
Timothy Loh
2015/08/25 09:21:09
Shouldn't this just return (..).serialize(), inste
|
| + CSSParserTokenRange range = m_value.variableData->tokenRange(); |
| + result.append(range.serialize()); |
| + result.appendLiteral(")"); |
| + text = result.toString(); |
| + break; |
| + } |
| case UnitType::CalcPercentageWithNumber: |
| case UnitType::CalcPercentageWithLength: |
| case UnitType::QuirkyEms: |
| @@ -1120,6 +1145,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: |