| Index: third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
|
| index 8a1975bf44a42acf0b6d8bbb7edd09cfe5d4c55b..5501da5b3b10d193503edca62689916e742621f6 100644
|
| --- a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
|
| +++ b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "core/css/CSSBasicShapeValues.h"
|
| #include "core/css/resolver/StyleResolverState.h"
|
| #include "core/style/BasicShapes.h"
|
| +#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -72,25 +73,25 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(BasicShapeNonInterpolableValue);
|
|
|
| namespace {
|
|
|
| -PassOwnPtr<InterpolableValue> unwrap(InterpolationValue&& value)
|
| +std::unique_ptr<InterpolableValue> unwrap(InterpolationValue&& value)
|
| {
|
| ASSERT(value.interpolableValue);
|
| return std::move(value.interpolableValue);
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate)
|
| +std::unique_ptr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate)
|
| {
|
| if (coordinate)
|
| return unwrap(CSSPositionAxisListInterpolationType::convertPositionAxisCSSValue(*coordinate));
|
| return unwrap(CSSLengthInterpolationType::maybeConvertLength(Length(50, Percent), 1));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom)
|
| +std::unique_ptr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom)
|
| {
|
| return unwrap(CSSLengthInterpolationType::maybeConvertLength(coordinate.computedLength(), zoom));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralInterpolableCoordinate()
|
| +std::unique_ptr<InterpolableValue> createNeutralInterpolableCoordinate()
|
| {
|
| return CSSLengthInterpolationType::createNeutralInterpolableValue();
|
| }
|
| @@ -102,21 +103,21 @@ BasicShapeCenterCoordinate createCoordinate(const InterpolableValue& interpolabl
|
| CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius)
|
| +std::unique_ptr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius)
|
| {
|
| if (!radius || radius->isValueID())
|
| return nullptr;
|
| return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*radius));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom)
|
| +std::unique_ptr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom)
|
| {
|
| if (radius.type() != BasicShapeRadius::Value)
|
| return nullptr;
|
| return unwrap(CSSLengthInterpolationType::maybeConvertLength(radius.value(), zoom));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralInterpolableRadius()
|
| +std::unique_ptr<InterpolableValue> createNeutralInterpolableRadius()
|
| {
|
| return CSSLengthInterpolationType::createNeutralInterpolableValue();
|
| }
|
| @@ -126,24 +127,24 @@ BasicShapeRadius createRadius(const InterpolableValue& interpolableValue, const
|
| return BasicShapeRadius(CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData, ValueRangeNonNegative));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCSSLength(const CSSValue* length)
|
| +std::unique_ptr<InterpolableValue> convertCSSLength(const CSSValue* length)
|
| {
|
| if (!length)
|
| return CSSLengthInterpolationType::createNeutralInterpolableValue();
|
| return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*length));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertLength(const Length& length, double zoom)
|
| +std::unique_ptr<InterpolableValue> convertLength(const Length& length, double zoom)
|
| {
|
| return unwrap(CSSLengthInterpolationType::maybeConvertLength(length, zoom));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair)
|
| +std::unique_ptr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair)
|
| {
|
| return convertCSSLength(pair ? &pair->first() : nullptr);
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair)
|
| +std::unique_ptr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair)
|
| {
|
| return convertCSSLength(pair ? &pair->second() : nullptr);
|
| }
|
| @@ -166,11 +167,11 @@ enum CircleComponentIndex {
|
|
|
| InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| list->set(CircleCenterXIndex, convertCSSCoordinate(circle.centerX()));
|
| list->set(CircleCenterYIndex, convertCSSCoordinate(circle.centerY()));
|
|
|
| - OwnPtr<InterpolableValue> radius;
|
| + std::unique_ptr<InterpolableValue> radius;
|
| if (!(radius = convertCSSRadius(circle.radius())))
|
| return nullptr;
|
| list->set(CircleRadiusIndex, std::move(radius));
|
| @@ -180,11 +181,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle)
|
|
|
| InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| list->set(CircleCenterXIndex, convertCoordinate(circle.centerX(), zoom));
|
| list->set(CircleCenterYIndex, convertCoordinate(circle.centerY(), zoom));
|
|
|
| - OwnPtr<InterpolableValue> radius;
|
| + std::unique_ptr<InterpolableValue> radius;
|
| if (!(radius = convertRadius(circle.radius(), zoom)))
|
| return nullptr;
|
| list->set(CircleRadiusIndex, std::move(radius));
|
| @@ -192,9 +193,9 @@ InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom
|
| return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeCircleType));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralValue()
|
| +std::unique_ptr<InterpolableValue> createNeutralValue()
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount);
|
| list->set(CircleCenterXIndex, createNeutralInterpolableCoordinate());
|
| list->set(CircleCenterYIndex, createNeutralInterpolableCoordinate());
|
| list->set(CircleRadiusIndex, createNeutralInterpolableRadius());
|
| @@ -225,11 +226,11 @@ enum EllipseComponentIndex {
|
|
|
| InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| list->set(EllipseCenterXIndex, convertCSSCoordinate(ellipse.centerX()));
|
| list->set(EllipseCenterYIndex, convertCSSCoordinate(ellipse.centerY()));
|
|
|
| - OwnPtr<InterpolableValue> radius;
|
| + std::unique_ptr<InterpolableValue> radius;
|
| if (!(radius = convertCSSRadius(ellipse.radiusX())))
|
| return nullptr;
|
| list->set(EllipseRadiusXIndex, std::move(radius));
|
| @@ -242,11 +243,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse)
|
|
|
| InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zoom)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| list->set(EllipseCenterXIndex, convertCoordinate(ellipse.centerX(), zoom));
|
| list->set(EllipseCenterYIndex, convertCoordinate(ellipse.centerY(), zoom));
|
|
|
| - OwnPtr<InterpolableValue> radius;
|
| + std::unique_ptr<InterpolableValue> radius;
|
| if (!(radius = convertRadius(ellipse.radiusX(), zoom)))
|
| return nullptr;
|
| list->set(EllipseRadiusXIndex, std::move(radius));
|
| @@ -257,9 +258,9 @@ InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zo
|
| return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeEllipseType));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralValue()
|
| +std::unique_ptr<InterpolableValue> createNeutralValue()
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount);
|
| list->set(EllipseCenterXIndex, createNeutralInterpolableCoordinate());
|
| list->set(EllipseCenterYIndex, createNeutralInterpolableCoordinate());
|
| list->set(EllipseRadiusXIndex, createNeutralInterpolableRadius());
|
| @@ -300,7 +301,7 @@ enum InsetComponentIndex {
|
|
|
| InterpolationValue convertCSSValue(const CSSBasicShapeInsetValue& inset)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| list->set(InsetTopIndex, convertCSSLength(inset.top()));
|
| list->set(InsetRightIndex, convertCSSLength(inset.right()));
|
| list->set(InsetBottomIndex, convertCSSLength(inset.bottom()));
|
| @@ -319,7 +320,7 @@ InterpolationValue convertCSSValue(const CSSBasicShapeInsetValue& inset)
|
|
|
| InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| list->set(InsetTopIndex, convertLength(inset.top(), zoom));
|
| list->set(InsetRightIndex, convertLength(inset.right(), zoom));
|
| list->set(InsetBottomIndex, convertLength(inset.bottom(), zoom));
|
| @@ -336,9 +337,9 @@ InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom)
|
| return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeInsetType));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralValue()
|
| +std::unique_ptr<InterpolableValue> createNeutralValue()
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount);
|
| list->set(InsetTopIndex, CSSLengthInterpolationType::createNeutralInterpolableValue());
|
| list->set(InsetRightIndex, CSSLengthInterpolationType::createNeutralInterpolableValue());
|
| list->set(InsetBottomIndex, CSSLengthInterpolationType::createNeutralInterpolableValue());
|
| @@ -378,7 +379,7 @@ namespace PolygonFunctions {
|
| InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon)
|
| {
|
| size_t size = polygon.values().size();
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(size);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(size);
|
| for (size_t i = 0; i < size; i++)
|
| list->set(i, convertCSSLength(polygon.values()[i].get()));
|
| return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size));
|
| @@ -387,15 +388,15 @@ InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon)
|
| InterpolationValue convertBasicShape(const BasicShapePolygon& polygon, double zoom)
|
| {
|
| size_t size = polygon.values().size();
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(size);
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(size);
|
| for (size_t i = 0; i < size; i++)
|
| list->set(i, convertLength(polygon.values()[i], zoom));
|
| return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size));
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue)
|
| +std::unique_ptr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue)
|
| {
|
| - OwnPtr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size());
|
| + std::unique_ptr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size());
|
| for (size_t i = 0; i < nonInterpolableValue.size(); i++)
|
| list->set(i, CSSLengthInterpolationType::createNeutralInterpolableValue());
|
| return std::move(list);
|
| @@ -453,7 +454,7 @@ InterpolationValue BasicShapeInterpolationFunctions::maybeConvertBasicShape(cons
|
| }
|
| }
|
|
|
| -PassOwnPtr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue)
|
| +std::unique_ptr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue)
|
| {
|
| const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNonInterpolableValue(untypedNonInterpolableValue);
|
| switch (nonInterpolableValue.type()) {
|
|
|