Bug 1475024 - Add Stringify overloads for RectAbsolute. r=bas
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 13 Jul 2018 09:51:43 -0400
changeset 426486 a8f40ce410cb382b90b178ae58391af22bb4c37c
parent 426485 63604d737f8212f966f1d1392e6d55016e4a9ec3
child 426487 bed4190ce013a59f68d04bea242d2646ce1afc47
push id34274
push usernerli@mozilla.com
push dateFri, 13 Jul 2018 21:51:36 +0000
treeherdermozilla-central@e37eeb019cf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1475024
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1475024 - Add Stringify overloads for RectAbsolute. r=bas MozReview-Commit-ID: GLisM28IEVG
gfx/layers/LayersLogging.cpp
gfx/layers/LayersLogging.h
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -7,16 +7,17 @@
 #include "LayersLogging.h"
 #include <stdint.h>                     // for uint8_t
 #include "ImageTypes.h"                 // for ImageFormat
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4, Matrix
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "nsDebug.h"                    // for NS_ERROR
 #include "nsPoint.h"                    // for nsPoint
 #include "nsRect.h"                     // for nsRect
+#include "nsRectAbsolute.h"             // for nsRectAbsolute
 #include "base/basictypes.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 void
@@ -64,16 +65,27 @@ AppendToString(std::stringstream& aStrea
   aStream << pfx;
   aStream << nsPrintfCString(
     "(x=%d, y=%d, w=%d, h=%d)",
     r.X(), r.Y(), r.Width(), r.Height()).get();
   aStream << sfx;
 }
 
 void
+AppendToString(std::stringstream& aStream, const nsRectAbsolute& r,
+               const char* pfx, const char* sfx)
+{
+  aStream << pfx;
+  aStream << nsPrintfCString(
+    "(l=%d, t=%d, r=%d, b=%d)",
+    r.Left(), r.Top(), r.Right(), r.Bottom()).get();
+  aStream << sfx;
+}
+
+void
 AppendToString(std::stringstream& aStream, const wr::ColorF& c,
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   aStream << nsPrintfCString(
     "rgba(%d, %d, %d, %f)",
     uint8_t(c.r*255.f), uint8_t(c.g*255.f), uint8_t(c.b*255.f), c.a).get();
   aStream << sfx;
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -14,16 +14,18 @@
 #include "mozilla/gfx/Types.h"          // for SamplingFilter, SurfaceFormat
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags
 #include "mozilla/layers/WebRenderLayersLogging.h"
 #include "nsAString.h"
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "nsRegion.h"                   // for nsRegion, nsIntRegion
 #include "nscore.h"                     // for nsACString, etc
 
+struct nsRectAbsolute;
+
 namespace mozilla {
 
 namespace gfx {
 template <class units, class F> struct RectTyped;
 } // namespace gfx
 
 enum class ImageFormat;
 
@@ -44,16 +46,20 @@ AppendToString(std::stringstream& aStrea
 void
 AppendToString(std::stringstream& aStream, const nsPoint& p,
                const char* pfx="", const char* sfx="");
 
 void
 AppendToString(std::stringstream& aStream, const nsRect& r,
                const char* pfx="", const char* sfx="");
 
+void
+AppendToString(std::stringstream& aStream, const nsRectAbsolute& r,
+               const char* pfx="", const char* sfx="");
+
 template<class T>
 void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::PointTyped<T>& p,
                const char* pfx="", const char* sfx="")
 {
   aStream << pfx << p << sfx;
 }
 
@@ -92,16 +98,40 @@ AppendToString(std::stringstream& aStrea
 {
   aStream << pfx;
   aStream << nsPrintfCString(
     "(x=%d, y=%d, w=%d, h=%d)",
     r.X(), r.Y(), r.Width(), r.Height()).get();
   aStream << sfx;
 }
 
+template<class T>
+void
+AppendToString(std::stringstream& aStream, const mozilla::gfx::RectAbsoluteTyped<T>& r,
+               const char* pfx="", const char* sfx="")
+{
+  aStream << pfx;
+  aStream << nsPrintfCString(
+    "(l=%f, t=%f, r=%f, b=%f)",
+    r.Left(), r.Top(), r.Right(), r.Bottom()).get();
+  aStream << sfx;
+}
+
+template<class T>
+void
+AppendToString(std::stringstream& aStream, const mozilla::gfx::IntRectAbsoluteTyped<T>& r,
+               const char* pfx="", const char* sfx="")
+{
+  aStream << pfx;
+  aStream << nsPrintfCString(
+    "(l=%d, t=%d, r=%d, b=%d)",
+    r.Left(), r.Top(), r.Right(), r.Bottom()).get();
+  aStream << sfx;
+}
+
 void
 AppendToString(std::stringstream& aStream, const wr::ColorF& c,
                const char* pfx="", const char* sfx="");
 
 void
 AppendToString(std::stringstream& aStream, const wr::LayoutRect& r,
                const char* pfx="", const char* sfx="");