Index: ui/gfx/size_base.h |
diff --git a/ui/gfx/size_base.h b/ui/gfx/size_base.h |
index f8373e8a802f79984fb1b4c9dae91616084fdaf1..44695d2b09318980e18bfe315f3a012362127bf1 100644 |
--- a/ui/gfx/size_base.h |
+++ b/ui/gfx/size_base.h |
@@ -51,6 +51,15 @@ class UI_EXPORT SizeBase { |
return !(*this == s); |
} |
+ // A size is less than another size if its width is less than the |other| |
+ // size's width. If the widths are equal, then the size with the smallest |
+ // height is less than the other. The comparison is required to uses Sizes in |
+ // sets and sorted vectors. |
+ bool operator<(const Class& other) const { |
+ return (width_ == other.width_) ? |
+ height_ < other.height_ : width_ < other.width_; |
+ } |
+ |
bool IsEmpty() const { |
// Size doesn't allow negative dimensions, so testing for 0 is enough. |
return (width_ == 0) || (height_ == 0); |