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

Unified Diff: third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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/animation/CSSColorInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
index 19c508477afb42b87a09ffc61339b8159caf408b..06264b13c8c8efd4a9feb3767c0ac0203e9b8fb5 100644
--- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
@@ -8,6 +8,8 @@
#include "core/css/CSSColorValue.h"
#include "core/css/resolver/StyleResolverState.h"
#include "core/layout/LayoutTheme.h"
+#include "wtf/PtrUtil.h"
+#include <memory>
namespace blink {
@@ -23,18 +25,18 @@ enum InterpolableColorIndex {
InterpolableColorIndexCount,
};
-static PassOwnPtr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index)
+static std::unique_ptr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index)
{
ASSERT(index < InterpolableColorIndexCount);
- OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount);
+ std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount);
for (int i = 0; i < InterpolableColorIndexCount; i++)
list->set(i, InterpolableNumber::create(i == index));
return std::move(list);
}
-PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color)
+std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color)
{
- OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount);
+ std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount);
list->set(Red, InterpolableNumber::create(color.red() * color.alpha()));
list->set(Green, InterpolableNumber::create(color.green() * color.alpha()));
list->set(Blue, InterpolableNumber::create(color.blue() * color.alpha()));
@@ -46,7 +48,7 @@ PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor
return std::move(list);
}
-PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword)
+std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword)
{
switch (keyword) {
case CSSValueCurrentcolor:
@@ -65,14 +67,14 @@ PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor
}
}
-PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color)
+std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color)
{
if (color.isCurrentColor())
return createInterpolableColorForIndex(Currentcolor);
return createInterpolableColor(color.getColor());
}
-PassOwnPtr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value)
+std::unique_ptr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value)
{
if (value.isColorValue())
return createInterpolableColor(toCSSColorValue(value).value());
@@ -135,9 +137,9 @@ Color CSSColorInterpolationType::resolveInterpolableColor(const InterpolableValu
class ParentColorChecker : public InterpolationType::ConversionChecker {
public:
- static PassOwnPtr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color)
+ static std::unique_ptr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color)
{
- return adoptPtr(new ParentColorChecker(property, color));
+ return wrapUnique(new ParentColorChecker(property, color));
}
private:
@@ -187,10 +189,10 @@ InterpolationValue CSSColorInterpolationType::maybeConvertValue(const CSSValue&
if (cssProperty() == CSSPropertyColor && value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueCurrentcolor)
return maybeConvertInherit(state, conversionCheckers);
- OwnPtr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value);
+ std::unique_ptr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value);
if (!interpolableColor)
return nullptr;
- OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount);
+ std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount);
colorPair->set(Unvisited, interpolableColor->clone());
colorPair->set(Visited, std::move(interpolableColor));
return InterpolationValue(std::move(colorPair));
@@ -198,7 +200,7 @@ InterpolationValue CSSColorInterpolationType::maybeConvertValue(const CSSValue&
InterpolationValue CSSColorInterpolationType::convertStyleColorPair(const StyleColor& unvisitedColor, const StyleColor& visitedColor) const
{
- OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount);
+ std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount);
colorPair->set(Unvisited, createInterpolableColor(unvisitedColor));
colorPair->set(Visited, createInterpolableColor(visitedColor));
return InterpolationValue(std::move(colorPair));

Powered by Google App Engine
This is Rietveld 408576698