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

Unified Diff: third_party/WebKit/Source/platform/geometry/FloatRoundedRect.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/FloatRoundedRect.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp b/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
index 245a96b25ccda2c40f706d5053d388d86e739923..6e5b0ee4fec4a71e259f7101ab9926b43eaae242 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
@@ -32,10 +32,7 @@
#include "platform/geometry/FloatQuad.h"
#include <algorithm>
-
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
+#include <ostream> // NOLINT
namespace blink {
@@ -140,15 +137,6 @@ void FloatRoundedRect::Radii::expand(float topWidth, float bottomWidth, float le
}
}
-#ifndef NDEBUG
-void FloatRoundedRect::Radii::show() const
-{
- fprintf(stderr, "topLeft=[%f,%f], topRight=[%f,%f], bottomLeft=[%f,%f], bottomRight=[%f,%f]\n",
- topLeft().width(), topLeft().height(), topRight().width(), topRight().height(),
- bottomLeft().width(), bottomLeft().height(), bottomRight().width(), bottomRight().height());
-}
-#endif
-
static inline float cornerRectIntercept(float y, const FloatRect& cornerRect)
{
ASSERT(cornerRect.height() > 0);
@@ -349,14 +337,22 @@ void FloatRoundedRect::adjustRadii()
m_radii.scale(widthRatio < heightRatio ? widthRatio : heightRatio);
}
-#ifndef NDEBUG
-void FloatRoundedRect::show() const
+std::ostream& operator<<(std::ostream& os, const FloatRoundedRect::Radii& radii)
+{
+ os << "FloatRoundedRect::Radii("
+ << "topLeft=" << radii.topLeft() << ", "
+ << "topRight=" << radii.topRight() << ", "
+ << "bottomLeft" << radii.bottomLeft() << ", "
+ << "bottomRight=" << radii.bottomRight() << ")";
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const FloatRoundedRect& roundedRect)
{
- fprintf(stderr, "FloatRoundedRect:\n rect: ");
- m_rect.show();
- fprintf(stderr, " radii: ");
- m_radii.show();
+ os << "FloatRoundedRect("
+ << "rect=" << roundedRect.rect() << ", "
+ << "radii=" << roundedRect.getRadii() << ")";
+ return os;
}
-#endif
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698