Index: ui/gfx/size_base.h |
diff --git a/ui/gfx/size_base.h b/ui/gfx/size_base.h |
index cd7221c345ec701349fbfec0bd317fdc8020fa64..546070a64a86afcdc1102be3ecce89adba665b6a 100644 |
--- a/ui/gfx/size_base.h |
+++ b/ui/gfx/size_base.h |
@@ -32,24 +32,17 @@ class UI_EXPORT SizeBase { |
set_height(height_ + height); |
} |
- void set_width(Type width) { width_ = width; } |
- void set_height(Type height) { height_ = height; } |
+ void set_width(Type width) { width_ = width < 0 ? 0 : width; } |
sky
2012/11/09 17:03:55
Where we previously doing this? I thought previous
danakj
2012/11/09 17:06:57
There were DCHECKs previously.
|
+ void set_height(Type height) { height_ = height < 0 ? 0 : height; } |
bool IsEmpty() const { |
- return (width_ <= 0) || (height_ <= 0); |
- } |
- |
- void ClampToNonNegative() { |
- if (width_ < 0) |
- width_ = 0; |
- if (height_ < 0) |
- height_ = 0; |
+ return (width_ == 0) || (height_ == 0); |
} |
protected: |
SizeBase(Type width, Type height) |
- : width_(width), |
- height_(height) {} |
+ : width_(width < 0 ? 0 : width), |
+ height_(height < 0 ? 0 : height) {} |
// Destructor is intentionally made non virtual and protected. |
// Do not make this public. |