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

Unified Diff: base/gfx/size.h

Issue 93131: Change Size::IsEmpty() to be consistent with Rect::IsEmpty() (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « base/gfx/rect_unittest.cc ('k') | base/gfx/size.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/size.h
===================================================================
--- base/gfx/size.h (revision 14559)
+++ base/gfx/size.h (working copy)
@@ -23,7 +23,7 @@
class Size {
public:
Size() : width_(0), height_(0) {}
- Size(int width, int height) : width_(width), height_(height) {}
+ Size(int width, int height);
~Size() {}
@@ -31,17 +31,17 @@
int height() const { return height_; }
void SetSize(int width, int height) {
- width_ = width;
- height_ = height;
+ set_width(width);
+ set_height(height);
}
void Enlarge(int width, int height) {
- width_ += width;
- height_ += height;
+ set_width(width_ + width);
+ set_height(height_ + height);
}
- void set_width(int width) { width_ = width; }
- void set_height(int height) { height_ = height; }
+ void set_width(int width);
+ void set_height(int height);
bool operator==(const Size& s) const {
return width_ == s.width_ && height_ == s.height_;
@@ -52,7 +52,8 @@
}
bool IsEmpty() const {
- return !width_ && !height_;
+ // Size doesn't allow negative dimensions, so testing for 0 is enough.
+ return (width_ == 0) || (height_ == 0);
}
#if defined(OS_WIN)
« no previous file with comments | « base/gfx/rect_unittest.cc ('k') | base/gfx/size.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698