Index: third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp |
diff --git a/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp b/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp |
index cc26b5fe033157718a9e5a78cd2c736aff9b94d6..feb57e94174130df8951f37231609fc086e0b988 100644 |
--- a/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp |
+++ b/third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp |
@@ -10,131 +10,84 @@ |
#include "platform/geometry/FloatQuad.h" |
#include "platform/geometry/FloatRect.h" |
#include "platform/geometry/FloatSize.h" |
+#include "platform/geometry/IntPoint.h" |
+#include "platform/geometry/IntRect.h" |
+#include "platform/geometry/IntSize.h" |
+#include "platform/geometry/LayoutPoint.h" |
#include "platform/geometry/LayoutRect.h" |
+#include "platform/geometry/LayoutSize.h" |
#include <ostream> // NOLINT |
namespace blink { |
-namespace { |
- |
-class ScopedFloatFlags { |
-public: |
- ScopedFloatFlags(std::ostream& out) : m_out(out), m_flags(out.flags()) |
- { |
- out.unsetf(std::ios::floatfield); |
- m_precision = out.precision(4); |
- } |
- |
- ~ScopedFloatFlags() |
- { |
- m_out.flags(m_flags); |
- m_out.precision(m_precision); |
- } |
- |
-private: |
- std::ostream& m_out; |
- std::ios::fmtflags m_flags; |
- std::streamsize m_precision; |
-}; |
- |
-} // namespace |
- |
void PrintTo(const FloatBox& box, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatBox(" |
- << box.x() << ", " |
- << box.y() << ", " |
- << box.z() << ", " |
- << box.width() << ", " |
- << box.height() << ", " |
- << box.depth() << ")"; |
+ *os << box.toString(); |
} |
void PrintTo(const FloatPoint& point, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatPoint(" |
- << point.x() << ", " |
- << point.y() << ")"; |
+ *os << point.toString(); |
} |
void PrintTo(const FloatPoint3D& point, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatPoint3D(" |
- << point.x() << ", " |
- << point.y() << ", " |
- << point.z() << ")"; |
+ *os << point.toString(); |
} |
void PrintTo(const FloatQuad& quad, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatQuad(" |
- << "(" << quad.p1().x() << ", " << quad.p1().y() << "), " |
- << "(" << quad.p2().x() << ", " << quad.p2().y() << "), " |
- << "(" << quad.p3().x() << ", " << quad.p3().y() << "), " |
- << "(" << quad.p4().x() << ", " << quad.p4().y() << "))"; |
+ *os << quad.toString(); |
} |
void PrintTo(const FloatRect& rect, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatRect(" |
- << rect.x() << ", " |
- << rect.y() << ", " |
- << rect.width() << ", " |
- << rect.height() << ")"; |
+ *os << rect.toString(); |
} |
void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os) |
{ |
- *os << "FloatRoundedRect("; |
- PrintTo(roundedRect.rect(), os); |
- *os << ", "; |
- PrintTo(roundedRect.getRadii(), os); |
- *os << ")"; |
+ *os << roundedRect.toString(); |
} |
void PrintTo(const FloatRoundedRect::Radii& radii, std::ostream* os) |
{ |
- *os << "FloatRoundedRect::Radii("; |
- PrintTo(radii.topLeft(), os); |
- *os << ", "; |
- PrintTo(radii.topRight(), os); |
- *os << ", "; |
- PrintTo(radii.bottomLeft(), os); |
- *os << ", "; |
- PrintTo(radii.bottomRight(), os); |
- *os << ")"; |
+ *os << radii.toString(); |
} |
void PrintTo(const FloatSize& size, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "FloatSize(" |
- << size.width() << ", " |
- << size.height() << ")"; |
+ *os << size.toString(); |
+} |
+ |
+void PrintTo(const IntPoint& point, std::ostream* os) |
+{ |
+ *os << point.toString(); |
} |
void PrintTo(const IntRect& rect, std::ostream* os) |
{ |
- *os << "IntRect(" |
- << rect.x() << ", " |
- << rect.y() << ", " |
- << rect.width() << ", " |
- << rect.height() << ")"; |
+ *os << rect.toString(); |
+} |
+ |
+void PrintTo(const IntSize& size, std::ostream* os) |
+{ |
+ *os << size.toString(); |
+} |
+ |
+void PrintTo(const LayoutPoint& point, std::ostream* os) |
+{ |
+ *os << point.toString(); |
} |
void PrintTo(const LayoutRect& rect, std::ostream* os) |
{ |
- ScopedFloatFlags scope(*os); |
- *os << "LayoutRect(" |
- << rect.x().toFloat() << ", " |
- << rect.y().toFloat() << ", " |
- << rect.width().toFloat() << ", " |
- << rect.height().toFloat() << ")"; |
+ *os << rect.toString(); |
+} |
+ |
+void PrintTo(const LayoutSize& size, std::ostream* os) |
+{ |
+ *os << size.toString(); |
} |
} // namespace blink |