Bug 1380461 part 1: 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:24:19 -0700
changeset 607774 08994294cc23b764d2bab98a398e5402ed73cc99
parent 607773 f7db6ee4ab4ca159b9dfb35358833daa814ff790
child 637146 5bd92a3fb123ca58c49d4b084f947dee4b142663
push id68108
push userdholbert@mozilla.com
push dateWed, 12 Jul 2017 21:24:32 +0000
reviewersjfkthame
bugs1380461
milestone56.0a1
Bug 1380461 part 1: 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