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

Side by Side Diff: third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp

Issue 2622043003: Replaced RefPtr::release with std::move in Source/core. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 if (basicShapeValue.isBasicShapeCircleValue()) { 238 if (basicShapeValue.isBasicShapeCircleValue()) {
239 const CSSBasicShapeCircleValue& circleValue = 239 const CSSBasicShapeCircleValue& circleValue =
240 toCSSBasicShapeCircleValue(basicShapeValue); 240 toCSSBasicShapeCircleValue(basicShapeValue);
241 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create(); 241 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create();
242 242
243 circle->setCenterX(convertToCenterCoordinate(state, circleValue.centerX())); 243 circle->setCenterX(convertToCenterCoordinate(state, circleValue.centerX()));
244 circle->setCenterY(convertToCenterCoordinate(state, circleValue.centerY())); 244 circle->setCenterY(convertToCenterCoordinate(state, circleValue.centerY()));
245 circle->setRadius(cssValueToBasicShapeRadius(state, circleValue.radius())); 245 circle->setRadius(cssValueToBasicShapeRadius(state, circleValue.radius()));
246 246
247 basicShape = circle.release(); 247 basicShape = std::move(circle);
248 } else if (basicShapeValue.isBasicShapeEllipseValue()) { 248 } else if (basicShapeValue.isBasicShapeEllipseValue()) {
249 const CSSBasicShapeEllipseValue& ellipseValue = 249 const CSSBasicShapeEllipseValue& ellipseValue =
250 toCSSBasicShapeEllipseValue(basicShapeValue); 250 toCSSBasicShapeEllipseValue(basicShapeValue);
251 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create(); 251 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
252 252
253 ellipse->setCenterX( 253 ellipse->setCenterX(
254 convertToCenterCoordinate(state, ellipseValue.centerX())); 254 convertToCenterCoordinate(state, ellipseValue.centerX()));
255 ellipse->setCenterY( 255 ellipse->setCenterY(
256 convertToCenterCoordinate(state, ellipseValue.centerY())); 256 convertToCenterCoordinate(state, ellipseValue.centerY()));
257 ellipse->setRadiusX( 257 ellipse->setRadiusX(
258 cssValueToBasicShapeRadius(state, ellipseValue.radiusX())); 258 cssValueToBasicShapeRadius(state, ellipseValue.radiusX()));
259 ellipse->setRadiusY( 259 ellipse->setRadiusY(
260 cssValueToBasicShapeRadius(state, ellipseValue.radiusY())); 260 cssValueToBasicShapeRadius(state, ellipseValue.radiusY()));
261 261
262 basicShape = ellipse.release(); 262 basicShape = std::move(ellipse);
263 } else if (basicShapeValue.isBasicShapePolygonValue()) { 263 } else if (basicShapeValue.isBasicShapePolygonValue()) {
264 const CSSBasicShapePolygonValue& polygonValue = 264 const CSSBasicShapePolygonValue& polygonValue =
265 toCSSBasicShapePolygonValue(basicShapeValue); 265 toCSSBasicShapePolygonValue(basicShapeValue);
266 RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create(); 266 RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create();
267 267
268 polygon->setWindRule(polygonValue.getWindRule()); 268 polygon->setWindRule(polygonValue.getWindRule());
269 const HeapVector<Member<CSSPrimitiveValue>>& values = polygonValue.values(); 269 const HeapVector<Member<CSSPrimitiveValue>>& values = polygonValue.values();
270 for (unsigned i = 0; i < values.size(); i += 2) 270 for (unsigned i = 0; i < values.size(); i += 2)
271 polygon->appendPoint(convertToLength(state, values.at(i).get()), 271 polygon->appendPoint(convertToLength(state, values.at(i).get()),
272 convertToLength(state, values.at(i + 1).get())); 272 convertToLength(state, values.at(i + 1).get()));
273 273
274 basicShape = polygon.release(); 274 basicShape = std::move(polygon);
275 } else if (basicShapeValue.isBasicShapeInsetValue()) { 275 } else if (basicShapeValue.isBasicShapeInsetValue()) {
276 const CSSBasicShapeInsetValue& rectValue = 276 const CSSBasicShapeInsetValue& rectValue =
277 toCSSBasicShapeInsetValue(basicShapeValue); 277 toCSSBasicShapeInsetValue(basicShapeValue);
278 RefPtr<BasicShapeInset> rect = BasicShapeInset::create(); 278 RefPtr<BasicShapeInset> rect = BasicShapeInset::create();
279 279
280 rect->setTop(convertToLength(state, rectValue.top())); 280 rect->setTop(convertToLength(state, rectValue.top()));
281 rect->setRight(convertToLength(state, rectValue.right())); 281 rect->setRight(convertToLength(state, rectValue.right()));
282 rect->setBottom(convertToLength(state, rectValue.bottom())); 282 rect->setBottom(convertToLength(state, rectValue.bottom()));
283 rect->setLeft(convertToLength(state, rectValue.left())); 283 rect->setLeft(convertToLength(state, rectValue.left()));
284 284
285 rect->setTopLeftRadius( 285 rect->setTopLeftRadius(
286 convertToLengthSize(state, rectValue.topLeftRadius())); 286 convertToLengthSize(state, rectValue.topLeftRadius()));
287 rect->setTopRightRadius( 287 rect->setTopRightRadius(
288 convertToLengthSize(state, rectValue.topRightRadius())); 288 convertToLengthSize(state, rectValue.topRightRadius()));
289 rect->setBottomRightRadius( 289 rect->setBottomRightRadius(
290 convertToLengthSize(state, rectValue.bottomRightRadius())); 290 convertToLengthSize(state, rectValue.bottomRightRadius()));
291 rect->setBottomLeftRadius( 291 rect->setBottomLeftRadius(
292 convertToLengthSize(state, rectValue.bottomLeftRadius())); 292 convertToLengthSize(state, rectValue.bottomLeftRadius()));
293 293
294 basicShape = rect.release(); 294 basicShape = std::move(rect);
295 } else { 295 } else {
296 ASSERT_NOT_REACHED(); 296 ASSERT_NOT_REACHED();
297 } 297 }
298 298
299 return basicShape.release(); 299 return basicShape.release();
300 } 300 }
301 301
302 FloatPoint floatPointForCenterCoordinate( 302 FloatPoint floatPointForCenterCoordinate(
303 const BasicShapeCenterCoordinate& centerX, 303 const BasicShapeCenterCoordinate& centerX,
304 const BasicShapeCenterCoordinate& centerY, 304 const BasicShapeCenterCoordinate& centerY,
305 FloatSize boxSize) { 305 FloatSize boxSize) {
306 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); 306 float x = floatValueForLength(centerX.computedLength(), boxSize.width());
307 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); 307 float y = floatValueForLength(centerY.computedLength(), boxSize.height());
308 return FloatPoint(x, y); 308 return FloatPoint(x, y);
309 } 309 }
310 310
311 } // namespace blink 311 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698