Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| index bf8886ff0c4e48896cf07bc544176de9600ed544..6d30e851d79ce48faedab4ff87193104c6cfe354 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -71,7 +71,7 @@ void CSSPropertyParser::addProperty(CSSPropertyID property, |
| const CSSValue& value, |
| bool important, |
| bool implicit) { |
| - ASSERT(!isPropertyAlias(property)); |
| + DCHECK(!isPropertyAlias(property)); |
| int shorthandIndex = 0; |
| bool setFromShorthand = false; |
| @@ -94,7 +94,7 @@ void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, |
| bool important) { |
| const StylePropertyShorthand& shorthand = shorthandForProperty(property); |
| unsigned shorthandLength = shorthand.length(); |
| - ASSERT(shorthandLength); |
| + DCHECK(shorthandLength); |
| const CSSPropertyID* longhands = shorthand.properties(); |
| for (unsigned i = 0; i < shorthandLength; ++i) |
| addProperty(longhands[i], property, value, important); |
| @@ -384,7 +384,7 @@ static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) { |
| } |
| static CSSValue* consumeSteps(CSSParserTokenRange& range) { |
| - ASSERT(range.peek().functionId() == CSSValueSteps); |
| + DCHECK_EQ(range.peek().functionId(), CSSValueSteps); |
| CSSParserTokenRange rangeCopy = range; |
| CSSParserTokenRange args = consumeFunction(rangeCopy); |
| @@ -420,7 +420,7 @@ static CSSValue* consumeSteps(CSSParserTokenRange& range) { |
| } |
| static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) { |
| - ASSERT(range.peek().functionId() == CSSValueCubicBezier); |
| + DCHECK_EQ(range.peek().functionId(), CSSValueCubicBezier); |
| CSSParserTokenRange rangeCopy = range; |
| CSSParserTokenRange args = consumeFunction(rangeCopy); |
| @@ -482,7 +482,7 @@ static CSSValue* consumeAnimationValue(CSSPropertyID property, |
| case CSSPropertyTransitionTimingFunction: |
| return consumeAnimationTimingFunction(range); |
| default: |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| return nullptr; |
| } |
| } |
| @@ -514,7 +514,7 @@ static CSSValueList* consumeAnimationPropertyList( |
| } while (consumeCommaIncludingWhitespace(range)); |
| if (!isValidAnimationPropertyList(property, *list)) |
| return nullptr; |
| - ASSERT(list->length()); |
| + DCHECK(list->length()); |
| return list; |
| } |
| @@ -524,7 +524,7 @@ bool CSSPropertyParser::consumeAnimationShorthand( |
| bool important) { |
| const unsigned longhandCount = shorthand.length(); |
| CSSValueList* longhands[8]; |
| - ASSERT(longhandCount <= 8); |
| + DCHECK_LE(longhandCount, static_cast<unsigned>(8)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(8) -> 8u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| for (size_t i = 0; i < longhandCount; ++i) |
| longhands[i] = CSSValueList::createCommaSeparated(); |
| @@ -1198,7 +1198,8 @@ static bool consumeBorderImageComponents(CSSPropertyID property, |
| if (!slice) { |
| slice = consumeBorderImageSlice(property, range); |
| if (slice) { |
| - ASSERT(!width && !outset); |
| + DCHECK(!width); |
| + DCHECK(!outset); |
| if (consumeSlashIncludingWhitespace(range)) { |
| width = consumeBorderImageWidth(range); |
| if (consumeSlashIncludingWhitespace(range)) { |
| @@ -1283,7 +1284,7 @@ static CSSValue* consumeBackgroundComposite(CSSParserTokenRange& range) { |
| } |
| static CSSValue* consumeMaskSourceType(CSSParserTokenRange& range) { |
| - ASSERT(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); |
| return consumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range); |
| } |
| @@ -1478,7 +1479,7 @@ static CSSValue* consumeGridLine(CSSParserTokenRange& range) { |
| values->append(*numericValue); |
| if (gridLineName) |
| values->append(*gridLineName); |
| - ASSERT(values->length()); |
| + DCHECK(values->length()); |
| return values; |
| } |
| @@ -1513,7 +1514,7 @@ static bool isGridTrackFixedSized(const CSSValue& value) { |
| static Vector<String> parseGridTemplateAreasColumnNames( |
| const String& gridRowNames) { |
| - ASSERT(!gridRowNames.isEmpty()); |
| + DCHECK(!gridRowNames.isEmpty()); |
| Vector<String> columnNames; |
| // Using StringImpl to avoid checks and indirection in every call to |
| // String::operator[]. |
| @@ -1820,7 +1821,7 @@ static CSSValue* consumeGridTemplateAreas(CSSParserTokenRange& range) { |
| if (rowCount == 0) |
| return nullptr; |
| - ASSERT(columnCount); |
| + DCHECK(columnCount); |
| return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); |
| } |
| @@ -1999,7 +2000,7 @@ const CSSValue* CSSPropertyParser::parseSingleValue( |
| case CSSPropertyBackdropFilter: |
| return consumeFilter(m_range, m_context); |
| case CSSPropertyTextDecoration: |
| - ASSERT(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
| + DCHECK(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
| // fallthrough |
| case CSSPropertyWebkitTextDecorationsInEffect: |
| case CSSPropertyTextDecorationLine: |
| @@ -2056,7 +2057,7 @@ const CSSValue* CSSPropertyParser::parseSingleValue( |
| return consumeScrollSnapPoints(m_range, m_context->mode()); |
| case CSSPropertyJustifyContent: |
| case CSSPropertyAlignContent: |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| return consumeContentDistributionOverflowPosition(m_range); |
| case CSSPropertyBorderImageRepeat: |
| case CSSPropertyWebkitMaskBoxImageRepeat: |
| @@ -2101,18 +2102,18 @@ const CSSValue* CSSPropertyParser::parseSingleValue( |
| case CSSPropertyGridColumnStart: |
| case CSSPropertyGridRowEnd: |
| case CSSPropertyGridRowStart: |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| return consumeGridLine(m_range); |
| case CSSPropertyGridAutoColumns: |
| case CSSPropertyGridAutoRows: |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| return consumeGridTrackList(m_range, m_context->mode(), GridAuto); |
| case CSSPropertyGridTemplateColumns: |
| case CSSPropertyGridTemplateRows: |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| return consumeGridTemplatesRowsOrColumns(m_range, m_context->mode()); |
| case CSSPropertyGridTemplateAreas: |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| return consumeGridTemplateAreas(m_range); |
| default: |
| return nullptr; |
| @@ -2254,7 +2255,8 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId) { |
| bool CSSPropertyParser::consumeSystemFont(bool important) { |
| CSSValueID systemFontID = m_range.consumeIncludingWhitespace().id(); |
| - ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar); |
| + DCHECK_GE(systemFontID, CSSValueCaption); |
| + DCHECK_LE(systemFontID, CSSValueStatusBar); |
| if (!m_range.atEnd()) |
| return false; |
| @@ -2501,17 +2503,17 @@ static CSSValue* consumeSingleViewportDescriptor(CSSParserTokenRange& range, |
| return consumeIdent<CSSValueAuto, CSSValuePortrait, CSSValueLandscape>( |
| range); |
| default: |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| break; |
| } |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| return nullptr; |
| } |
| bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, |
| bool important) { |
| - ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || |
| + DCHECK(RuntimeEnabledFeatures::cssViewportEnabled() || |
| isUASheetBehavior(m_context->mode())); |
| switch (propId) { |
| @@ -2735,7 +2737,7 @@ bool CSSPropertyParser::consumeBorder(bool important) { |
| bool CSSPropertyParser::consume4Values(const StylePropertyShorthand& shorthand, |
| bool important) { |
| - ASSERT(shorthand.length() == 4); |
| + DCHECK_EQ(shorthand.length(), static_cast<unsigned>(4)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(4) -> 4u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| const CSSPropertyID* longhands = shorthand.properties(); |
| const CSSValue* top = parseSingleValue(longhands[0], shorthand.id()); |
| if (!top) |
| @@ -2805,7 +2807,7 @@ bool CSSPropertyParser::consumeBorderImage(CSSPropertyID property, |
| repeat ? *repeat : *CSSInitialValue::create(), important); |
| return true; |
| default: |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| return false; |
| } |
| } |
| @@ -2842,7 +2844,7 @@ static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) { |
| if (property == CSSPropertyPageBreakBefore || |
| property == CSSPropertyWebkitColumnBreakBefore) |
| return CSSPropertyBreakBefore; |
| - ASSERT(property == CSSPropertyPageBreakInside || |
| + DCHECK(property == CSSPropertyPageBreakInside || |
| property == CSSPropertyWebkitColumnBreakInside); |
| return CSSPropertyBreakInside; |
| } |
| @@ -2873,7 +2875,7 @@ bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, |
| value = mapFromColumnOrPageBreakInside(value); |
| break; |
| default: |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| } |
| if (value == CSSValueInvalid) |
| return false; |
| @@ -2953,7 +2955,7 @@ bool CSSPropertyParser::consumeBackgroundShorthand( |
| bool important) { |
| const unsigned longhandCount = shorthand.length(); |
| CSSValue* longhands[10] = {0}; |
| - ASSERT(longhandCount <= 10); |
| + DCHECK_LE(longhandCount, static_cast<unsigned>(10)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(10) -> 10u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| bool implicit = false; |
| do { |
| @@ -3043,9 +3045,9 @@ bool CSSPropertyParser::consumeBackgroundShorthand( |
| bool CSSPropertyParser::consumeGridItemPositionShorthand( |
| CSSPropertyID shorthandId, |
| bool important) { |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
| - ASSERT(shorthand.length() == 2); |
| + DCHECK_EQ(shorthand.length(), static_cast<unsigned>(2)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(2) -> 2u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| CSSValue* startValue = consumeGridLine(m_range); |
| if (!startValue) |
| return false; |
| @@ -3068,8 +3070,8 @@ bool CSSPropertyParser::consumeGridItemPositionShorthand( |
| } |
| bool CSSPropertyParser::consumeGridAreaShorthand(bool important) { |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| - ASSERT(gridAreaShorthand().length() == 4); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK_EQ(gridAreaShorthand().length(), static_cast<unsigned>(4)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(4) -> 4u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| CSSValue* rowStartValue = consumeGridLine(m_range); |
| if (!rowStartValue) |
| return false; |
| @@ -3185,8 +3187,8 @@ bool CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns( |
| bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, |
| bool important) { |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| - ASSERT(gridTemplateShorthand().length() == 3); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK_EQ(gridTemplateShorthand().length(), static_cast<unsigned>(3)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(3) -> 3u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| CSSParserTokenRange rangeCopy = m_range; |
| CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); |
| @@ -3250,8 +3252,9 @@ static CSSValueList* consumeImplicitAutoFlow(CSSParserTokenRange& range, |
| } |
| bool CSSPropertyParser::consumeGridShorthand(bool important) { |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| - ASSERT(shorthandForProperty(CSSPropertyGrid).length() == 8); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK_EQ(shorthandForProperty(CSSPropertyGrid).length(), |
| + static_cast<unsigned>(8)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(8) -> 8u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| CSSParserTokenRange rangeCopy = m_range; |
| @@ -3497,7 +3500,7 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, |
| return consumeAnimationShorthand(transitionShorthandForParsing(), false, |
| important); |
| case CSSPropertyTextDecoration: |
| - ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
| + DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
| return consumeShorthandGreedily(textDecorationShorthand(), important); |
| case CSSPropertyMargin: |
| return consume4Values(marginShorthand(), important); |
| @@ -3631,8 +3634,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, |
| case CSSPropertyWebkitMask: |
| return consumeBackgroundShorthand(webkitMaskShorthand(), important); |
| case CSSPropertyGridGap: { |
| - ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled() && |
| - shorthandForProperty(CSSPropertyGridGap).length() == 2); |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), static_cast<unsigned>(2)); |
|
tkent
2017/03/28 14:44:56
static_cast<unsigned>(2) -> 2u
nikhil.sahni
2017/03/30 12:17:58
Done.
|
| CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context->mode(), |
| ValueRangeNonNegative); |
| CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context->mode(), |