Chromium Code Reviews| 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 57a1683cfa39ceccfb4a830ad588ec063c55f3a4..e435a72333209bad6c92221f68fc158822418bad 100644 |
| --- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
| +++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp |
| @@ -481,7 +481,7 @@ void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionD |
| } |
| } |
| -static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal) |
| +static float positionFromValue(const CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal) |
| { |
| int origin = 0; |
| int sign = 1; |
| @@ -489,10 +489,11 @@ static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& |
| // In this case the center of the gradient is given relative to an edge in the form of: |
| // [ top | bottom | right | left ] [ <percentage> | <length> ]. |
| + const CSSValue* localValue = value; |
|
nainar
2016/07/18 01:47:00
As per IRL conversation we can just modify value a
|
| if (value->isValuePair()) { |
| - CSSValuePair& pair = toCSSValuePair(*value); |
| + const CSSValuePair& pair = toCSSValuePair(*value); |
| CSSValueID originID = toCSSPrimitiveValue(pair.first()).getValueID(); |
| - value = &pair.second(); |
| + localValue = &pair.second(); |
| if (originID == CSSValueRight || originID == CSSValueBottom) { |
| // For right/bottom, the offset is relative to the far edge. |
| @@ -501,7 +502,7 @@ static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& |
| } |
| } |
| - CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| + const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(localValue); |
| if (primitiveValue->isNumber()) |
| return origin + sign * primitiveValue->getFloatValue() * conversionData.zoom(); |