Index: third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
index 7887781901993dfdfa18d81660c95b5f9c319f19..fb0ddca8c28ac88f5e360621d30a5572dda1150d 100644 |
--- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
+++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
@@ -151,7 +151,8 @@ static void replaceColorHintsWithColorStops( |
// The current index of the stops vector. |
size_t x = i + indexOffset; |
- ASSERT(x >= 1); |
+ DCHECK(x >= |
+ 1); ////DCHECK_GE giving error for const unsigned int and const int |
Srirama
2017/03/16 14:22:23
remove this comment and add review comment.
|
// offsetLeft offset offsetRight |
// |-------------------|---------------------------------| |
@@ -167,7 +168,8 @@ static void replaceColorHintsWithColorStops( |
Color leftColor = stops[x - 1].color; |
Color rightColor = stops[x + 1].color; |
- ASSERT(offsetLeft <= offset && offset <= offsetRight); |
+ DCHECK_LE(offsetLeft, offset); |
+ DCHECK_LE(offset, offsetRight); |
if (WebCoreFloatNearlyEqual(leftDist, rightDist)) { |
stops.remove(x); |
@@ -225,7 +227,7 @@ static Color resolveStopColor(const CSSValue& stopColor, |
void CSSGradientValue::addDeprecatedStops(Gradient* gradient, |
const LayoutObject& object) { |
- ASSERT(m_gradientType == CSSDeprecatedLinearGradient || |
+ DCHECK(m_gradientType == CSSDeprecatedLinearGradient || |
m_gradientType == CSSDeprecatedRadialGradient); |
if (!m_stopsSorted) { |
@@ -267,7 +269,8 @@ static bool requiresStopsNormalization(const Vector<GradientStop>& stops, |
// gradient. |
static bool normalizeAndAddStops(const Vector<GradientStop>& stops, |
Gradient* gradient) { |
- ASSERT(stops.size() > 1); |
+ DCHECK(stops.size() > |
+ 1); ////DCHECK_GT giving error for const unsigned int and const int |
Srirama
2017/03/16 14:22:24
ditto
|
const float firstOffset = stops.front().offset; |
const float lastOffset = stops.back().offset; |
@@ -288,14 +291,15 @@ static bool normalizeAndAddStops(const Vector<GradientStop>& stops, |
return false; |
} |
- ASSERT(span > 0); |
+ DCHECK_GT(span, 0); |
for (size_t i = 0; i < stops.size(); ++i) { |
const float normalizedOffset = (stops[i].offset - firstOffset) / span; |
// stop offsets should be monotonically increasing in [0 , 1] |
- ASSERT(normalizedOffset >= 0 && normalizedOffset <= 1); |
- ASSERT(i == 0 || |
+ DCHECK_GE(normalizedOffset, 0); |
+ DCHECK_LE(normalizedOffset, 1); |
+ DCHECK(i == 0 || |
normalizedOffset >= (stops[i - 1].offset - firstOffset) / span); |
gradient->addColorStop(normalizedOffset, stops[i].color); |
@@ -315,7 +319,7 @@ static void clampNegativeOffsets(Vector<GradientStop>& stops) { |
if (i > 0) { |
// We found the negative -> positive offset transition: compute an |
// interpolated color value for 0 and use it with the last clamped stop. |
- ASSERT(lastNegativeOffset < 0); |
+ DCHECK_LT(lastNegativeOffset, 0); |
float lerpRatio = |
-lastNegativeOffset / (currentOffset - lastNegativeOffset); |
stops[i - 1].color = |
@@ -335,8 +339,8 @@ static void clampNegativeOffsets(Vector<GradientStop>& stops) { |
static void adjustGradientPointsForOffsetRange(Gradient* gradient, |
float firstOffset, |
float lastOffset) { |
- ASSERT(!gradient->isRadial()); |
- ASSERT(firstOffset <= lastOffset); |
+ DCHECK(!gradient->isRadial()); |
+ DCHECK(firstOffset <= lastOffset); |
const FloatPoint p0 = gradient->p0(); |
const FloatPoint p1 = gradient->p1(); |
@@ -351,20 +355,20 @@ static void adjustGradientPointsForOffsetRange(Gradient* gradient, |
static void adjustGradientRadiiForOffsetRange(Gradient* gradient, |
float firstOffset, |
float lastOffset) { |
- ASSERT(gradient->isRadial()); |
- ASSERT(firstOffset <= lastOffset); |
+ DCHECK(gradient->isRadial()); |
+ DCHECK_LE(firstOffset, lastOffset); |
// Radial offsets are relative to the [0 , endRadius] segment. |
float adjustedR0 = gradient->endRadius() * firstOffset; |
float adjustedR1 = gradient->endRadius() * lastOffset; |
- ASSERT(adjustedR0 <= adjustedR1); |
+ DCHECK_LE(adjustedR0, adjustedR1); |
// Unlike linear gradients (where we can adjust the points arbitrarily), |
// we cannot let our radii turn negative here. |
if (adjustedR0 < 0) { |
// For the non-repeat case, this can never happen: clampNegativeOffsets() |
// ensures we don't have to deal with negative offsets at this point. |
- ASSERT(gradient->spreadMethod() == SpreadMethodRepeat); |
+ DCHECK_EQ(gradient->spreadMethod(), SpreadMethodRepeat); |
// When in repeat mode, we deal with it by repositioning both radii in the |
// positive domain - shifting them by a multiple of the radius span (which |
@@ -375,8 +379,8 @@ static void adjustGradientRadiiForOffsetRange(Gradient* gradient, |
adjustedR0 += shiftToPositive; |
adjustedR1 += shiftToPositive; |
} |
- ASSERT(adjustedR0 >= 0); |
- ASSERT(adjustedR1 >= adjustedR0); |
+ DCHECK_GE(adjustedR0, 0); |
+ DCHECK_GE(adjustedR1, adjustedR0); |
gradient->setStartRadius(adjustedR0); |
gradient->setEndRadius(adjustedR1); |
@@ -428,7 +432,7 @@ void CSSGradientValue::addStops(Gradient* gradient, |
->evaluate(gradientLength); |
stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0; |
} else { |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
stops[i].offset = 0; |
} |
stops[i].specified = true; |
@@ -461,7 +465,8 @@ void CSSGradientValue::addStops(Gradient* gradient, |
} |
} |
- ASSERT(stops.front().specified && stops.back().specified); |
+ DCHECK(stops.front().specified); |
+ DCHECK(stops.back().specified); |
// If any color-stop still does not have a position, then, for each run of |
// adjacent color-stops without positions, set their positions so that they |
@@ -494,7 +499,7 @@ void CSSGradientValue::addStops(Gradient* gradient, |
} |
} |
- ASSERT(stops.size() == m_stops.size()); |
+ DCHECK_EQ(stops.size(), m_stops.size()); |
if (hasHints) { |
replaceColorHintsWithColorStops(stops, m_stops); |
} |
@@ -816,7 +821,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient( |
const CSSToLengthConversionData& conversionData, |
const IntSize& size, |
const LayoutObject& object) { |
- ASSERT(!size.isEmpty()); |
+ DCHECK(!size.isEmpty()); |
FloatPoint firstPoint; |
FloatPoint secondPoint; |
@@ -874,7 +879,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient( |
secondPoint.setY(size.height()); |
break; |
default: |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
} |
} |
@@ -1118,7 +1123,7 @@ FloatSize radiusToSide(const FloatPoint& point, |
if (shape == CircleEndShape) |
return compare(dx, dy) ? FloatSize(dx, dx) : FloatSize(dy, dy); |
- ASSERT(shape == EllipseEndShape); |
+ DCHECK_EQ(shape, EllipseEndShape); |
return FloatSize(dx, dy); |
} |
@@ -1160,7 +1165,7 @@ FloatSize radiusToCorner(const FloatPoint& point, |
if (shape == CircleEndShape) |
return FloatSize(distance, distance); |
- ASSERT(shape == EllipseEndShape); |
+ DCHECK_EQ(shape, EllipseEndShape); |
// If the end shape is an ellipse, the gradient-shape has the same ratio of |
// width to height that it would if closest-side or farthest-side were |
// specified, as appropriate. |
@@ -1177,7 +1182,7 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient( |
const CSSToLengthConversionData& conversionData, |
const IntSize& size, |
const LayoutObject& object) { |
- ASSERT(!size.isEmpty()); |
+ DCHECK(!size.isEmpty()); |
FloatPoint firstPoint = |
computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); |