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

Unified Diff: sdk/lib/math/rectangle.dart

Issue 228533002: Fix assert in dart:math/Rectangle. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/math/rectangle_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/math/rectangle.dart
diff --git a/sdk/lib/math/rectangle.dart b/sdk/lib/math/rectangle.dart
index 6c7bbb4d9dd79a18968bf90ba86589c60665df8a..1ab292a29afc534775eb8434d86c8151f720fed9 100644
--- a/sdk/lib/math/rectangle.dart
+++ b/sdk/lib/math/rectangle.dart
@@ -148,8 +148,8 @@ class Rectangle<T extends num> extends _RectangleBase<T> {
* point `(left, top)`.
*/
const Rectangle(this.left, this.top, T width, T height)
- : this.width = (width >= 0) ? width : -width * 0, // Inline _clampToZero.
- this.height = (height >= 0) ? height : -height * 0;
+ : this.width = (width < 0) ? -width * 0 : width, // Inline _clampToZero.
+ this.height = (height < 0) ? -height * 0 : height;
/**
* Create a rectangle spanned by the points [a] and [b];
@@ -209,8 +209,8 @@ class MutableRectangle<T extends num> extends _RectangleBase<T>
* point `(left, top)`.
*/
MutableRectangle(this.left, this.top, T width, T height)
- : this._width = (width >= 0) ? width : _clampToZero(width),
- this._height = (height >= 0) ? height : _clampToZero(height);
+ : this._width = (width < 0) ? _clampToZero(width) : width,
+ this._height = (height < 0) ? _clampToZero(height) : height;
/**
* Create a mutable rectangle spanned by the points [a] and [b];
« no previous file with comments | « no previous file | tests/lib/math/rectangle_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698