Bug 1294628 - Replace block reflow input flags with a bit fields struct. r?dholbert draft
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 12 Aug 2016 15:28:45 +0800
changeset 400580 514c7ed58609cfb3f6810fb5b80ef0c119ac4323
parent 400444 6e191a55c3d23e83e6a2e72e4e80c1dc21516493
child 528260 7a916fab6e9671af82ce9555a8b4ea934c826a1d
push id26209
push userbmo:tlin@mozilla.com
push dateMon, 15 Aug 2016 07:59:05 +0000
reviewersdholbert
bugs1294628
milestone51.0a1
Bug 1294628 - Replace block reflow input flags with a bit fields struct. r?dholbert MozReview-Commit-ID: 2ZSm9hTrsuh
layout/generic/BlockReflowInput.cpp
layout/generic/BlockReflowInput.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsFrameStateBits.h
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -39,30 +39,29 @@ BlockReflowInput::BlockReflowInput(const
     mPresContext(aPresContext),
     mReflowInput(aReflowInput),
     mContentArea(aReflowInput.GetWritingMode()),
     mPushedFloats(nullptr),
     mOverflowTracker(nullptr),
     mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
     mPrevBEndMargin(),
     mLineNumber(0),
-    mFlags(0),
     mFloatBreakType(NS_STYLE_CLEAR_NONE),
     mConsumedBSize(aConsumedBSize)
 {
   if (!sFloatFragmentsInsideColumnPrefCached) {
     sFloatFragmentsInsideColumnPrefCached = true;
     Preferences::AddBoolVarCache(&sFloatFragmentsInsideColumnEnabled,
                                  "layout.float-fragments-inside-column.enabled");
   }
-  SetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED, sFloatFragmentsInsideColumnEnabled);
-  
+  mFlags.mFloatFragmentsInsideColumnEnabled = sFloatFragmentsInsideColumnEnabled;
+
   WritingMode wm = aReflowInput.GetWritingMode();
-  SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nullptr);
-  SetFlag(BRS_ISOVERFLOWCONTAINER, IS_TRUE_OVERFLOW_CONTAINER(aFrame));
+  mFlags.mIsFirstInflow = !aFrame->GetPrevInFlow();
+  mFlags.mIsOverflowContainer = IS_TRUE_OVERFLOW_CONTAINER(aFrame);
 
   nsIFrame::LogicalSides logicalSkipSides =
     aFrame->GetLogicalSkipSides(&aReflowInput);
   mBorderPadding.ApplySkipSides(logicalSkipSides);
 
   // Note that mContainerSize is the physical size, needed to
   // convert logical block-coordinates in vertical-rl writing mode
   // (measured from a RHS origin) to physical coordinates within the
