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

Unified Diff: Source/core/css/CSSParser.cpp

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/CSSParser.h ('k') | Source/core/css/CSSParserValues.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser.cpp
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index 05144d84cfc14f068a93fa973d86abd1df4f94b0..f6e7f0230bb6110bd6cd68f52285bb25b5beb4b5 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -1274,7 +1274,7 @@ bool CSSParser::parseSystemColor(RGBA32& color, const String& string, Document*
CSSParserString cssColor;
cssColor.init(string);
- int id = cssValueKeywordID(cssColor);
+ CSSValueID id = cssValueKeywordID(cssColor);
if (id <= 0)
return false;
@@ -3661,7 +3661,7 @@ static bool isValueConflictingWithCurrentEdge(int value1, int value2)
return false;
}
-static bool isFillPositionKeyword(int value)
+static bool isFillPositionKeyword(CSSValueID value)
{
return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter;
}
@@ -3670,7 +3670,7 @@ void CSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<C
{
// [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <percentage> | <length> ]
// In the case of 4 values <position> requires the second value to be a length or a percentage.
- if (isFillPositionKeyword(parsedValue2->getIdent()))
+ if (isFillPositionKeyword(parsedValue2->getValueID()))
return;
unsigned cumulativeFlags = 0;
@@ -3679,8 +3679,8 @@ void CSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<C
if (!value3)
return;
- int ident1 = parsedValue1->getIdent();
- int ident3 = value3->getIdent();
+ CSSValueID ident1 = parsedValue1->getValueID();
+ CSSValueID ident3 = value3->getValueID();
if (ident1 == CSSValueCenter)
return;
@@ -3703,7 +3703,7 @@ void CSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<C
return;
// 4th value must be a length or a percentage.
- if (isFillPositionKeyword(value4->getIdent()))
+ if (isFillPositionKeyword(value4->getValueID()))
return;
value1 = createPrimitiveValuePair(parsedValue1, parsedValue2);
@@ -3727,9 +3727,9 @@ void CSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr<C
valueList->next();
bool swapNeeded = false;
- CSSValueID ident1 = static_cast<CSSValueID>(parsedValue1->getIdent());
- CSSValueID ident2 = static_cast<CSSValueID>(parsedValue2->getIdent());
- CSSValueID ident3 = static_cast<CSSValueID>(value3->getIdent());
+ CSSValueID ident1 = parsedValue1->getValueID();
+ CSSValueID ident2 = parsedValue2->getValueID();
+ CSSValueID ident3 = value3->getValueID();
CSSValueID firstPositionKeyword;
CSSValueID secondPositionKeyword;
@@ -3798,8 +3798,8 @@ void CSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr<C
#ifndef NDEBUG
CSSPrimitiveValue* first = toCSSPrimitiveValue(value1.get());
CSSPrimitiveValue* second = toCSSPrimitiveValue(value2.get());
- ident1 = static_cast<CSSValueID>(first->getPairValue()->first()->getIdent());
- ident2 = static_cast<CSSValueID>(second->getPairValue()->first()->getIdent());
+ ident1 = first->getPairValue()->first()->getValueID();
+ ident2 = second->getPairValue()->first()->getValueID();
ASSERT(ident1 == CSSValueLeft || ident1 == CSSValueRight);
ASSERT(ident2 == CSSValueBottom || ident2 == CSSValueTop);
#endif
@@ -3864,7 +3864,7 @@ void CSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue
value2.clear();
// Per CSS3 syntax, <position> can't have 'center' as its second keyword as we have more arguments to follow.
- if (parsedValue2->getIdent() == CSSValueCenter)
+ if (parsedValue2->getValueID() == CSSValueCenter)
return;
if (numberOfValues == 3)
@@ -3955,7 +3955,7 @@ void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& valu
// If only one value was specified, value2 is the same as value1.
m_implicitShorthand = true;
- value2 = cssValuePool().createIdentifierValue(static_cast<CSSValueID>(toCSSPrimitiveValue(value1.get())->getIdent()));
+ value2 = cssValuePool().createIdentifierValue(toCSSPrimitiveValue(value1.get())->getValueID());
}
PassRefPtr<CSSValue> CSSParser::parseFillSize(CSSPropertyID propId, bool& allowComma)
@@ -7400,10 +7400,10 @@ bool CSSParser::parseRadialGradient(CSSParserValueList* valueList, RefPtr<CSSVal
if (sizeValue && horizontalSize)
return false;
// Circles must have 0 or 1 lengths.
- if (shapeValue && shapeValue->getIdent() == CSSValueCircle && verticalSize)
+ if (shapeValue && shapeValue->getValueID() == CSSValueCircle && verticalSize)
return false;
// Ellipses must have 0 or 2 length/percentages.
- if (shapeValue && shapeValue->getIdent() == CSSValueEllipse && horizontalSize && !verticalSize)
+ if (shapeValue && shapeValue->getValueID() == CSSValueEllipse && horizontalSize && !verticalSize)
return false;
// If there's only one size, it must be a length.
if (!verticalSize && horizontalSize && horizontalSize->isPercentage())
@@ -8012,17 +8012,17 @@ PassRefPtr<CSSValue> CSSParser::parseTransformValue(CSSParserValue *value)
return transformValue.release();
}
-bool CSSParser::isBlendMode(int ident)
+bool CSSParser::isBlendMode(CSSValueID valueID)
{
- return (ident >= CSSValueMultiply && ident <= CSSValueLuminosity)
- || ident == CSSValueNormal
- || ident == CSSValueOverlay;
+ return (valueID >= CSSValueMultiply && valueID <= CSSValueLuminosity)
+ || valueID == CSSValueNormal
+ || valueID == CSSValueOverlay;
}
-bool CSSParser::isCompositeOperator(int ident)
+bool CSSParser::isCompositeOperator(CSSValueID valueID)
{
// FIXME: Add CSSValueDestination and CSSValueLighter when the Compositing spec updates.
- return ident >= CSSValueClear && ident <= CSSValueXor;
+ return valueID >= CSSValueClear && valueID <= CSSValueXor;
}
static void filterInfoForName(const CSSParserString& name, CSSFilterValue::FilterOperationType& filterType, unsigned& maximumArgumentCount)
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSParserValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698