Chromium Code Reviews| Index: ui/gfx/size_base.h |
| diff --git a/ui/gfx/size_base.h b/ui/gfx/size_base.h |
| index cd7221c345ec701349fbfec0bd317fdc8020fa64..63820b220ef53db12ffe883af492378088c8baab 100644 |
| --- a/ui/gfx/size_base.h |
| +++ b/ui/gfx/size_base.h |
| @@ -35,6 +35,16 @@ class UI_EXPORT SizeBase { |
| void set_width(Type width) { width_ = width; } |
| void set_height(Type height) { height_ = height; } |
| + void ClampFromAbove(const Class& other) { |
|
sky
2012/11/09 18:23:12
The name here is even more confusing. Sizes genera
danakj
2012/11/09 18:24:25
Oh, hm. I hadn't thought of it in terms of directi
|
| + width_ = width_ <= other.width_ ? width_ : other.width_; |
| + height_ = height_ <= other.height_ ? height_ : other.height_; |
| + } |
| + |
| + void ClampFromBelow(const Class& other) { |
| + width_ = width_ >= other.width_ ? width_ : other.width_; |
| + height_ = height_ >= other.height_ ? height_ : other.height_; |
| + } |
| + |
| bool IsEmpty() const { |
| return (width_ <= 0) || (height_ <= 0); |
| } |