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

Unified Diff: ui/gfx/size_base.h

Issue 11365160: ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests that use negative values or NaN Created 8 years, 1 month 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 | « ui/gfx/size.cc ('k') | ui/gfx/size_base_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/size_base.h
diff --git a/ui/gfx/size_base.h b/ui/gfx/size_base.h
index 0dbfabddfcf15e4a50cae207abde488e2178479c..33051a39a02fc9b8a45eb6aea18b583af93e17f2 100644
--- a/ui/gfx/size_base.h
+++ b/ui/gfx/size_base.h
@@ -32,8 +32,8 @@ 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);
+ void set_height(Type height);
void ClampToMax(const Class& max) {
width_ = width_ <= max.width_ ? width_ : max.width_;
@@ -46,20 +46,11 @@ class UI_EXPORT SizeBase {
}
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) {}
+ SizeBase(Type width, Type height);
// Destructor is intentionally made non virtual and protected.
// Do not make this public.
« no previous file with comments | « ui/gfx/size.cc ('k') | ui/gfx/size_base_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698