@@ -82,27 +81,27 @@ BlockReflowInput::BlockReflowInput(const
   // For now at least, we don't do that fix-up for mContainerHeight.
   // It's only used in nsBidiUtils::ReorderFrames for vertical rtl
   // writing modes, which aren't fully supported for the time being.
   mContainerSize.height = aReflowInput.ComputedHeight() +
                           mBorderPadding.TopBottom(wm);
 
   if ((aBStartMarginRoot && !logicalSkipSides.BStart()) ||
       0 != mBorderPadding.BStart(wm)) {
-    SetFlag(BRS_ISBSTARTMARGINROOT, true);
-    SetFlag(BRS_APPLYBSTARTMARGIN, true);
+    mFlags.mIsBStartMarginRoot = true;
+    mFlags.mShouldApplyBStartMargin = true;
   }
   if ((aBEndMarginRoot && !logicalSkipSides.BEnd()) ||
       0 != mBorderPadding.BEnd(wm)) {
-    SetFlag(BRS_ISBENDMARGINROOT, true);
+    mFlags.mIsBEndMarginRoot = true;
   }
   if (aBlockNeedsFloatManager) {
-    SetFlag(BRS_FLOAT_MGR, true);
+    mFlags.mBlockNeedsFloatManager = true;
   }
-  
+
   mFloatManager = aReflowInput.mFloatManager;
 
   NS_ASSERTION(mFloatManager,
                "FloatManager should be set in BlockReflowInput" );
   if (mFloatManager) {
     // Save the coordinate system origin for later.
     mFloatManager->GetTranslation(mFloatManagerI, mFloatManagerB);
     mFloatManager->PushState(&mFloatManagerStateBefore); // never popped
@@ -128,18 +127,18 @@ BlockReflowInput::BlockReflowInput(const
     // We are in a paginated situation. The bottom edge is just inside
     // the bottom border and padding. The content area height doesn't
     // include either border or padding edge.
     mBEndEdge = aReflowInput.AvailableBSize() - mBorderPadding.BEnd(wm);
     mContentArea.BSize(wm) = std::max(0, mBEndEdge - mBorderPadding.BStart(wm));
   }
   else {
     // When we are not in a paginated situation then we always use
-    // an constrained height.
-    SetFlag(BRS_UNCONSTRAINEDBSIZE, true);
+    // a constrained height.
+    mFlags.mHasUnconstrainedBSize = true;
     mContentArea.BSize(wm) = mBEndEdge = NS_UNCONSTRAINEDSIZE;
   }
   mContentArea.IStart(wm) = mBorderPadding.IStart(wm);
   mBCoord = mContentArea.BStart(wm) = mBorderPadding.BStart(wm);
 
   mPrevChild = nullptr;
   mCurrentLine = aFrame->end_lines();
 
@@ -229,17 +228,17 @@ BlockReflowInput::ComputeBlockAvailSpace
                                            LogicalRect& aResult)
 {
 #ifdef REALLY_NOISY_REFLOW
   printf("CBAS frame=%p has floats %d\n",
          aFrame, aFloatAvailableSpace.mHasFloats);
 #endif
   WritingMode wm = mReflowInput.GetWritingMode();
   aResult.BStart(wm) = mBCoord;
-  aResult.BSize(wm) = GetFlag(BRS_UNCONSTRAINEDBSIZE)
+  aResult.BSize(wm) = mFlags.mHasUnconstrainedBSize
     ? NS_UNCONSTRAINEDSIZE
     : mReflowInput.AvailableBSize() - mBCoord
       - GetBEndMarginClone(aFrame, mReflowInput.mRenderingContext, mContentArea, wm);
   // mBCoord might be greater than mBEndEdge if the block's top margin pushes
   // it off the page/column. Negative available height can confuse other code
   // and is nonsense in principle.
 
   // XXX Do we really want this condition to be this restrictive (i.e.,
@@ -426,39 +425,39 @@ BlockReflowInput::ReconstructMarginBefor
       break;
     }
     if (!aLine->IsEmpty()) {
       break;
     }
     if (aLine == firstLine) {
       // If the top margin was carried out (and thus already applied),
       // set it to zero.  Either way, we're done.
-      if (!GetFlag(BRS_ISBSTARTMARGINROOT)) {
+      if (!mFlags.mIsBStartMarginRoot) {
         mPrevBEndMargin.Zero();
       }
       break;
     }
   }
 }
 
 void
 BlockReflowInput::SetupPushedFloatList()
 {
-  MOZ_ASSERT(!GetFlag(BRS_PROPTABLE_FLOATCLIST) == !mPushedFloats,
+  MOZ_ASSERT(!mFlags.mIsFloatListInBlockPropertyTable == !mPushedFloats,
              "flag mismatch");
-  if (!GetFlag(BRS_PROPTABLE_FLOATCLIST)) {
+  if (!mFlags.mIsFloatListInBlockPropertyTable) {
     // If we're being re-Reflow'd without our next-in-flow having been
     // reflowed, some pushed floats from our previous reflow might
     // still be on our pushed floats list.  However, that's
     // actually fine, since they'll all end up being stolen and
     // reordered into the correct order again.
     // (nsBlockFrame::ReflowDirtyLines ensures that any lines with
     // pushed floats are reflowed.)
     mPushedFloats = mBlock->EnsurePushedFloats();
-    SetFlag(BRS_PROPTABLE_FLOATCLIST, true);
+    mFlags.mIsFloatListInBlockPropertyTable = true;
   }
 }
 
 void
 BlockReflowInput::AppendPushedFloatChain(nsIFrame* aFloatCont)
 {
   SetupPushedFloatList();
   while (true) {
@@ -913,17 +912,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
   // In the case that we're in columns and not splitting floats, we need
   // to check here that the float's height fit, and if it didn't, bail.
   // (controlled by the pref "layout.float-fragments-inside-column.enabled")
   //
   // Likewise, if none of the float fit, and it needs to be pushed in
   // its entirety to the next page (NS_FRAME_IS_TRUNCATED or
   // NS_INLINE_IS_BREAK_BEFORE), we need to do the same.
   if ((ContentBSize() != NS_UNCONSTRAINEDSIZE &&
-       !GetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED) &&
+       !mFlags.mFloatFragmentsInsideColumnEnabled &&
        adjustedAvailableSpace.BSize(wm) == NS_UNCONSTRAINEDSIZE &&
        !mustPlaceFloat &&
        aFloat->BSize(wm) + floatMargin.BStartEnd(wm) >
        ContentBEnd() - floatPos.B(wm)) ||
       NS_FRAME_IS_TRUNCATED(reflowStatus) ||
       NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
     PushFloatPastBreak(aFloat);
     return false;
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -11,78 +11,101 @@
 #include "nsFloatManager.h"
 #include "nsLineBox.h"
 #include "mozilla/ReflowInput.h"
 
 class nsBlockFrame;
 class nsFrameList;
 class nsOverflowContinuationTracker;
 
-// Block reflow state flags.
-//
-// BRS_UNCONSTRAINEDBSIZE is set in the BlockReflowInput constructor when the
-// frame being reflowed has been given NS_UNCONSTRAINEDSIZE as its available
-// BSize in the ReflowInput. If set, NS_UNCONSTRAINEDSIZE is passed to
-// nsLineLayout as the available BSize.
-#define BRS_UNCONSTRAINEDBSIZE    0x00000001
-// BRS_ISBSTARTMARGINROOT is set in the BlockReflowInput constructor when
-// reflowing a "block margin root" frame (i.e. a frame with the
-// NS_BLOCK_MARGIN_ROOT flag set, for which margins apply by default).
-//
-// The flag is also set when reflowing a frame whose computed BStart border
-// padding is non-zero.
-#define BRS_ISBSTARTMARGINROOT    0x00000002
-// BRS_ISBENDMARGINROOT is set in the BlockReflowInput constructor when
-// reflowing a "block margin root" frame (i.e. a frame with the
-// NS_BLOCK_MARGIN_ROOT flag set, for which margins apply by default).
-//
-// The flag is also set when reflowing a frame whose computed BEnd border
-// padding is non-zero.
-#define BRS_ISBENDMARGINROOT      0x00000004
-// BRS_APPLYBSTARTMARGIN is set if the BStart margin should be considered when
-// placing a linebox that contains a block frame. It may be set as a side-effect
-// of calling nsBlockFrame::ShouldApplyBStartMargin(); once set,
-// ShouldApplyBStartMargin() uses it as a fast-path way to return whether the
-// BStart margin should apply.
-//
-// If the flag hasn't been set in the block reflow state, then
-// ShouldApplyBStartMargin() will crawl the line list to see if a block frame
-// precedes the specified frame. If so, the BStart margin should be applied, and
-// the flag is set to cache the result. (If not, the BStart margin will be
-// applied as a result of the generational margin collapsing logic in
-// nsBlockReflowContext::ComputeCollapsedBStartMargin(). In this case, the flag
-// won't be set, so subsequent calls to ShouldApplyBStartMargin() will continue
-// crawl the line list.)
-//
-// This flag is also set in the BlockReflowInput constructor if
-// BRS_ISBSTARTMARGINROOT is set; that is, the frame being reflowed is a margin
-// root by default.
-#define BRS_APPLYBSTARTMARGIN     0x00000008
-#define BRS_ISFIRSTINFLOW         0x00000010
-// Set when mLineAdjacentToTop is valid
-#define BRS_HAVELINEADJACENTTOTOP 0x00000020
-// Set when the block has the equivalent of NS_BLOCK_FLOAT_MGR
-#define BRS_FLOAT_MGR             0x00000040
-// Set when nsLineLayout::LineIsEmpty was true at the end of reflowing
-// the current line
-#define BRS_LINE_LAYOUT_EMPTY     0x00000080
-#define BRS_ISOVERFLOWCONTAINER   0x00000100
-// Our mPushedFloats list is stored on the blocks' proptable
-#define BRS_PROPTABLE_FLOATCLIST  0x00000200
-// Set when the pref layout.float-fragments-inside-column.enabled is true.
-#define BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED 0x00000400
-#define BRS_LASTFLAG              BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED
-
 namespace mozilla {
 
-// BlockReflowInput contains additional reflow state information that the
+// BlockReflowInput contains additional reflow input information that the
 // block frame uses along with ReflowInput. Like ReflowInput, this
 // is read-only data that is passed down from a parent frame to its children.
 class BlockReflowInput {
-  using ReflowInput = mozilla::ReflowInput;
+
+  // Block reflow input flags.
+  struct Flags {
+    Flags()
+      : mHasUnconstrainedBSize(false)
+      , mIsBStartMarginRoot(false)
+      , mIsBEndMarginRoot(false)
+      , mShouldApplyBStartMargin(false)
+      , mIsFirstInflow(false)
+      , mHasLineAdjacentToTop(false)
+      , mBlockNeedsFloatManager(false)
+      , mIsLineLayoutEmpty(false)
+      , mIsOverflowContainer(false)
+      , mIsFloatListInBlockPropertyTable(false)
+      , mFloatFragmentsInsideColumnEnabled(false)
+    {}
+
+    // Set in the BlockReflowInput constructor when the frame being reflowed has
+    // been given NS_UNCONSTRAINEDSIZE as its available BSize in the
+    // ReflowInput. If set, NS_UNCONSTRAINEDSIZE is passed to nsLineLayout as
+    // the available BSize.
+    bool mHasUnconstrainedBSize : 1;
+
+    // Set in the BlockReflowInput constructor when reflowing a "block margin
+    // root" frame (i.e. a frame with the NS_BLOCK_MARGIN_ROOT flag set, for
+    // which margins apply by default).
+    //
+    // The flag is also set when reflowing a frame whose computed BStart border
+    // padding is non-zero.
+    bool mIsBStartMarginRoot : 1;
+
+    // Set in the BlockReflowInput constructor when reflowing a "block margin
+    // root" frame (i.e. a frame with the NS_BLOCK_MARGIN_ROOT flag set, for
+    // which margins apply by default).
+    //
+    // The flag is also set when reflowing a frame whose computed BEnd border
+    // padding is non-zero.
+    bool mIsBEndMarginRoot : 1;
+
+    // Set if the BStart margin should be considered when placing a linebox that
+    // contains a block frame. It may be set as a side-effect of calling
+    // nsBlockFrame::ShouldApplyBStartMargin(); once set,
+    // ShouldApplyBStartMargin() uses it as a fast-path way to return whether
+    // the BStart margin should apply.
+    //
+    // If the flag hasn't been set in the block reflow input, then
+    // ShouldApplyBStartMargin() will crawl the line list to see if a block frame
+    // precedes the specified frame. If so, the BStart margin should be applied, and
+    // the flag is set to cache the result. (If not, the BStart margin will be
+    // applied as a result of the generational margin collapsing logic in
+    // nsBlockReflowContext::ComputeCollapsedBStartMargin(). In this case, the flag
+    // won't be set, so subsequent calls to ShouldApplyBStartMargin() will continue
+    // crawl the line list.)
+    //
+    // This flag is also set in the BlockReflowInput constructor if
+    // mIsBStartMarginRoot is set; that is, the frame being reflowed is a margin
+    // root by default.
+    bool mShouldApplyBStartMargin : 1;
+
+    bool mIsFirstInflow : 1;
+
+    // Set when mLineAdjacentToTop is valid.
+    bool mHasLineAdjacentToTop : 1;
+
+    // Set when the block has the equivalent of NS_BLOCK_FLOAT_MGR.
+    bool mBlockNeedsFloatManager : 1;
+
+    // Set when nsLineLayout::LineIsEmpty was true at the end of reflowing
+    // the current line.
+    bool mIsLineLayoutEmpty : 1;
+
+    bool mIsOverflowContainer : 1;
+
+    // Set when our mPushedFloats list is stored on the block's property table.
+    bool mIsFloatListInBlockPropertyTable : 1;
+
+    // Set when the pref layout.float-fragments-inside-column.enabled is true.
+    bool mFloatFragmentsInsideColumnEnabled : 1;
+  };
 
 public:
   BlockReflowInput(const ReflowInput& aReflowInput,
                      nsPresContext* aPresContext,
                      nsBlockFrame* aFrame,
                      bool aBStartMarginRoot, bool aBEndMarginRoot,
                      bool aBlockNeedsFloatManager,
                      nscoord aConsumedBSize = NS_INTRINSICSIZE);
@@ -187,18 +210,18 @@ public:
                               const nsStyleDisplay* aDisplay,
                               const nsFlowAreaRect& aFloatAvailableSpace,
                               bool aBlockAvoidsFloats,
                               mozilla::LogicalRect& aResult);
 
   void RecoverStateFrom(nsLineList::iterator aLine, nscoord aDeltaBCoord);
 
   void AdvanceToNextLine() {
-    if (GetFlag(BRS_LINE_LAYOUT_EMPTY)) {
-      SetFlag(BRS_LINE_LAYOUT_EMPTY, false);
+    if (mFlags.mIsLineLayoutEmpty) {
+      mFlags.mIsLineLayoutEmpty = false;
     } else {
       mLineNumber++;
     }
   }
 
   //----------------------------------------
 
   // This state is the "global" state computed once for the reflow of
@@ -292,17 +315,17 @@ public:
   // This state is "running" state updated by the reflow of each line
   // in the block. This same state is "recovered" when a line is not
   // dirty and is passed over during incremental reflow.
 
   // The current line being reflowed
   // If it is mBlock->end_lines(), then it is invalid.
   nsLineList::iterator mCurrentLine;
 
-  // When BRS_HAVELINEADJACENTTOTOP is set, this refers to a line
+  // When mHasLineAdjacentToTop is set, this refers to a line
   // which we know is adjacent to the top of the block (in other words,
   // all lines before it are empty and do not have clearance. This line is
   // always before the current line.
   nsLineList::iterator mLineAdjacentToTop;
 
   // The current block-direction coordinate in the block
   nscoord mBCoord;
 
@@ -342,40 +365,23 @@ public:
   // and placed. Again, this is done to keep the list fiddling from
   // being N^2.
   nsFloatCacheFreeList mBelowCurrentLineFloats;
 
   nscoord mMinLineHeight;
 
   int32_t mLineNumber;
 
-  int16_t mFlags;
+  Flags mFlags;
 
   uint8_t mFloatBreakType;
 
   // The amount of computed block-direction size "consumed" by previous-in-flows.
   nscoord mConsumedBSize;
 
-  void SetFlag(uint32_t aFlag, bool aValue)
-  {
-    NS_ASSERTION(aFlag<=BRS_LASTFLAG, "bad flag");
-    if (aValue) { // set flag
-      mFlags |= aFlag;
-    }
-    else {        // unset flag
-      mFlags &= ~aFlag;
-    }
-  }
-
-  bool GetFlag(uint32_t aFlag) const
-  {
-    NS_ASSERTION(aFlag<=BRS_LASTFLAG, "bad flag");
-    return !!(mFlags & aFlag);
-  }
-
 private:
   bool CanPlaceFloat(nscoord aFloatISize,
                      const nsFlowAreaRect& aFloatAvailableSpace);
 
   void PushFloatPastBreak(nsIFrame* aFloat);
 
   void RecoverFloats(nsLineList::iterator aLine, nscoord aDeltaBCoord);
 };
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1484,17 +1484,17 @@ nsBlockFrame::ComputeFinalSize(const Ref
                                ReflowOutput&     aMetrics,
                                nscoord*                 aBEndEdgeOfChildren)
 {
   WritingMode wm = aState.mReflowInput.GetWritingMode();
   const LogicalMargin& borderPadding = aState.BorderPadding();
 #ifdef NOISY_FINAL_SIZE
   ListTag(stdout);
   printf(": mBCoord=%d mIsBEndMarginRoot=%s mPrevBEndMargin=%d bp=%d,%d\n",
-         aState.mBCoord, aState.GetFlag(BRS_ISBENDMARGINROOT) ? "yes" : "no",
+         aState.mBCoord, aState.mFlags.mIsBEndMarginRoot ? "yes" : "no",
          aState.mPrevBEndMargin.get(),
          borderPadding.BStart(wm), borderPadding.BEnd(wm));
 #endif
 
   // Compute final inline size
   LogicalSize finalSize(wm);
   finalSize.ISize(wm) =
     NSCoordSaturatingAdd(NSCoordSaturatingAdd(borderPadding.IStart(wm),
@@ -1502,17 +1502,17 @@ nsBlockFrame::ComputeFinalSize(const Ref
                          borderPadding.IEnd(wm));
 
   // Return block-end margin information
   // rbs says he hit this assertion occasionally (see bug 86947), so
   // just set the margin to zero and we'll figure out why later
   //NS_ASSERTION(aMetrics.mCarriedOutBEndMargin.IsZero(),
   //             "someone else set the margin");
   nscoord nonCarriedOutBDirMargin = 0;
-  if (!aState.GetFlag(BRS_ISBENDMARGINROOT)) {
+  if (!aState.mFlags.mIsBEndMarginRoot) {
     // Apply rule from CSS 2.1 section 8.3.1. If we have some empty
     // line with clearance and a non-zero block-start margin and all
     // subsequent lines are empty, then we do not allow our children's
     // carried out block-end margin to be carried out of us and collapse
     // with our own block-end margin.
     if (CheckForCollapsedBEndMarginFromClearanceLine()) {
       // Convert the children's carried out margin to something that
       // we will include in our height
@@ -1521,33 +1521,33 @@ nsBlockFrame::ComputeFinalSize(const Ref
     }
     aMetrics.mCarriedOutBEndMargin = aState.mPrevBEndMargin;
   } else {
     aMetrics.mCarriedOutBEndMargin.Zero();
   }
 
   nscoord blockEndEdgeOfChildren = aState.mBCoord + nonCarriedOutBDirMargin;
   // Shrink wrap our height around our contents.
-  if (aState.GetFlag(BRS_ISBENDMARGINROOT) ||
+  if (aState.mFlags.mIsBEndMarginRoot ||
       NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()) {
     // When we are a block-end-margin root make sure that our last
     // childs block-end margin is fully applied. We also do this when
     // we have a computed height, since in that case the carried out
     // margin is not going to be applied anywhere, so we should note it
     // here to be included in the overflow area.
     // Apply the margin only if there's space for it.
     if (blockEndEdgeOfChildren < aState.mReflowInput.AvailableBSize())
     {
       // Truncate block-end margin if it doesn't fit to our available BSize.
       blockEndEdgeOfChildren =
         std::min(blockEndEdgeOfChildren + aState.mPrevBEndMargin.get(),
                aState.mReflowInput.AvailableBSize());
     }
   }
-  if (aState.GetFlag(BRS_FLOAT_MGR)) {
+  if (aState.mFlags.mBlockNeedsFloatManager) {
     // Include the float manager's state to properly account for the
     // block-end margin of any floated elements; e.g., inside a table cell.
     nscoord floatHeight =
       aState.ClearFloats(blockEndEdgeOfChildren, NS_STYLE_CLEAR_BOTH,
                          nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
     blockEndEdgeOfChildren = std::max(blockEndEdgeOfChildren, floatHeight);
   }
 
@@ -3071,47 +3071,47 @@ nsBlockFrame::IsEmpty()
   return true;
 }
 
 bool
 nsBlockFrame::ShouldApplyBStartMargin(BlockReflowInput& aState,
                                       nsLineBox* aLine,
                                       nsIFrame* aChildFrame)
 {
-  if (aState.GetFlag(BRS_APPLYBSTARTMARGIN)) {
+  if (aState.mFlags.mShouldApplyBStartMargin) {
     // Apply short-circuit check to avoid searching the line list
     return true;
   }
 
   if (!aState.IsAdjacentWithTop() ||
       aChildFrame->StyleBorder()->mBoxDecorationBreak ==
         NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
     // If we aren't at the start block-coordinate then something of non-zero
     // height must have been placed. Therefore the childs block-start margin
     // applies.
-    aState.SetFlag(BRS_APPLYBSTARTMARGIN, true);
+    aState.mFlags.mShouldApplyBStartMargin = true;
     return true;
   }
 
   // Determine if this line is "essentially" the first line
   line_iterator line = begin_lines();
-  if (aState.GetFlag(BRS_HAVELINEADJACENTTOTOP)) {
+  if (aState.mFlags.mHasLineAdjacentToTop) {
     line = aState.mLineAdjacentToTop;
   }
   while (line != aLine) {
     if (!line->CachedIsEmpty() || line->HasClearance()) {
       // A line which precedes aLine is non-empty, or has clearance,
       // so therefore the block-start margin applies.
-      aState.SetFlag(BRS_APPLYBSTARTMARGIN, true);
+      aState.mFlags.mShouldApplyBStartMargin = true;
       return true;
     }
     // No need to apply the block-start margin if the line has floats.  We
     // should collapse anyway (bug 44419)
     ++line;
-    aState.SetFlag(BRS_HAVELINEADJACENTTOTOP, true);
+    aState.mFlags.mHasLineAdjacentToTop = true;
     aState.mLineAdjacentToTop = line;
   }
 
   // The line being reflowed is "essentially" the first line in the
   // block. Therefore its block-start margin will be collapsed by the
   // generational collapsing logic with its parent (us).
   return false;
 }
@@ -3836,17 +3836,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
   WritingMode lineWM = GetWritingMode(aLine->mFirstChild);
   LogicalRect lineRect =
     aFloatAvailableSpace.mRect.ConvertTo(lineWM, outerWM,
                                          aState.ContainerSize());
 
   nscoord iStart = lineRect.IStart(lineWM);
   nscoord availISize = lineRect.ISize(lineWM);
   nscoord availBSize;
-  if (aState.GetFlag(BRS_UNCONSTRAINEDBSIZE)) {
+  if (aState.mFlags.mHasUnconstrainedBSize) {
     availBSize = NS_UNCONSTRAINEDSIZE;
   }
   else {
     /* XXX get the height right! */
     availBSize = lineRect.BSize(lineWM);
   }
 
   // Make sure to enable resize optimization before we call BeginLineReflow
@@ -3854,17 +3854,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
   aLine->EnableResizeReflowOptimization();
 
   aLineLayout.BeginLineReflow(iStart, aState.mBCoord,
                               availISize, availBSize,
                               aFloatAvailableSpace.mHasFloats,
                               false, /*XXX isTopOfPage*/
                               lineWM, aState.mContainerSize);
 
-  aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, false);
+  aState.mFlags.mIsLineLayoutEmpty = false;
 
   // XXX Unfortunately we need to know this before reflowing the first
   // inline frame in the line. FIX ME.
   if ((0 == aLineLayout.GetLineNumber()) &&
       (NS_BLOCK_HAS_FIRST_LETTER_CHILD & mState) &&
       (NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
     aLineLayout.SetFirstLetterStyleOK(true);
   }
@@ -3933,23 +3933,23 @@ nsBlockFrame::DoReflowInlineFrames(Block
         }
         else {
           break;
         }
       }
     }
   }
 
-  aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, aLineLayout.LineIsEmpty());
+  aState.mFlags.mIsLineLayoutEmpty = aLineLayout.LineIsEmpty();
 
   // We only need to backup if the line isn't going to be reflowed again anyway
   bool needsBackup = aLineLayout.NeedsBackup() &&
     (lineReflowStatus == LINE_REFLOW_STOP || lineReflowStatus == LINE_REFLOW_OK);
   if (needsBackup && aLineLayout.HaveForcedBreakPosition()) {
-  	NS_WARNING("We shouldn't be backing up more than once! "
+    NS_WARNING("We shouldn't be backing up more than once! "
                "Someone must have set a break opportunity beyond the available width, "
                "even though there were better break opportunities before it");
     needsBackup = false;
   }
   if (needsBackup) {
     // We need to try backing up to before a text run
     // XXX It's possible, in fact not unusual, for the break opportunity to already
     // be the end of the line. We should detect that and optimize to not
@@ -4533,18 +4533,18 @@ nsBlockFrame::PlaceLine(BlockReflowInput
     aState.mPrevBEndMargin.Zero();
     newBCoord = aLine->BEnd();
   }
   else {
     // Don't let the previous-bottom-margin value affect the newBCoord
     // coordinate (it was applied in ReflowInlineFrames speculatively)
     // since the line is empty.
     // We already called |ShouldApplyBStartMargin|, and if we applied it
-    // then BRS_APPLYBSTARTMARGIN is set.
-    nscoord dy = aState.GetFlag(BRS_APPLYBSTARTMARGIN)
+    // then mShouldApplyBStartMargin is set.
+    nscoord dy = aState.mFlags.mShouldApplyBStartMargin
                    ? -aState.mPrevBEndMargin.get() : 0;
     newBCoord = aState.mBCoord + dy;
   }
 
   if (!NS_FRAME_IS_FULLY_COMPLETE(aState.mReflowStatus) &&
       ShouldAvoidBreakInside(aState.mReflowInput)) {
     aLine->AppendFloats(aState.mCurrentLineFloats);
     aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
@@ -6067,17 +6067,17 @@ nsBlockFrame::AdjustFloatAvailableSpace(
     availISize = aFloatAvailableSpace.ISize(wm);
   }
 
   nscoord availBSize = NS_UNCONSTRAINEDSIZE == aState.ContentBSize()
                        ? NS_UNCONSTRAINEDSIZE
                        : std::max(0, aState.ContentBEnd() - aState.mBCoord);
 
   if (availBSize != NS_UNCONSTRAINEDSIZE &&
-      !aState.GetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED) &&
+      !aState.mFlags.mFloatFragmentsInsideColumnEnabled &&
       nsLayoutUtils::GetClosestFrameOfType(this, nsGkAtoms::columnSetFrame)) {
     // Tell the float it has unrestricted block-size, so it won't break.
     // If the float doesn't actually fit in the column it will fail to be
     // placed, and either move to the block-start of the next column or just
     // overflow.
     availBSize = NS_UNCONSTRAINEDSIZE;
   }
 
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -463,17 +463,17 @@ FRAME_STATE_BIT(Block, 21, NS_BLOCK_HAS_
 
 // This indicates that this is a frame from which child margins can be
 // calculated. The absence of this flag implies that child margin calculations
 // should ignore the frame and look further up the parent chain. Used in
 // nsBlockReflowContext::ComputeCollapsedBStartMargin() via
 // nsBlockFrame::IsMarginRoot().
 //
 // This causes the BlockReflowInput's constructor to set the
-// BRS_ISBSTARTMARGINROOT and BRS_ISBENDMARGINROOT flags.
+// mIsBStartMarginRoot and mIsBEndMarginRoot flags.
 FRAME_STATE_BIT(Block, 22, NS_BLOCK_MARGIN_ROOT)
 
 // This indicates that a block frame should create its own float manager. This
 // is required by each block frame that can contain floats. The float manager is
 // used to reserve space for the floated frames.
 FRAME_STATE_BIT(Block, 23, NS_BLOCK_FLOAT_MGR)
 
 FRAME_STATE_BIT(Block, 24, NS_BLOCK_HAS_LINE_CURSOR)