Bug 1596339 Part 4 - Implement operator<< for LogicalPoint and LogicalMargin. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 15 Nov 2019 03:52:05 +0000
changeset 502118 e9e0e6b92381b73474c978d1fda096d69fb38eda
parent 502117 2b8b36ac14d520ad148a364ea4c4959180890e9f
child 502119 1622b327fb356012561b3ace3b382c89addeb4fc
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1596339
milestone72.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 1596339 Part 4 - Implement operator<< for LogicalPoint and LogicalMargin. r=dholbert I'm not aware of any usage of LogicalPoint and LogicalPoint in frame tree dump, but I still want to implement them for the sake of completeness. Differential Revision: https://phabricator.services.mozilla.com/D52965
layout/generic/WritingModes.h
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -825,16 +825,21 @@ class LogicalPoint {
 
   LogicalPoint& operator-=(const LogicalPoint& aOther) {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
     I() -= aOther.I();
     B() -= aOther.B();
     return *this;
   }
 
+  friend std::ostream& operator<<(std::ostream& aStream,
+                                  const LogicalPoint& aPoint) {
+    return aStream << aPoint.mPoint;
+  }
+
  private:
   friend class LogicalRect;
 
   /**
    * NOTE that in non-DEBUG builds, GetWritingMode() always returns
    * eUnknownWritingMode, as the current mode is not stored in the logical-
    * geometry classes. Therefore, this method is private; it is used ONLY
    * by the DEBUG-mode checking macros in this class and its friends;
@@ -1344,16 +1349,21 @@ class LogicalMargin {
 
   LogicalMargin operator-(const LogicalMargin& aMargin) const {
     CHECK_WRITING_MODE(aMargin.GetWritingMode());
     return LogicalMargin(GetWritingMode(), BStart() - aMargin.BStart(),
                          IEnd() - aMargin.IEnd(), BEnd() - aMargin.BEnd(),
                          IStart() - aMargin.IStart());
   }
 
+  friend std::ostream& operator<<(std::ostream& aStream,
+                                  const LogicalMargin& aMargin) {
+    return aStream << aMargin.mMargin;
+  }
+
  private:
   friend class LogicalRect;
 
   LogicalMargin() = delete;
 
 #ifdef DEBUG
   WritingMode GetWritingMode() const { return mWritingMode; }
 #else