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

Unified Diff: Source/core/css/CSSPrimitiveValue.h

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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: Source/core/css/CSSPrimitiveValue.h
diff --git a/Source/core/css/CSSPrimitiveValue.h b/Source/core/css/CSSPrimitiveValue.h
index 2ae4b55c840b67a86287c5ba0140e0ed6348ed02..47c7e618b0f2dbd45fec2e256d9c627ec4b3630e 100644
--- a/Source/core/css/CSSPrimitiveValue.h
+++ b/Source/core/css/CSSPrimitiveValue.h
@@ -38,6 +38,7 @@ namespace blink {
class CSSBasicShape;
class CSSCalcValue;
class CSSToLengthConversionData;
+class CSSVariableData;
class Counter;
class Length;
class LengthSize;
@@ -117,7 +118,9 @@ public:
CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
CSS_STRING = 116,
CSS_PROPERTY_ID = 117,
- CSS_VALUE_ID = 118
+ CSS_VALUE_ID = 118,
+
+ CSS_VARIABLE_REFERENCE = 119
};
enum LengthUnitType {
@@ -175,6 +178,7 @@ public:
|| m_primitiveUnitType == CSS_REMS
|| m_primitiveUnitType == CSS_CHS;
}
+ bool isVariableReference() const { return primitiveType() == CSS_VARIABLE_REFERENCE; }
bool isViewportPercentageLength() const { return isViewportPercentageLength(static_cast<UnitType>(m_primitiveUnitType)); }
static bool isViewportPercentageLength(UnitType type) { return type >= CSS_VW && type <= CSS_VMAX; }
static bool isLength(UnitType type)
@@ -230,6 +234,10 @@ public:
{
return adoptRefWillBeNoop(new CSSPrimitiveValue(value, style));
}
+ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(CSSVariableData* value)
+ {
+ return adoptRefWillBeNoop(new CSSPrimitiveValue(value));
+ }
template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(T value)
{
return adoptRefWillBeNoop(new CSSPrimitiveValue(value));
@@ -282,6 +290,8 @@ public:
CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; }
+ CSSVariableData* getVariableDataValue() const { return m_primitiveUnitType != CSS_VARIABLE_REFERENCE ? 0 : m_value.variableData; }
+
CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROPERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
@@ -311,6 +321,7 @@ private:
CSSPrimitiveValue(const LengthSize&, const ComputedStyle&);
CSSPrimitiveValue(const String&, UnitType);
CSSPrimitiveValue(double, UnitType);
+ CSSPrimitiveValue(CSSVariableData*);
template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h
template<typename T> CSSPrimitiveValue(T* val)
@@ -353,6 +364,7 @@ private:
Pair* pair;
Rect* rect;
Quad* quad;
+ CSSVariableData* variableData;
} m_value;
};

Powered by Google App Engine
This is Rietveld 408576698