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

Unified Diff: ui/gfx/rect_f.cc

Issue 11364054: ui: Add IsExpressibleAsRect() method to RectF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits 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/rect_f.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect_f.cc
diff --git a/ui/gfx/rect_f.cc b/ui/gfx/rect_f.cc
index ffa9faac1a53d73c5ea3974e33f3743afb9f5862..fa4e99d17cbd7f12fdfe60ef605f467d053c7630 100644
--- a/ui/gfx/rect_f.cc
+++ b/ui/gfx/rect_f.cc
@@ -10,6 +10,7 @@
#include "base/stringprintf.h"
#include "ui/gfx/insets_f.h"
#include "ui/gfx/rect_base_impl.h"
+#include "ui/gfx/safe_integer_conversions.h"
namespace gfx {
@@ -39,6 +40,12 @@ RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size)
RectF::~RectF() {}
+bool RectF::IsExpressibleAsRect() const {
+ return IsExpressibleAsInt(x()) && IsExpressibleAsInt(y()) &&
+ IsExpressibleAsInt(width()) && IsExpressibleAsInt(height()) &&
+ IsExpressibleAsInt(right()) && IsExpressibleAsInt(bottom());
+}
+
std::string RectF::ToString() const {
return base::StringPrintf("%s %s",
origin().ToString().c_str(),
« no previous file with comments | « ui/gfx/rect_f.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698