Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Post-merge Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
index f862828c1ff50e89566563ea50ef2a67a3804bf3..6822d32db341a848fc74692e5688bbdc32e96ef5 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
+++ b/third_party/WebKit/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/StyleSheetContents.h"
#include "core/dom/Node.h"
#include "core/style/ComputedStyle.h"
@@ -340,6 +341,13 @@ void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<CSSBasicShape> shape)
m_value.shape = shape.leakRef();
}
+void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<CSSVariableData> variableData)
+{
+ init(UnitType::VariableReference);
+ m_hasCachedCSSText = false;
+ m_value.variableData = variableData.leakRef();
+}
+
CSSPrimitiveValue::~CSSPrimitiveValue()
{
cleanup();
@@ -370,6 +378,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:
@@ -852,6 +865,7 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
case UnitType::Shape:
case UnitType::CalcPercentageWithNumber:
case UnitType::CalcPercentageWithLength:
+ case UnitType::VariableReference:
break;
};
ASSERT_NOT_REACHED();
@@ -930,6 +944,11 @@ String CSSPrimitiveValue::customCSSText() const
case UnitType::Shape:
text = m_value.shape->cssText();
break;
+ case UnitType::VariableReference: {
+ CSSParserTokenRange range = m_value.variableData->tokenRange();
+ text = range.serialize();
+ break;
+ }
case UnitType::CalcPercentageWithNumber:
case UnitType::CalcPercentageWithLength:
ASSERT_NOT_REACHED();
@@ -992,6 +1011,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:

Powered by Google App Engine
This is Rietveld 408576698