Bug 1596339 Part 3 - Implement operator<< for LogicalSize, and use it in frame tree dump. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 15 Nov 2019 04:49:27 +0000
changeset 502117 2b8b36ac14d520ad148a364ea4c4959180890e9f
parent 502116 583f09d7e18124985da8eafd546b719f885ae898
child 502118 e9e0e6b92381b73474c978d1fda096d69fb38eda
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 3 - Implement operator<< for LogicalSize, and use it in frame tree dump. r=dholbert Note: The output format of BaseSize is "3 x 5", so a pair of parentheses is added around %s in "logical-size=(%s)" to make it looks better. Differential Revision: https://phabricator.services.mozilla.com/D52964
layout/generic/WritingModes.h
layout/generic/nsFrame.cpp
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -1036,16 +1036,21 @@ class LogicalSize {
   }
   LogicalSize& operator-=(const LogicalSize& aOther) {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
     ISize() -= aOther.ISize();
     BSize() -= aOther.BSize();
     return *this;
   }
 
+  friend std::ostream& operator<<(std::ostream& aStream,
+                                  const LogicalSize& aSize) {
+    return aStream << aSize.mSize;
+  }
+
  private:
   friend class LogicalRect;
 
   LogicalSize() = delete;
 
 #ifdef DEBUG
   WritingMode GetWritingMode() const { return mWritingMode; }
 #else
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -7842,18 +7842,18 @@ void nsIFrame::ListGeneric(nsACString& a
   if (IBprevsibling) {
     aTo += nsPrintfCString(" IBSplitPrevSibling=%p", IBprevsibling);
   }
   aTo += nsPrintfCString(" {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width,
                          mRect.height);
 
   mozilla::WritingMode wm = GetWritingMode();
   if (wm.IsVertical() || wm.IsBidiRTL()) {
-    aTo += nsPrintfCString(" wm=%s logical-size={%d,%d}", ToString(wm).c_str(),
-                           ISize(), BSize());
+    aTo += nsPrintfCString(" wm=%s logical-size=(%s)", ToString(wm).c_str(),
+                           ToString(GetLogicalSize()).c_str());
   }
 
   nsIFrame* parent = GetParent();
   if (parent) {
     WritingMode pWM = parent->GetWritingMode();
     if (pWM.IsVertical() || pWM.IsBidiRTL()) {
       nsSize containerSize = parent->mRect.Size();
       LogicalRect lr(pWM, mRect, containerSize);