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

Unified Diff: ui/gfx/rect.cc

Issue 8066006: ui/gfx: Add ToString() function to Rect class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/rect.h ('k') | webkit/glue/web_io_operators.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect.cc
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc
index db5ff8af0a8ebd84cab3d99147615c9198c6d276..bc0a8a9234859665348c5d79690c7584f1093144 100644
--- a/ui/gfx/rect.cc
+++ b/ui/gfx/rect.cc
@@ -15,8 +15,7 @@
#include <cairo.h>
#endif
-#include <ostream>
-
+#include "base/stringprintf.h"
#include "ui/gfx/insets.h"
namespace {
@@ -54,6 +53,8 @@ Rect::Rect(const gfx::Point& origin, const gfx::Size& size)
: origin_(origin), size_(size) {
}
+Rect::~Rect() {}
+
#if defined(OS_WIN)
Rect::Rect(const RECT& r)
: origin_(r.left, r.top) {
@@ -109,7 +110,6 @@ Rect& Rect::operator=(const cairo_rectangle_int_t& r) {
}
#endif
-
void Rect::SetRect(int x, int y, int width, int height) {
origin_.SetPoint(x, y);
set_width(width);
@@ -273,8 +273,10 @@ bool Rect::SharesEdgeWith(const gfx::Rect& rect) const {
(y() == rect.bottom() || bottom() == rect.y()));
}
-std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) {
- return out << r.origin().ToString() << " " << r.size().ToString();
+std::string Rect::ToString() const {
+ return base::StringPrintf("%s %s",
+ origin_.ToString().c_str(),
+ size_.ToString().c_str());
}
} // namespace gfx
« no previous file with comments | « ui/gfx/rect.h ('k') | webkit/glue/web_io_operators.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698