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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2755493004: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in core/css/ (Closed)
Patch Set: Worked on Review Comments done Created 3 years, 9 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: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index 7fa81114dea7e15c52ce285e966fd4cabc73ea40..5082a6bcc3ab61ca15023b7d1a63b0989ebbba37 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -210,7 +210,7 @@ static bool convertFontFamilyName(
FontDescription::FamilyDescription StyleBuilderConverter::convertFontFamily(
StyleResolverState& state,
const CSSValue& value) {
- ASSERT(value.isValueList());
+ DCHECK(value.isValueList());
FontDescription::FamilyDescription desc(FontDescription::NoFamily);
FontFamily* currFamily = nullptr;
@@ -285,7 +285,7 @@ static float computeFontSize(StyleResolverState& state,
->toCalcValue(state.fontSizeConversionData())
->evaluate(parentSize.value);
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return 0;
}
@@ -306,7 +306,7 @@ FontDescription::Size StyleBuilderConverter::convertFontSize(
return FontDescription::smallerSize(parentSize);
if (valueID == CSSValueLarger)
return FontDescription::largerSize(parentSize);
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return FontBuilder::initialSize();
}
@@ -330,7 +330,7 @@ float StyleBuilderConverter::convertFontSizeAdjust(StyleResolverState& state,
return FontBuilder::initialSizeAdjust();
const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- ASSERT(primitiveValue.isNumber());
+ DCHECK(primitiveValue.isNumber());
return primitiveValue.getFloatValue();
}
@@ -438,7 +438,7 @@ StyleBuilderConverter::convertFontVariantLigatures(StyleResolverState&,
ligatures.contextual = FontDescription::EnabledLigaturesState;
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -492,7 +492,7 @@ FontVariantNumeric StyleBuilderConverter::convertFontVariantNumeric(
variantNumeric.setSlashedZero(FontVariantNumeric::SlashedZeroOn);
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -548,7 +548,7 @@ StyleContentAlignmentData StyleBuilderConverter::convertContentAlignmentData(
alignmentData.setPosition(identifierValue.convertTo<ContentPosition>());
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
return alignmentData;
}
@@ -570,7 +570,7 @@ GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&,
const CSSValue& value) {
const CSSValueList& list = toCSSValueList(value);
- ASSERT(list.length() >= 1);
+ DCHECK_GE(list.length(), static_cast<unsigned>(1));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(1) -> 1u
nikhil.sahni 2017/03/30 12:17:58 Done.
const CSSIdentifierValue& first = toCSSIdentifierValue(list.item(0));
const CSSIdentifierValue* second =
list.length() == 2 ? &toCSSIdentifierValue(list.item(1)) : nullptr;
@@ -589,7 +589,7 @@ GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&,
return AutoFlowColumnDense;
return AutoFlowRowDense;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return ComputedStyle::initialGridAutoFlow();
}
}
@@ -613,7 +613,7 @@ GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&,
}
const CSSValueList& values = toCSSValueList(value);
- ASSERT(values.length());
+ DCHECK(values.length());
bool isSpanPosition = false;
// The specification makes the <integer> optional, in which case it default to
@@ -642,7 +642,7 @@ GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&,
++it;
}
- ASSERT(it == values.end());
+ DCHECK_EQ(it, values.end());
if (isSpanPosition)
position.setSpanPosition(gridLineNumber, gridLineName);
else
@@ -675,7 +675,7 @@ static void convertGridLineNamesList(
size_t currentNamedGridLine,
NamedGridLinesMap& namedGridLines,
OrderedNamedGridLines& orderedNamedGridLines) {
- ASSERT(value.isGridLineNamesValue());
+ DCHECK(value.isGridLineNamesValue());
for (auto& namedGridLineValue : toCSSValueList(value)) {
String namedGridLine = toCSSCustomIdentValue(*namedGridLineValue).value();
@@ -726,11 +726,11 @@ void StyleBuilderConverter::convertGridTrackList(
}
if (currValue->isGridAutoRepeatValue()) {
- ASSERT(autoRepeatTrackSizes.isEmpty());
+ DCHECK(autoRepeatTrackSizes.isEmpty());
size_t autoRepeatIndex = 0;
CSSValueID autoRepeatID =
toCSSGridAutoRepeatValue(currValue.get())->autoRepeatID();
- ASSERT(autoRepeatID == CSSValueAutoFill ||
+ DCHECK(autoRepeatID == CSSValueAutoFill ||
autoRepeatID == CSSValueAutoFit);
autoRepeatType = autoRepeatID == CSSValueAutoFill ? AutoFill : AutoFit;
for (auto autoRepeatValue : toCSSValueList(*currValue)) {
@@ -754,13 +754,13 @@ void StyleBuilderConverter::convertGridTrackList(
// The parser should have rejected any <track-list> without any <track-size>
// as this is not conformant to the syntax.
- ASSERT(!trackSizes.isEmpty() || !autoRepeatTrackSizes.isEmpty());
+ DCHECK(!trackSizes.isEmpty() || !autoRepeatTrackSizes.isEmpty());
}
void StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(
const OrderedNamedGridLines& orderedNamedGridLines,
NamedGridLinesMap& namedGridLines) {
- ASSERT(namedGridLines.size() == 0);
+ DCHECK_EQ(namedGridLines.size(), static_cast<unsigned>(0));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(0) -> 0u
nikhil.sahni 2017/03/30 12:17:59 Done.
if (orderedNamedGridLines.size() == 0)
return;
@@ -847,7 +847,7 @@ Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state,
case CSSValueAuto:
return Length(Auto);
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return Length();
}
}
@@ -914,7 +914,7 @@ float StyleBuilderConverter::convertNumberOrPercentage(
StyleResolverState& state,
const CSSValue& value) {
const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- ASSERT(primitiveValue.isNumber() || primitiveValue.isPercentage());
+ DCHECK(primitiveValue.isNumber() || primitiveValue.isPercentage());
if (primitiveValue.isNumber())
return primitiveValue.getFloatValue();
return primitiveValue.getFloatValue() / 100.0f;
@@ -931,7 +931,7 @@ StyleOffsetRotation StyleBuilderConverter::convertOffsetRotate(
StyleOffsetRotation result(0, OffsetRotationFixed);
const CSSValueList& list = toCSSValueList(value);
- ASSERT(list.length() == 1 || list.length() == 2);
+ DCHECK(list.length() == 1 || list.length() == 2);
for (const auto& item : list) {
if (item->isIdentifierValue() &&
toCSSIdentifierValue(*item).getValueID() == CSSValueAuto) {
@@ -998,7 +998,7 @@ EPaintOrder StyleBuilderConverter::convertPaintOrder(
return orderTypeList.length() > 1 ? PaintOrderMarkersStrokeFill
: PaintOrderMarkersFillStroke;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return PaintOrderNormal;
}
}
@@ -1131,7 +1131,7 @@ ShapeValue* StyleBuilderConverter::convertShapeValue(StyleResolverState& state,
if (shape)
return ShapeValue::createShapeValue(shape.release(), cssBox);
- ASSERT(cssBox != BoxMissing);
+ DCHECK_NE(cssBox, BoxMissing);
return ShapeValue::createBoxShapeValue(cssBox);
}
@@ -1278,7 +1278,7 @@ PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::convertTranslate(
return nullptr;
}
const CSSValueList& list = toCSSValueList(value);
- ASSERT(list.length() <= 3);
+ DCHECK_LE(list.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.
Length tx = convertLength(state, list.item(0));
Length ty(0, Fixed);
double tz = 0;
@@ -1299,7 +1299,7 @@ Rotation StyleBuilderConverter::convertRotation(const CSSValue& value) {
}
const CSSValueList& list = toCSSValueList(value);
- ASSERT(list.length() == 1 || list.length() == 4);
+ DCHECK(list.length() == 1 || list.length() == 4);
double x = 0;
double y = 0;
double z = 1;
@@ -1334,7 +1334,7 @@ PassRefPtr<ScaleTransformOperation> StyleBuilderConverter::convertScale(
}
const CSSValueList& list = toCSSValueList(value);
- ASSERT(list.length() <= 3);
+ DCHECK_LE(list.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.
double sx = toCSSPrimitiveValue(list.item(0)).getDoubleValue();
double sy = 1;
double sz = 1;

Powered by Google App Engine
This is Rietveld 408576698