Bug 1380461: Clarify ancient code-comment about the helper-variables we use as AddRemoveScrollbar outparams. r?jfkthame draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 12 Jul 2017 14:17:47 -0700
changeset 607772 4cb6299806578650895c819750dfb1402c1191ab
parent 607767 a8809f15b58213f3292b9eaf7fa9583377d1fa30
child 637145 71b4bc26a72b9262e74266cfe59a7c44a3fd4a8e
push id68107
push userdholbert@mozilla.com
push dateWed, 12 Jul 2017 21:18:00 +0000
reviewersjfkthame
bugs1380461
milestone56.0a1
Bug 1380461: Clarify ancient code-comment about the helper-variables we use as AddRemoveScrollbar outparams. r?jfkthame MozReview-Commit-ID: Fxzes2yuLHJ
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4827,41 +4827,45 @@ nsXULScrollFrame::AddRemoveScrollbar(nsB
      if (mHelper.mNeverHasHorizontalScrollbar || !mHelper.mHScrollbarBox)
        return false;
 
      nsSize hSize = mHelper.mHScrollbarBox->GetXULPrefSize(aState);
      nsBox::AddMargin(mHelper.mHScrollbarBox, hSize);
 
      mHelper.SetScrollbarVisibility(mHelper.mHScrollbarBox, aAdd);
 
+     // We can't directly pass mHasHorizontalScrollbar as the bool outparam for
+     // AddRemoveScrollbar, because it's a bool:1 bitfield. Hence this var:
      bool hasHorizontalScrollbar;
      bool fit = AddRemoveScrollbar(hasHorizontalScrollbar,
                                      mHelper.mScrollPort.y,
                                      mHelper.mScrollPort.height,
                                      hSize.height, aOnRightOrBottom, aAdd);
-     mHelper.mHasHorizontalScrollbar = hasHorizontalScrollbar;    // because mHasHorizontalScrollbar is a bool
+     mHelper.mHasHorizontalScrollbar = hasHorizontalScrollbar;
      if (!fit)
         mHelper.SetScrollbarVisibility(mHelper.mHScrollbarBox, !aAdd);
 
      return fit;
   } else {
      if (mHelper.mNeverHasVerticalScrollbar || !mHelper.mVScrollbarBox)
        return false;
 
      nsSize vSize = mHelper.mVScrollbarBox->GetXULPrefSize(aState);
      nsBox::AddMargin(mHelper.mVScrollbarBox, vSize);
 
      mHelper.SetScrollbarVisibility(mHelper.mVScrollbarBox, aAdd);
 
+     // We can't directly pass mHasVerticalScrollbar as the bool outparam for
+     // AddRemoveScrollbar, because it's a bool:1 bitfield. Hence this var:
      bool hasVerticalScrollbar;
      bool fit = AddRemoveScrollbar(hasVerticalScrollbar,
                                      mHelper.mScrollPort.x,
                                      mHelper.mScrollPort.width,
                                      vSize.width, aOnRightOrBottom, aAdd);
-     mHelper.mHasVerticalScrollbar = hasVerticalScrollbar;    // because mHasVerticalScrollbar is a bool
+     mHelper.mHasVerticalScrollbar = hasVerticalScrollbar;
      if (!fit)
         mHelper.SetScrollbarVisibility(mHelper.mVScrollbarBox, !aAdd);
 
      return fit;
   }
 }
 
 bool