Bug 1277814 - Add printing support to BaseMargin. r=kats
MozReview-Commit-ID: 3E36i09xI3Y
--- 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_ */