Bug 1277814 - Add printing support to BaseMargin. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Fri, 03 Jun 2016 17:23:40 -0400
changeset 375884 b720fc66767b6cd6f136998dd51cf58e0d59cca8
parent 375744 d98f20c25feeac4dd7ebbd1c022957df1ef58af4
child 375885 50a66fcdc5b5f9138c0f0687f7e00cb9a71faf8a
child 375887 d281aad5855f5ff2138f3d64b23971bdd6afe720
child 375892 569276f2edd39600de534183e12b7f8762b917c8
push id20415
push userbballo@mozilla.com
push dateMon, 06 Jun 2016 21:21:49 +0000
reviewerskats
bugs1277814
milestone49.0a1
Bug 1277814 - Add printing support to BaseMargin. r=kats MozReview-Commit-ID: 3E36i09xI3Y
gfx/2d/BaseMargin.h
--- a/gfx/2d/BaseMargin.h
+++ b/gfx/2d/BaseMargin.h
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_BASEMARGIN_H_
 #define MOZILLA_GFX_BASEMARGIN_H_
 
+#include <ostream>
+
 #include "Types.h"
 
 namespace mozilla {
 
 /**
  * Sides represents a set of physical sides.
  */
 struct Sides final {
@@ -131,14 +133,20 @@ struct BaseMargin {
   }
   Sub& operator+=(const Sub& aMargin) {
     top += aMargin.top;
     right += aMargin.right;
     bottom += aMargin.bottom;
     left += aMargin.left;
     return *static_cast<Sub*>(this);
   }
+
+  friend std::ostream& operator<<(std::ostream& aStream,
+      const BaseMargin& aMargin) {
+    return aStream << '(' << aMargin.top << ',' << aMargin.right << ','
+                  << aMargin.bottom << ',' << aMargin.left << ')';
+  }
 };
 
 } // namespace gfx
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_BASEMARGIN_H_ */