Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index e81d7a23241e1908d18637a7a0189c8d22de46cd..2441776641c67df4f03ed76e5b9d401545eb68a0 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -335,12 +335,14 @@ inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi |
| static inline bool isComma(CSSParserValue* value) |
| { |
| - return value && value->unit == CSSParserValue::Operator && value->iValue == ','; |
| + ASSERT(value); |
| + return value->unit == CSSParserValue::Operator && value->iValue == ','; |
| } |
| static bool consumeComma(CSSParserValueList* valueList) |
| { |
| - if (!isComma(valueList->current())) |
| + CSSParserValue* value = valueList->current(); |
| + if (!value || !isComma(value)) |
| return false; |
| valueList->next(); |
| return true; |
| @@ -1608,7 +1610,7 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper |
| while (m_valueList->current()) { |
| CSSParserValue* val = m_valueList->current(); |
| - if (val->unit == CSSParserValue::Operator && val->iValue == ',') { |
| + if (isComma(val)) { |
| // We hit the end. Fill in all remaining values with the initial value. |
| m_valueList->next(); |
| for (i = 0; i < numProperties; ++i) { |
| @@ -2536,7 +2538,7 @@ void CSSPropertyParser::parseFillPosition(CSSParserValueList* valueList, RefPtrW |
| unsigned numberOfValues = 0; |
| for (unsigned i = valueList->currentIndex(); i < valueList->size(); ++i, ++numberOfValues) { |
| CSSParserValue* current = valueList->valueAt(i); |
| - if (isComma(current) || !current || isForwardSlashOperator(current) || !isPotentialPositionValue(current)) |
| + if (!current || isComma(current) || isForwardSlashOperator(current) || !isPotentialPositionValue(current)) |
| break; |
| } |
| @@ -2610,7 +2612,7 @@ void CSSPropertyParser::parse2ValuesFillPosition(CSSParserValueList* valueList, |
| CSSParserValue* value = valueList->next(); |
| // First check for the comma. If so, we are finished parsing this value or value pair. |
| - if (isComma(value)) |
| + if (value && isComma(value)) |
| value = 0; |
| if (value) { |
| @@ -4614,8 +4616,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFamily() |
| while (value) { |
| CSSParserValue* nextValue = m_valueList->next(); |
| - bool nextValBreaksFont = !nextValue || |
| - (nextValue->unit == CSSParserValue::Operator && nextValue->iValue == ','); |
| + bool nextValBreaksFont = !nextValue || isComma(nextValue); |
| bool nextValIsFontName = nextValue && |
| ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitBody) || |
| (nextValue->unit == CSSPrimitiveValue::CSS_STRING || nextValue->unit == CSSPrimitiveValue::CSS_IDENT)); |
| @@ -8172,7 +8173,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGStrokeDasharray() |
| else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) |
| ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitType) value->unit)); |
| value = m_valueList->next(); |
| - if (value && value->unit == CSSParserValue::Operator && value->iValue == ',') |
| + if (value && isComma(value)) |
|
Timothy Loh
2015/02/17 23:37:02
We should probably fix this case to work properly
|
| value = m_valueList->next(); |
| } |
| if (!validPrimitive) |
| @@ -8413,7 +8414,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTransformValue(CSSPrope |
| a = args->next(); |
| if (!a) |
| break; |
| - if (a->unit != CSSParserValue::Operator || a->iValue != ',') |
| + if (!isComma(a)) |
| return nullptr; |
| a = args->next(); |