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

Unified Diff: Source/platform/text/TextStream.cpp

Issue 54803002: Centralize TextStream functions to remove RenderTreeAsText dependency of the filters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 | « Source/platform/text/TextStream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/text/TextStream.cpp
diff --git a/Source/platform/text/TextStream.cpp b/Source/platform/text/TextStream.cpp
index 377671b40bcac2f4771098db9f01c334990609e1..c470e05e5a99f993d0c210ee5d0bfd4bb4ff3935 100644
--- a/Source/platform/text/TextStream.cpp
+++ b/Source/platform/text/TextStream.cpp
@@ -26,6 +26,11 @@
#include "config.h"
#include "platform/text/TextStream.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntRect.h"
#include "wtf/MathExtras.h"
#include "wtf/StringExtras.h"
#include "wtf/text/WTFString.h"
@@ -132,4 +137,44 @@ String TextStream::release()
return result;
}
+TextStream& operator<<(TextStream& ts, const IntRect& r)
+{
+ return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();
+}
+
+TextStream& operator<<(TextStream& ts, const IntPoint& p)
+{
+ return ts << "(" << p.x() << "," << p.y() << ")";
+}
+
+TextStream& operator<<(TextStream& ts, const FloatPoint& p)
+{
+ ts << "(" << TextStream::FormatNumberRespectingIntegers(p.x());
+ ts << "," << TextStream::FormatNumberRespectingIntegers(p.y());
+ ts << ")";
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const FloatSize& s)
+{
+ ts << "width=" << TextStream::FormatNumberRespectingIntegers(s.width());
+ ts << " height=" << TextStream::FormatNumberRespectingIntegers(s.height());
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const FloatRect& r)
+{
+ ts << "at (" << TextStream::FormatNumberRespectingIntegers(r.x());
+ ts << "," << TextStream::FormatNumberRespectingIntegers(r.y());
+ ts << ") size " << TextStream::FormatNumberRespectingIntegers(r.width());
+ ts << "x" << TextStream::FormatNumberRespectingIntegers(r.height());
+ return ts;
+}
+
+void writeIndent(TextStream& ts, int indent)
+{
+ for (int i = 0; i != indent; ++i)
+ ts << " ";
+}
+
}
« no previous file with comments | « Source/platform/text/TextStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698