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

Side by Side Diff: third_party/WebKit/Source/core/style/BasicShapes.cpp

Issue 2957513002: Removed calls to RefPtr::Release in return statements with auto move. (Closed)
Patch Set: rebased Created 3 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 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 PassRefPtr<BasicShape> BasicShapeCircle::Blend(const BasicShape* other, 109 PassRefPtr<BasicShape> BasicShapeCircle::Blend(const BasicShape* other,
110 double progress) const { 110 double progress) const {
111 DCHECK_EQ(GetType(), other->GetType()); 111 DCHECK_EQ(GetType(), other->GetType());
112 const BasicShapeCircle* o = ToBasicShapeCircle(other); 112 const BasicShapeCircle* o = ToBasicShapeCircle(other);
113 RefPtr<BasicShapeCircle> result = BasicShapeCircle::Create(); 113 RefPtr<BasicShapeCircle> result = BasicShapeCircle::Create();
114 114
115 result->SetCenterX(center_x_.Blend(o->CenterX(), progress)); 115 result->SetCenterX(center_x_.Blend(o->CenterX(), progress));
116 result->SetCenterY(center_y_.Blend(o->CenterY(), progress)); 116 result->SetCenterY(center_y_.Blend(o->CenterY(), progress));
117 result->SetRadius(radius_.Blend(o->Radius(), progress)); 117 result->SetRadius(radius_.Blend(o->Radius(), progress));
118 return result.Release(); 118 return result;
119 } 119 }
120 120
121 bool BasicShapeEllipse::operator==(const BasicShape& o) const { 121 bool BasicShapeEllipse::operator==(const BasicShape& o) const {
122 if (!IsSameType(o)) 122 if (!IsSameType(o))
123 return false; 123 return false;
124 const BasicShapeEllipse& other = ToBasicShapeEllipse(o); 124 const BasicShapeEllipse& other = ToBasicShapeEllipse(o);
125 return center_x_ == other.center_x_ && center_y_ == other.center_y_ && 125 return center_x_ == other.center_x_ && center_y_ == other.center_y_ &&
126 radius_x_ == other.radius_x_ && radius_y_ == other.radius_y_; 126 radius_x_ == other.radius_x_ && radius_y_ == other.radius_y_;
127 } 127 }
128 128
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 result->SetCenterY(o->CenterY()); 168 result->SetCenterY(o->CenterY());
169 result->SetRadiusX(o->RadiusX()); 169 result->SetRadiusX(o->RadiusX());
170 result->SetRadiusY(o->RadiusY()); 170 result->SetRadiusY(o->RadiusY());
171 return result; 171 return result;
172 } 172 }
173 173
174 result->SetCenterX(center_x_.Blend(o->CenterX(), progress)); 174 result->SetCenterX(center_x_.Blend(o->CenterX(), progress));
175 result->SetCenterY(center_y_.Blend(o->CenterY(), progress)); 175 result->SetCenterY(center_y_.Blend(o->CenterY(), progress));
176 result->SetRadiusX(radius_x_.Blend(o->RadiusX(), progress)); 176 result->SetRadiusX(radius_x_.Blend(o->RadiusX(), progress));
177 result->SetRadiusY(radius_y_.Blend(o->RadiusY(), progress)); 177 result->SetRadiusY(radius_y_.Blend(o->RadiusY(), progress));
178 return result.Release(); 178 return result;
179 } 179 }
180 180
181 void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) { 181 void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) {
182 DCHECK(path.IsEmpty()); 182 DCHECK(path.IsEmpty());
183 DCHECK(!(values_.size() % 2)); 183 DCHECK(!(values_.size() % 2));
184 size_t length = values_.size(); 184 size_t length = values_.size();
185 185
186 if (!length) 186 if (!length)
187 return; 187 return;
188 188
(...skipping 17 matching lines...) Expand all
206 DCHECK(other); 206 DCHECK(other);
207 DCHECK(IsSameType(*other)); 207 DCHECK(IsSameType(*other));
208 208
209 const BasicShapePolygon* o = ToBasicShapePolygon(other); 209 const BasicShapePolygon* o = ToBasicShapePolygon(other);
210 DCHECK_EQ(values_.size(), o->Values().size()); 210 DCHECK_EQ(values_.size(), o->Values().size());
211 DCHECK(!(values_.size() % 2)); 211 DCHECK(!(values_.size() % 2));
212 212
213 size_t length = values_.size(); 213 size_t length = values_.size();
214 RefPtr<BasicShapePolygon> result = BasicShapePolygon::Create(); 214 RefPtr<BasicShapePolygon> result = BasicShapePolygon::Create();
215 if (!length) 215 if (!length)
216 return result.Release(); 216 return result;
217 217
218 result->SetWindRule(o->GetWindRule()); 218 result->SetWindRule(o->GetWindRule());
219 219
220 for (size_t i = 0; i < length; i = i + 2) { 220 for (size_t i = 0; i < length; i = i + 2) {
221 result->AppendPoint( 221 result->AppendPoint(
222 values_.at(i).Blend(o->Values().at(i), progress, kValueRangeAll), 222 values_.at(i).Blend(o->Values().at(i), progress, kValueRangeAll),
223 values_.at(i + 1).Blend(o->Values().at(i + 1), progress, 223 values_.at(i + 1).Blend(o->Values().at(i + 1), progress,
224 kValueRangeAll)); 224 kValueRangeAll));
225 } 225 }
226 226
227 return result.Release(); 227 return result;
228 } 228 }
229 229
230 bool BasicShapePolygon::operator==(const BasicShape& o) const { 230 bool BasicShapePolygon::operator==(const BasicShape& o) const {
231 if (!IsSameType(o)) 231 if (!IsSameType(o))
232 return false; 232 return false;
233 const BasicShapePolygon& other = ToBasicShapePolygon(o); 233 const BasicShapePolygon& other = ToBasicShapePolygon(o);
234 return wind_rule_ == other.wind_rule_ && values_ == other.values_; 234 return wind_rule_ == other.wind_rule_ && values_ == other.values_;
235 } 235 }
236 236
237 static FloatSize FloatSizeForLengthSize(const LengthSize& length_size, 237 static FloatSize FloatSizeForLengthSize(const LengthSize& length_size,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 result->SetTopLeftRadius( 288 result->SetTopLeftRadius(
289 BlendLengthSize(top_left_radius_, other_inset.TopLeftRadius(), progress)); 289 BlendLengthSize(top_left_radius_, other_inset.TopLeftRadius(), progress));
290 result->SetTopRightRadius(BlendLengthSize( 290 result->SetTopRightRadius(BlendLengthSize(
291 top_right_radius_, other_inset.TopRightRadius(), progress)); 291 top_right_radius_, other_inset.TopRightRadius(), progress));
292 result->SetBottomRightRadius(BlendLengthSize( 292 result->SetBottomRightRadius(BlendLengthSize(
293 bottom_right_radius_, other_inset.BottomRightRadius(), progress)); 293 bottom_right_radius_, other_inset.BottomRightRadius(), progress));
294 result->SetBottomLeftRadius(BlendLengthSize( 294 result->SetBottomLeftRadius(BlendLengthSize(
295 bottom_left_radius_, other_inset.BottomLeftRadius(), progress)); 295 bottom_left_radius_, other_inset.BottomLeftRadius(), progress));
296 296
297 return result.Release(); 297 return result;
298 } 298 }
299 299
300 bool BasicShapeInset::operator==(const BasicShape& o) const { 300 bool BasicShapeInset::operator==(const BasicShape& o) const {
301 if (!IsSameType(o)) 301 if (!IsSameType(o))
302 return false; 302 return false;
303 const BasicShapeInset& other = ToBasicShapeInset(o); 303 const BasicShapeInset& other = ToBasicShapeInset(o);
304 return right_ == other.right_ && top_ == other.top_ && 304 return right_ == other.right_ && top_ == other.top_ &&
305 bottom_ == other.bottom_ && left_ == other.left_ && 305 bottom_ == other.bottom_ && left_ == other.left_ &&
306 top_left_radius_ == other.top_left_radius_ && 306 top_left_radius_ == other.top_left_radius_ &&
307 top_right_radius_ == other.top_right_radius_ && 307 top_right_radius_ == other.top_right_radius_ &&
308 bottom_right_radius_ == other.bottom_right_radius_ && 308 bottom_right_radius_ == other.bottom_right_radius_ &&
309 bottom_left_radius_ == other.bottom_left_radius_; 309 bottom_left_radius_ == other.bottom_left_radius_;
310 } 310 }
311 311
312 } // namespace blink 312 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698