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

Unified Diff: third_party/WebKit/Source/core/css/CSSGradientValue.cpp

Issue 2158723002: Make CSSValuePair store const CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_cssparsersinglevalue_return_const
Patch Set: Created 4 years, 5 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/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();
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp ('k') | third_party/WebKit/Source/core/css/CSSValuePair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698