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

Unified Diff: ui/gfx/geometry/size.h

Issue 2051343002: Make various gfx classes more amenable to use as compile-time constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete destructor Created 4 years, 6 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 | « ui/gfx/geometry/rect_f.h ('k') | ui/gfx/geometry/size_f.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/size.h
diff --git a/ui/gfx/geometry/size.h b/ui/gfx/geometry/size.h
index 8c2f778494ae32b92703fa98810499391b9a84a8..6eb05227aba19f2bfd791b4c56340fb01da4e8d3 100644
--- a/ui/gfx/geometry/size.h
+++ b/ui/gfx/geometry/size.h
@@ -24,15 +24,13 @@ namespace gfx {
// A size has width and height values.
class GFX_EXPORT Size {
public:
- Size() : width_(0), height_(0) {}
- Size(int width, int height)
+ constexpr Size() : width_(0), height_(0) {}
+ constexpr Size(int width, int height)
: width_(width < 0 ? 0 : width), height_(height < 0 ? 0 : height) {}
#if defined(OS_MACOSX)
explicit Size(const CGSize& s);
#endif
- ~Size() {}
-
#if defined(OS_MACOSX)
Size& operator=(const CGSize& s);
#endif
@@ -43,8 +41,8 @@ class GFX_EXPORT Size {
CGSize ToCGSize() const;
#endif
- int width() const { return width_; }
- int height() const { return height_; }
+ constexpr int width() const { return width_; }
+ constexpr int height() const { return height_; }
void set_width(int width) { width_ = width < 0 ? 0 : width; }
void set_height(int height) { height_ = height < 0 ? 0 : height; }
« no previous file with comments | « ui/gfx/geometry/rect_f.h ('k') | ui/gfx/geometry/size_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698