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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSGradientValue.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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2015 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 conversion_data, size, layout_object); 146 conversion_data, size, layout_object);
147 break; 147 break;
148 default: 148 default:
149 NOTREACHED(); 149 NOTREACHED();
150 } 150 }
151 151
152 RefPtr<Image> new_image = GradientGeneratedImage::Create(gradient, size); 152 RefPtr<Image> new_image = GradientGeneratedImage::Create(gradient, size);
153 if (is_cacheable_) 153 if (is_cacheable_)
154 PutImage(size, new_image); 154 PutImage(size, new_image);
155 155
156 return new_image.Release(); 156 return new_image;
157 } 157 }
158 158
159 // Should only ever be called for deprecated gradients. 159 // Should only ever be called for deprecated gradients.
160 static inline bool CompareStops(const CSSGradientColorStop& a, 160 static inline bool CompareStops(const CSSGradientColorStop& a,
161 const CSSGradientColorStop& b) { 161 const CSSGradientColorStop& b) {
162 double a_val = a.offset_->GetDoubleValue(); 162 double a_val = a.offset_->GetDoubleValue();
163 double b_val = b.offset_->GetDoubleValue(); 163 double b_val = b.offset_->GetDoubleValue();
164 164
165 return a_val < b_val; 165 return a_val < b_val;
166 } 166 }
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 repeating_ ? kSpreadMethodRepeat : kSpreadMethodPad); 1035 repeating_ ? kSpreadMethodRepeat : kSpreadMethodPad);
1036 AddStops(desc, conversion_data, object); 1036 AddStops(desc, conversion_data, object);
1037 1037
1038 RefPtr<Gradient> gradient = 1038 RefPtr<Gradient> gradient =
1039 Gradient::CreateLinear(desc.p0, desc.p1, desc.spread_method, 1039 Gradient::CreateLinear(desc.p0, desc.p1, desc.spread_method,
1040 Gradient::ColorInterpolation::kPremultiplied); 1040 Gradient::ColorInterpolation::kPremultiplied);
1041 1041
1042 // Now add the stops. 1042 // Now add the stops.
1043 gradient->AddColorStops(desc.stops); 1043 gradient->AddColorStops(desc.stops);
1044 1044
1045 return gradient.Release(); 1045 return gradient;
1046 } 1046 }
1047 1047
1048 bool CSSLinearGradientValue::Equals(const CSSLinearGradientValue& other) const { 1048 bool CSSLinearGradientValue::Equals(const CSSLinearGradientValue& other) const {
1049 if (gradient_type_ == kCSSDeprecatedLinearGradient) 1049 if (gradient_type_ == kCSSDeprecatedLinearGradient)
1050 return other.gradient_type_ == gradient_type_ && 1050 return other.gradient_type_ == gradient_type_ &&
1051 DataEquivalent(first_x_, other.first_x_) && 1051 DataEquivalent(first_x_, other.first_x_) &&
1052 DataEquivalent(first_y_, other.first_y_) && 1052 DataEquivalent(first_y_, other.first_y_) &&
1053 DataEquivalent(second_x_, other.second_x_) && 1053 DataEquivalent(second_x_, other.second_x_) &&
1054 DataEquivalent(second_y_, other.second_y_) && stops_ == other.stops_; 1054 DataEquivalent(second_y_, other.second_y_) && stops_ == other.stops_;
1055 1055
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 AddStops(desc, conversion_data, object); 1409 AddStops(desc, conversion_data, object);
1410 1410
1411 RefPtr<Gradient> gradient = Gradient::CreateRadial( 1411 RefPtr<Gradient> gradient = Gradient::CreateRadial(
1412 desc.p0, desc.r0, desc.p1, desc.r1, 1412 desc.p0, desc.r0, desc.p1, desc.r1,
1413 is_degenerate ? 1 : second_radius.AspectRatio(), desc.spread_method, 1413 is_degenerate ? 1 : second_radius.AspectRatio(), desc.spread_method,
1414 Gradient::ColorInterpolation::kPremultiplied); 1414 Gradient::ColorInterpolation::kPremultiplied);
1415 1415
1416 // Now add the stops. 1416 // Now add the stops.
1417 gradient->AddColorStops(desc.stops); 1417 gradient->AddColorStops(desc.stops);
1418 1418
1419 return gradient.Release(); 1419 return gradient;
1420 } 1420 }
1421 1421
1422 bool CSSRadialGradientValue::Equals(const CSSRadialGradientValue& other) const { 1422 bool CSSRadialGradientValue::Equals(const CSSRadialGradientValue& other) const {
1423 if (gradient_type_ == kCSSDeprecatedRadialGradient) 1423 if (gradient_type_ == kCSSDeprecatedRadialGradient)
1424 return other.gradient_type_ == gradient_type_ && 1424 return other.gradient_type_ == gradient_type_ &&
1425 DataEquivalent(first_x_, other.first_x_) && 1425 DataEquivalent(first_x_, other.first_x_) &&
1426 DataEquivalent(first_y_, other.first_y_) && 1426 DataEquivalent(first_y_, other.first_y_) &&
1427 DataEquivalent(second_x_, other.second_x_) && 1427 DataEquivalent(second_x_, other.second_x_) &&
1428 DataEquivalent(second_y_, other.second_y_) && 1428 DataEquivalent(second_y_, other.second_y_) &&
1429 DataEquivalent(first_radius_, other.first_radius_) && 1429 DataEquivalent(first_radius_, other.first_radius_) &&
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 : size.Height() / 2); 1523 : size.Height() / 2);
1524 1524
1525 GradientDesc desc(position, position, 1525 GradientDesc desc(position, position,
1526 repeating_ ? kSpreadMethodRepeat : kSpreadMethodPad); 1526 repeating_ ? kSpreadMethodRepeat : kSpreadMethodPad);
1527 AddStops(desc, conversion_data, object); 1527 AddStops(desc, conversion_data, object);
1528 1528
1529 RefPtr<Gradient> gradient = Gradient::CreateConic( 1529 RefPtr<Gradient> gradient = Gradient::CreateConic(
1530 position, angle, Gradient::ColorInterpolation::kPremultiplied); 1530 position, angle, Gradient::ColorInterpolation::kPremultiplied);
1531 gradient->AddColorStops(desc.stops); 1531 gradient->AddColorStops(desc.stops);
1532 1532
1533 return gradient.Release(); 1533 return gradient;
1534 } 1534 }
1535 1535
1536 bool CSSConicGradientValue::Equals(const CSSConicGradientValue& other) const { 1536 bool CSSConicGradientValue::Equals(const CSSConicGradientValue& other) const {
1537 return repeating_ == other.repeating_ && DataEquivalent(x_, other.x_) && 1537 return repeating_ == other.repeating_ && DataEquivalent(x_, other.x_) &&
1538 DataEquivalent(y_, other.y_) && 1538 DataEquivalent(y_, other.y_) &&
1539 DataEquivalent(from_angle_, other.from_angle_) && 1539 DataEquivalent(from_angle_, other.from_angle_) &&
1540 stops_ == other.stops_; 1540 stops_ == other.stops_;
1541 } 1541 }
1542 1542
1543 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { 1543 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) {
1544 visitor->Trace(x_); 1544 visitor->Trace(x_);
1545 visitor->Trace(y_); 1545 visitor->Trace(y_);
1546 visitor->Trace(from_angle_); 1546 visitor->Trace(from_angle_);
1547 CSSGradientValue::TraceAfterDispatch(visitor); 1547 CSSGradientValue::TraceAfterDispatch(visitor);
1548 } 1548 }
1549 1549
1550 } // namespace blink 1550 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSFontFace.cpp ('k') | third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698