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

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

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToTed Created 5 years, 4 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 a32af7d5237b5bc9da538abade86e91370a3efa3..cf8c0f905f7aed545a2b4d4dba92e99a1818cd85 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;
@@ -119,6 +120,7 @@ public:
PropertyID,
ValueID,
QuirkyEms,
+ VariableReference,
};
enum LengthUnitType {
@@ -196,6 +198,7 @@ public:
bool isTime() const { return type() == UnitType::Seconds || type() == UnitType::Milliseconds; }
bool isURI() const { return type() == UnitType::URI; }
bool isCalculated() const { return type() == UnitType::Calc; }
+ bool isVariableReference() const { return type() == UnitType::VariableReference; }
bool isCalculatedPercentageWithNumber() const { return typeWithCalcResolved() == UnitType::CalcPercentageWithNumber; }
bool isCalculatedPercentageWithLength() const { return typeWithCalcResolved() == UnitType::CalcPercentageWithLength; }
static bool isDotsPerInch(UnitType type) { return type == UnitType::DotsPerInch; }
@@ -234,6 +237,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));
@@ -284,6 +291,12 @@ public:
CSSCalcValue* cssCalcValue() const { ASSERT(isCalculated()); return m_value.calc; }
CSSPropertyID getPropertyID() const { ASSERT(isPropertyID()); return m_value.propertyID; }
+ CSSVariableData* getVariableDataValue() const
+ {
+ ASSERT(type() == UnitType::VariableReference);
+ return m_value.variableData;
+ }
+
CSSValueID getValueID() const { return type() == UnitType::ValueID ? m_value.valueID : CSSValueInvalid; }
template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
@@ -312,6 +325,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)
@@ -357,6 +371,7 @@ private:
Pair* pair;
Rect* rect;
Quad* quad;
+ CSSVariableData* variableData;
} m_value;
};

Powered by Google App Engine
This is Rietveld 408576698