| Index: third_party/WebKit/Source/core/layout/shapes/Shape.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
|
| index 76e973ce3fdce7c00b4c9e779e66e7e7a90f7dd4..37602c622f7aeb3feed3a4a1094150a16641936f 100644
|
| --- a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
|
| @@ -45,32 +45,33 @@
|
| #include "platform/graphics/GraphicsTypes.h"
|
| #include "platform/graphics/ImageBuffer.h"
|
| #include "wtf/MathExtras.h"
|
| -#include "wtf/OwnPtr.h"
|
| +#include "wtf/PtrUtil.h"
|
| #include "wtf/typed_arrays/ArrayBufferContents.h"
|
| +#include <memory>
|
|
|
| namespace blink {
|
|
|
| -static PassOwnPtr<Shape> createInsetShape(const FloatRoundedRect& bounds)
|
| +static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds)
|
| {
|
| ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
|
| - return adoptPtr(new BoxShape(bounds));
|
| + return wrapUnique(new BoxShape(bounds));
|
| }
|
|
|
| -static PassOwnPtr<Shape> createCircleShape(const FloatPoint& center, float radius)
|
| +static std::unique_ptr<Shape> createCircleShape(const FloatPoint& center, float radius)
|
| {
|
| ASSERT(radius >= 0);
|
| - return adoptPtr(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius)));
|
| + return wrapUnique(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius)));
|
| }
|
|
|
| -static PassOwnPtr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii)
|
| +static std::unique_ptr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii)
|
| {
|
| ASSERT(radii.width() >= 0 && radii.height() >= 0);
|
| - return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii));
|
| + return wrapUnique(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii));
|
| }
|
|
|
| -static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule)
|
| +static std::unique_ptr<Shape> createPolygonShape(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule)
|
| {
|
| - return adoptPtr(new PolygonShape(std::move(vertices), fillRule));
|
| + return wrapUnique(new PolygonShape(std::move(vertices), fillRule));
|
| }
|
|
|
| static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logicalBoxHeight, WritingMode writingMode)
|
| @@ -98,14 +99,14 @@ static inline FloatSize physicalSizeToLogical(const FloatSize& size, WritingMode
|
| return size.transposedSize();
|
| }
|
|
|
| -PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin)
|
| +std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin)
|
| {
|
| ASSERT(basicShape);
|
|
|
| bool horizontalWritingMode = isHorizontalWritingMode(writingMode);
|
| float boxWidth = horizontalWritingMode ? logicalBoxSize.width().toFloat() : logicalBoxSize.height().toFloat();
|
| float boxHeight = horizontalWritingMode ? logicalBoxSize.height().toFloat() : logicalBoxSize.width().toFloat();
|
| - OwnPtr<Shape> shape;
|
| + std::unique_ptr<Shape> shape;
|
|
|
| switch (basicShape->type()) {
|
|
|
| @@ -135,7 +136,7 @@ PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS
|
| const Vector<Length>& values = polygon->values();
|
| size_t valuesSize = values.size();
|
| ASSERT(!(valuesSize % 2));
|
| - OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(valuesSize / 2));
|
| + std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<FloatPoint>(valuesSize / 2));
|
| for (unsigned i = 0; i < valuesSize; i += 2) {
|
| FloatPoint vertex(
|
| floatValueForLength(values.at(i), boxWidth),
|
| @@ -179,22 +180,22 @@ PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS
|
| return shape;
|
| }
|
|
|
| -PassOwnPtr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin)
|
| +std::unique_ptr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin)
|
| {
|
| - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(0, 0));
|
| - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), IntSize()));
|
| + std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(0, 0));
|
| + std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), IntSize()));
|
| rasterShape->m_writingMode = writingMode;
|
| rasterShape->m_margin = margin;
|
| return std::move(rasterShape);
|
| }
|
|
|
| -PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin)
|
| +std::unique_ptr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin)
|
| {
|
| IntRect imageRect = pixelSnappedIntRect(imageR);
|
| IntRect marginRect = pixelSnappedIntRect(marginR);
|
|
|
| - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(marginRect.height(), -marginRect.y()));
|
| - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size());
|
| + std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(marginRect.height(), -marginRect.y()));
|
| + std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size());
|
|
|
| if (image && imageBuffer) {
|
| // FIXME: This is not totally correct but it is needed to prevent shapes
|
| @@ -234,17 +235,17 @@ PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const
|
| }
|
| }
|
|
|
| - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), marginRect.size()));
|
| + std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), marginRect.size()));
|
| rasterShape->m_writingMode = writingMode;
|
| rasterShape->m_margin = margin;
|
| return std::move(rasterShape);
|
| }
|
|
|
| -PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin)
|
| +std::unique_ptr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin)
|
| {
|
| FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
|
| FloatRoundedRect bounds(rect, roundedRect.getRadii());
|
| - OwnPtr<Shape> shape = createInsetShape(bounds);
|
| + std::unique_ptr<Shape> shape = createInsetShape(bounds);
|
| shape->m_writingMode = writingMode;
|
| shape->m_margin = margin;
|
|
|
|
|