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

Unified Diff: Source/core/animation/LengthBoxStyleInterpolation.cpp

Issue 1233363002: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase Created 5 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: Source/core/animation/LengthBoxStyleInterpolation.cpp
diff --git a/Source/core/animation/LengthBoxStyleInterpolation.cpp b/Source/core/animation/LengthBoxStyleInterpolation.cpp
index d3f9724e1867193e91daf3828fa0f84a7360b693..9cf42b9d8e538223c67681e0057e3ca8a7234708 100644
--- a/Source/core/animation/LengthBoxStyleInterpolation.cpp
+++ b/Source/core/animation/LengthBoxStyleInterpolation.cpp
@@ -21,7 +21,7 @@ bool onlyInterpolateBetweenLengthAndCSSValueAuto(Rect& startRect, Rect& endRect)
} // namespace
-PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> LengthBoxStyleInterpolation::maybeCreateFrom(CSSValue& start, CSSValue& end, CSSPropertyID id)
+PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> LengthBoxStyleInterpolation::maybeCreateFrom(const CSSValue& start, const CSSValue& end, CSSPropertyID id)
{
bool startRect = start.isPrimitiveValue() && toCSSPrimitiveValue(start).isRect();
bool endRect = end.isPrimitiveValue() && toCSSPrimitiveValue(end).isRect();
@@ -37,8 +37,8 @@ PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBox
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(numberOfSides);
Rect* rect = toCSSPrimitiveValue(lengthBox).getRectValue();
Rect* matchingRect = toCSSPrimitiveValue(matchingValue).getRectValue();
- CSSPrimitiveValue side[numberOfSides] = { rect->left(), rect->right(), rect->top(), rect->bottom() };
- CSSPrimitiveValue matchingSide[numberOfSides] = { matchingRect->left(), matchingRect->right(), matchingRect->top(), matchingRect->bottom() };
+ const CSSPrimitiveValue side[numberOfSides] = { rect->left(), rect->right(), rect->top(), rect->bottom() };
+ const CSSPrimitiveValue matchingSide[numberOfSides] = { matchingRect->left(), matchingRect->right(), matchingRect->top(), matchingRect->bottom() };
for (size_t i = 0; i < numberOfSides; i++) {
if (side[i].isValueID() || matchingSide[i].isValueID()) {
@@ -56,8 +56,8 @@ bool LengthBoxStyleInterpolation::usesDefaultInterpolation(const CSSValue& start
{
if (!start.isPrimitiveValue() || !end.isPrimitiveValue())
return false;
- const CSSPrimitiveValue startValue = toCSSPrimitiveValue(start);
- const CSSPrimitiveValue endValue = toCSSPrimitiveValue(end);
+ const CSSPrimitiveValue& startValue = toCSSPrimitiveValue(start);
+ const CSSPrimitiveValue& endValue = toCSSPrimitiveValue(end);
if ((startValue.isValueID() && startValue.getValueID() == CSSValueAuto)
|| (endValue.isValueID() && endValue.getValueID() == CSSValueAuto))
return true;
@@ -66,7 +66,7 @@ bool LengthBoxStyleInterpolation::usesDefaultInterpolation(const CSSValue& start
namespace {
-CSSPrimitiveValue indexedValueToLength(InterpolableList& lengthBox, size_t i, CSSPrimitiveValue start[], CSSPrimitiveValue end[])
+const CSSPrimitiveValue indexedValueToLength(InterpolableList& lengthBox, size_t i, const CSSPrimitiveValue start[], const CSSPrimitiveValue end[])
{
if (lengthBox.get(i)->isBool()) {
if (toInterpolableBool(lengthBox.get(i))->value())
@@ -83,8 +83,8 @@ CSSValue LengthBoxStyleInterpolation::interpolableValueToLengthBox(InterpolableV
InterpolableList* lengthBox = toInterpolableList(value);
Rect* startRect = toCSSPrimitiveValue(originalStart).getRectValue();
Rect* endRect = toCSSPrimitiveValue(originalEnd).getRectValue();
- CSSPrimitiveValue startSides[4] = { startRect->left(), startRect->right(), startRect->top(), startRect->bottom() };
- CSSPrimitiveValue endSides[4] = { endRect->left(), endRect->right(), endRect->top(), endRect->bottom() };
+ const CSSPrimitiveValue startSides[4] = { startRect->left(), startRect->right(), startRect->top(), startRect->bottom() };
+ const CSSPrimitiveValue endSides[4] = { endRect->left(), endRect->right(), endRect->top(), endRect->bottom() };
RefPtrWillBeRawPtr<Rect> result = Rect::create();
result->setLeft(indexedValueToLength(*lengthBox, 0, startSides, endSides));
« no previous file with comments | « Source/core/animation/LengthBoxStyleInterpolation.h ('k') | Source/core/animation/LengthPairStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698