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

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

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
« no previous file with comments | « Source/core/css/CSSParserValues.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.h
diff --git a/Source/core/css/CSSPrimitiveValue.h b/Source/core/css/CSSPrimitiveValue.h
index f045e5536151670a0b096adf948964cdcea10bfe..f3a350b6fa8a5803748c2171698736bafb9e3a43 100644
--- a/Source/core/css/CSSPrimitiveValue.h
+++ b/Source/core/css/CSSPrimitiveValue.h
@@ -22,6 +22,7 @@
#ifndef CSSPrimitiveValue_h
#define CSSPrimitiveValue_h
+#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "core/css/CSSValue.h"
#include "core/platform/graphics/Color.h"
@@ -129,6 +130,9 @@ public:
CSS_CALC_PERCENTAGE_WITH_NUMBER = 114,
CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
CSS_VARIABLE_NAME = 116,
+
+ CSS_PROPERTY_ID = 117,
+ CSS_VALUE_ID = 118
};
// This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
@@ -161,7 +165,6 @@ public:
|| m_primitiveUnitType == CSS_REMS
|| m_primitiveUnitType == CSS_CHS;
}
- bool isIdent() const { return m_primitiveUnitType == CSS_IDENT; }
bool isLength() const
{
unsigned short type = primitiveType();
@@ -190,8 +193,11 @@ public:
bool isVariableName() const { return primitiveType() == CSS_VARIABLE_NAME; }
bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMAX; }
bool isFlex() const { return primitiveType() == CSS_FR; }
+ bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
- static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { return adoptRef(new CSSPrimitiveValue(identifier)); }
+ static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(new CSSPrimitiveValue(valueID)); }
+ static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(new CSSPrimitiveValue(propertyID)); }
+ static PassRefPtr<CSSPrimitiveValue> createParserOperator(int parserOperator) { return adoptRef(new CSSPrimitiveValue(parserOperator)); }
static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(new CSSPrimitiveValue(rgbValue)); }
static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
@@ -293,7 +299,8 @@ public:
CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; }
- int getIdent() const { return m_primitiveUnitType == CSS_IDENT ? m_value.ident : 0; }
+ 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; }
template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
@@ -315,8 +322,10 @@ public:
void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
private:
- // FIXME: int vs. unsigned overloading is too subtle to distinguish the color and identifier cases.
- CSSPrimitiveValue(int ident);
+ CSSPrimitiveValue(CSSValueID);
+ CSSPrimitiveValue(CSSPropertyID);
+ // FIXME: int vs. unsigned overloading is too subtle to distinguish the color and operator cases.
+ CSSPrimitiveValue(int parserOperator);
CSSPrimitiveValue(unsigned color); // RGB value
CSSPrimitiveValue(const Length&);
CSSPrimitiveValue(const String&, UnitTypes);
@@ -352,7 +361,9 @@ private:
double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);
union {
- int ident;
+ CSSPropertyID propertyID;
+ CSSValueID valueID;
+ int parserOperator;
double num;
StringImpl* string;
Counter* counter;
« no previous file with comments | « Source/core/css/CSSParserValues.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698