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

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

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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/ShadowStyleInterpolation.cpp
diff --git a/Source/core/animation/ShadowStyleInterpolation.cpp b/Source/core/animation/ShadowStyleInterpolation.cpp
index 076993991936e6f6eac8d4cc0b430b02d88d8b0a..7026b9dbd35b2799f09bef9030f5991a566040d5 100644
--- a/Source/core/animation/ShadowStyleInterpolation.cpp
+++ b/Source/core/animation/ShadowStyleInterpolation.cpp
@@ -24,33 +24,32 @@ bool ShadowStyleInterpolation::canCreateFrom(const CSSValue& start, const CSSVal
PassOwnPtrWillBeRawPtr<InterpolableValue> ShadowStyleInterpolation::lengthToInterpolableValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> value)
{
if (value)
- return LengthStyleInterpolation::toInterpolableValue(*value);
- return LengthStyleInterpolation::toInterpolableValue(*CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
+ return LengthStyleInterpolation::toInterpolableValue(value);
+ return LengthStyleInterpolation::toInterpolableValue(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
}
PassOwnPtrWillBeRawPtr<InterpolableValue> ShadowStyleInterpolation::toInterpolableValue(const CSSValue& value, NonInterpolableType& nonInterpolableData)
{
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(5);
- const CSSShadowValue* shadowValue = toCSSShadowValue(&value);
- ASSERT(shadowValue);
+ const CSSShadowValue& shadowValue = toCSSShadowValue(value);
- result->set(0, lengthToInterpolableValue(shadowValue->x));
- result->set(1, lengthToInterpolableValue(shadowValue->y));
- result->set(2, lengthToInterpolableValue(shadowValue->blur));
- result->set(3, lengthToInterpolableValue(shadowValue->spread));
+ result->set(0, lengthToInterpolableValue(shadowValue.x));
+ result->set(1, lengthToInterpolableValue(shadowValue.y));
+ result->set(2, lengthToInterpolableValue(shadowValue.blur));
+ result->set(3, lengthToInterpolableValue(shadowValue.spread));
- if (shadowValue->color && ColorStyleInterpolation::canCreateFrom(*shadowValue->color))
- result->set(4, ColorStyleInterpolation::colorToInterpolableValue(*shadowValue->color));
+ if (shadowValue.color && ColorStyleInterpolation::canCreateFrom(CSSValue(*shadowValue.color.get())))
+ result->set(4, ColorStyleInterpolation::colorToInterpolableValue(CSSValue(*shadowValue.color.get())));
- if (shadowValue->style)
- nonInterpolableData = (shadowValue->style->getValueID() == CSSValueInset);
+ if (shadowValue.style)
+ nonInterpolableData = (shadowValue.style->getValueID() == CSSValueInset);
else
nonInterpolableData = false;
return result.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> ShadowStyleInterpolation::fromInterpolableValue(const InterpolableValue& value, NonInterpolableType nonInterpolableData, InterpolationRange range)
+CSSValue ShadowStyleInterpolation::fromInterpolableValue(const InterpolableValue& value, NonInterpolableType nonInterpolableData, InterpolationRange range)
{
const InterpolableList* shadow = toInterpolableList(&value);
RefPtrWillBeRawPtr<CSSPrimitiveValue> x = LengthStyleInterpolation::fromInterpolableValue(*shadow->get(0), RangeAll);
@@ -68,11 +67,11 @@ PassRefPtrWillBeRawPtr<CSSValue> ShadowStyleInterpolation::fromInterpolableValue
bool ShadowStyleInterpolation::usesDefaultStyleInterpolation(const CSSValue& start, const CSSValue& end)
{
if (start.isValueList() && end.isValueList() && toCSSValueList(start).length() == toCSSValueList(end).length()) {
- const CSSValueList* startList = toCSSValueList(&start);
- const CSSValueList* endList = toCSSValueList(&end);
+ const CSSValueList& startList = toCSSValueList(start);
+ const CSSValueList& endList = toCSSValueList(end);
for (size_t i = 0; i < toCSSValueList(start).length(); i++) {
- if (startList->item(i)->isShadowValue() && endList->item(i)->isShadowValue()
- && toCSSShadowValue(startList->item(i))->style != toCSSShadowValue(endList->item(i))->style)
+ if (startList.item(i).isShadowValue() && endList.item(i).isShadowValue()
+ && toCSSShadowValue(startList.item(i)).style != toCSSShadowValue(endList.item(i)).style)
return true;
}
}
« no previous file with comments | « Source/core/animation/ShadowStyleInterpolation.h ('k') | Source/core/animation/ShadowStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698