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

Unified Diff: third_party/WebKit/Source/platform/geometry/LayoutRect.cpp

Issue 2191233002: Add platform/geometry pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust tests to work around uninteresting cross-platform differences Created 4 years, 5 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
Index: third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRect.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
index 7e7b2ddaefc79d83e025f933187d05644953f871..b73835391e4f70c038c176053e5cabb00cc65dfc 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
@@ -33,9 +33,8 @@
#include "platform/LayoutUnit.h"
#include "platform/geometry/DoubleRect.h"
#include "platform/geometry/FloatRect.h"
-#include "wtf/text/WTFString.h"
#include <algorithm>
-#include <stdio.h>
+#include <ostream> // NOLINT
namespace blink {
@@ -142,21 +141,6 @@ void LayoutRect::scale(float xAxisScale, float yAxisScale)
m_size.scale(xAxisScale, yAxisScale);
}
-#ifndef NDEBUG
-void LayoutRect::show(bool showRawValue) const
-{
- if (showRawValue)
- printf("Rect (in raw layout units): [x=%d y=%d maxX=%d maxY=%d]\n", x().rawValue(), y().rawValue(), maxX().rawValue(), maxY().rawValue());
- else
- printf("Rect (in pixels): [x=%lf y=%lf maxX=%lf maxY=%lf]\n", x().toDouble(), y().toDouble(), maxX().toDouble(), maxY().toDouble());
-}
-
-String LayoutRect::toString() const
-{
- return String::format("%s %s", location().toString().ascii().data(), size().toString().ascii().data());
-}
-#endif
-
LayoutRect unionRect(const Vector<LayoutRect>& rects)
{
LayoutRect result;
@@ -196,4 +180,14 @@ LayoutRect enclosingLayoutRect(const FloatRect& rect)
return LayoutRect(location, maxPoint - location);
}
+std::ostream& operator<<(std::ostream& os, const LayoutRect& rect)
+{
+ os << "LayoutRect("
+ << "x=" << rect.x() << ", "
+ << "y=" << rect.y() << ", "
+ << "width=" << rect.width() << ", "
+ << "height=" << rect.height() << ")";
+ return os;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698