Bug 1338443 Part 1 - Use ReflowInput's float manager in BlockReflowInput. draft
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 09 Feb 2017 16:59:07 +0800
changeset 482551 dd1f194882b2e565b87cca7c74533d00482c94d0
parent 482503 00d16f03506b7f9f754b01a0a458c05445ac6dba
child 482552 e5b26487e2a54ef54e6826366de810edbdca2650
push id45107
push userbmo:tlin@mozilla.com
push dateMon, 13 Feb 2017 05:30:58 +0000
bugs1338443
milestone54.0a1
Bug 1338443 Part 1 - Use ReflowInput's float manager in BlockReflowInput. From the "NS_ASSERTION(mFloatManager)" statement in BlockReflowInput's constructor, we know that BlockReflowInput's mFloatManager is always valid and equals to aReflowInput.mFloatManager. Therefore, we could just use ReflowInput's float manager in BlockReflowInput. Due to the removal of BlockReflowInput's mFloatManager, the logic which resets mFloatManager near the end of nsBlockFrame::Reflow() is removed as well. It's safe because beyond that point, no other logic involves floats, and |state| (i.e. BlockReflowInput) lives only on the stack. MozReview-Commit-ID: 3dwXMnWkEI6
layout/generic/BlockReflowInput.cpp
layout/generic/BlockReflowInput.h
layout/generic/nsBlockFrame.cpp
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -92,25 +92,22 @@ BlockReflowInput::BlockReflowInput(const
   if ((aBEndMarginRoot && !logicalSkipSides.BEnd()) ||
       0 != mBorderPadding.BEnd(wm)) {
     mFlags.mIsBEndMarginRoot = true;
   }
   if (aBlockNeedsFloatManager) {
     mFlags.mBlockNeedsFloatManager = true;
   }
 
-  mFloatManager = aReflowInput.mFloatManager;
+  MOZ_ASSERT(FloatManager(),
+             "Float manager should be valid when creating BlockReflowInput!");
 
-  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
-  }
+  // Save the coordinate system origin for later.
+  FloatManager()->GetTranslation(mFloatManagerI, mFloatManagerB);
+  FloatManager()->PushState(&mFloatManagerStateBefore); // never popped
 
   mReflowStatus = NS_FRAME_COMPLETE;
 
   mNextInFlow = static_cast<nsBlockFrame*>(mBlock->GetNextInFlow());
 
   LAYOUT_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedISize(),
                        "have unconstrained width; this should only result "
                        "from very large sizes, not attempts at intrinsic "
@@ -331,28 +328,28 @@ nsFlowAreaRect
 BlockReflowInput::GetFloatAvailableSpaceWithState(
                     nscoord aBCoord, ShapeType aShapeType,
                     nsFloatManager::SavedState* aState) const
 {
   WritingMode wm = mReflowInput.GetWritingMode();
 #ifdef DEBUG
   // Verify that the caller setup the coordinate system properly
   nscoord wI, wB;
-  mFloatManager->GetTranslation(wI, wB);
+  FloatManager()->GetTranslation(wI, wB);
 
   NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
                "bad coord system");
 #endif
 
   nscoord blockSize = (mContentArea.BSize(wm) == nscoord_MAX)
     ? nscoord_MAX : std::max(mContentArea.BEnd(wm) - aBCoord, 0);
   nsFlowAreaRect result =
-    mFloatManager->GetFlowArea(wm, aBCoord, blockSize,
-                               BandInfoType::BandFromPoint, aShapeType,
-                               mContentArea, aState, ContainerSize());
+    FloatManager()->GetFlowArea(wm, aBCoord, blockSize,
+                                BandInfoType::BandFromPoint, aShapeType,
+                                mContentArea, aState, ContainerSize());
   // Keep the inline size >= 0 for compatibility with nsSpaceManager.
   if (result.mRect.ISize(wm) < 0) {
     result.mRect.ISize(wm) = 0;
   }
 
 #ifdef DEBUG
   if (nsBlockFrame::gNoisyReflow) {
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
@@ -368,26 +365,26 @@ nsFlowAreaRect
 BlockReflowInput::GetFloatAvailableSpaceForBSize(
                       nscoord aBCoord, nscoord aBSize,
                       nsFloatManager::SavedState *aState) const
 {
   WritingMode wm = mReflowInput.GetWritingMode();
 #ifdef DEBUG
   // Verify that the caller setup the coordinate system properly
   nscoord wI, wB;
-  mFloatManager->GetTranslation(wI, wB);
+  FloatManager()->GetTranslation(wI, wB);
 
   NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
                "bad coord system");
 #endif
   nsFlowAreaRect result =
-    mFloatManager->GetFlowArea(wm, aBCoord, aBSize,
-                               BandInfoType::WidthWithinHeight,
-                               ShapeType::ShapeOutside,
-                               mContentArea, aState, ContainerSize());
+    FloatManager()->GetFlowArea(wm, aBCoord, aBSize,
+                                BandInfoType::WidthWithinHeight,
+                                ShapeType::ShapeOutside,
+                                mContentArea, aState, ContainerSize());
   // Keep the width >= 0 for compatibility with nsSpaceManager.
   if (result.mRect.ISize(wm) < 0) {
     result.mRect.ISize(wm) = 0;
   }
 
 #ifdef DEBUG
   if (nsBlockFrame::gNoisyReflow) {
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
@@ -495,36 +492,36 @@ BlockReflowInput::RecoverFloats(nsLineLi
       if (aDeltaBCoord != 0) {
         floatFrame->MovePositionBy(nsPoint(0, aDeltaBCoord));
         nsContainerFrame::PositionFrameView(floatFrame);
         nsContainerFrame::PositionChildViews(floatFrame);
       }
 #ifdef DEBUG
       if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
         nscoord tI, tB;
-        mFloatManager->GetTranslation(tI, tB);
+        FloatManager()->GetTranslation(tI, tB);
         nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
         printf("RecoverFloats: tIB=%d,%d (%d,%d) ",
                tI, tB, mFloatManagerI, mFloatManagerB);
         nsFrame::ListTag(stdout, floatFrame);
         LogicalRect region = nsFloatManager::GetRegionFor(wm, floatFrame,
                                                           ContainerSize());
         printf(" aDeltaBCoord=%d region={%d,%d,%d,%d}\n",
                aDeltaBCoord, region.IStart(wm), region.BStart(wm),
                region.ISize(wm), region.BSize(wm));
       }
 #endif
-      mFloatManager->AddFloat(floatFrame,
-                              nsFloatManager::GetRegionFor(wm, floatFrame,
-                                                           ContainerSize()),
-                              wm, ContainerSize());
+      FloatManager()->AddFloat(floatFrame,
+                               nsFloatManager::GetRegionFor(wm, floatFrame,
+                                                            ContainerSize()),
+                               wm, ContainerSize());
       fc = fc->Next();
     }
   } else if (aLine->IsBlock()) {
-    nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *mFloatManager, wm,
+    nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *FloatManager(), wm,
                                    ContainerSize());
   }
 }
 
 /**
  * Everything done in this function is done O(N) times for each pass of
  * reflow so it is O(N*M) where M is the number of incremental reflow
  * passes.  That's bad.  Don't do stuff here.
@@ -544,17 +541,17 @@ BlockReflowInput::RecoverStateFrom(nsLin
   mCurrentLine = aLine;
 
   // Place floats for this line into the float manager
   if (aLine->HasFloats() || aLine->IsBlock()) {
     RecoverFloats(aLine, aDeltaBCoord);
 
 #ifdef DEBUG
     if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
-      mFloatManager->List(stdout);
+      FloatManager()->List(stdout);
     }
 #endif
   }
 }
 
 // This is called by the line layout's AddFloat method when a
 // place-holder frame is reflowed in a line. If the float is a
 // left-most child (it's x coordinate is at the line's left margin)
@@ -603,20 +600,20 @@ BlockReflowInput::AddFloat(nsLineLayout*
   }
 
   // Because we are in the middle of reflowing a placeholder frame
   // within a line (and possibly nested in an inline frame or two
   // that's a child of our block) we need to restore the space
   // manager's translation to the space that the block resides in
   // before placing the float.
   nscoord oI, oB;
-  mFloatManager->GetTranslation(oI, oB);
+  FloatManager()->GetTranslation(oI, oB);
   nscoord dI = oI - mFloatManagerI;
   nscoord dB = oB - mFloatManagerB;
-  mFloatManager->Translate(-dI, -dB);
+  FloatManager()->Translate(-dI, -dB);
 
   bool placed;
 
   // Now place the float immediately if possible. Otherwise stash it
   // away in mBelowCurrentLineFloats and place it later.
   // If one or more floats has already been pushed to the next line,
   // don't let this one go on the current line, since that would violate
   // float ordering.
@@ -653,17 +650,17 @@ BlockReflowInput::AddFloat(nsLineLayout*
     // deal with this in PlaceBelowCurrentLineFloats
     placed = true;
     // This float will be placed after the line is done (it is a
     // below-current-line float).
     mBelowCurrentLineFloats.Append(mFloatCacheFreeList.Alloc(aFloat));
   }
 
   // Restore coordinate system
-  mFloatManager->Translate(dI, dB);
+  FloatManager()->Translate(dI, dB);
 
   return placed;
 }
 
 bool
 BlockReflowInput::CanPlaceFloat(nscoord aFloatISize,
                                   const nsFlowAreaRect& aFloatAvailableSpace)
 {
@@ -731,17 +728,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
   const nsStyleDisplay* floatDisplay = aFloat->StyleDisplay();
 
   // The float's old region, so we can propagate damage.
   LogicalRect oldRegion = nsFloatManager::GetRegionFor(wm, aFloat,
                                                        ContainerSize());
 
   // Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
   // ``above'' another float that preceded it in the flow.
-  mBCoord = std::max(mFloatManager->GetLowestFloatTop(), mBCoord);
+  mBCoord = std::max(FloatManager()->GetLowestFloatTop(), mBCoord);
 
   // See if the float should clear any preceding floats...
   // XXX We need to mark this float somehow so that it gets reflowed
   // when floats are inserted before it.
   if (StyleClear::None != floatDisplay->mBreakType) {
     // XXXldb Does this handle vertical margins correctly?
     mBCoord = ClearFloats(mBCoord, floatDisplay->PhysicalBreakType(wm));
   }
@@ -983,43 +980,43 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
     nsFloatManager::CalculateRegionFor(wm, aFloat, floatMargin,
                                        ContainerSize());
   // if the float split, then take up all of the vertical height
   if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus) &&
       (NS_UNCONSTRAINEDSIZE != ContentBSize())) {
     region.BSize(wm) = std::max(region.BSize(wm),
                                 ContentBSize() - floatPos.B(wm));
   }
-  mFloatManager->AddFloat(aFloat, region, wm, ContainerSize());
+  FloatManager()->AddFloat(aFloat, region, wm, ContainerSize());
 
   // store region
   nsFloatManager::StoreRegionFor(wm, aFloat, region, ContainerSize());
 
   // If the float's dimensions have changed, note the damage in the
   // float manager.
   if (!region.IsEqualEdges(oldRegion)) {
     // XXXwaterson conservative: we could probably get away with noting
     // less damage; e.g., if only height has changed, then only note the
     // area into which the float has grown or from which the float has
     // shrunk.
     nscoord blockStart = std::min(region.BStart(wm), oldRegion.BStart(wm));
     nscoord blockEnd = std::max(region.BEnd(wm), oldRegion.BEnd(wm));
-    mFloatManager->IncludeInDamage(blockStart, blockEnd);
+    FloatManager()->IncludeInDamage(blockStart, blockEnd);
   }
 
   if (!NS_FRAME_IS_FULLY_COMPLETE(reflowStatus)) {
     mBlock->SplitFloat(*this, aFloat, reflowStatus);
   } else {
     MOZ_ASSERT(!aFloat->GetNextInFlow());
   }
 
 #ifdef DEBUG
   if (nsBlockFrame::gNoisyFloatManager) {
     nscoord tI, tB;
-    mFloatManager->GetTranslation(tI, tB);
+    FloatManager()->GetTranslation(tI, tB);
     nsIFrame::ListTag(stdout, mBlock);
     printf(": FlowAndPlaceFloat: AddFloat: tIB=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
            tI, tB, mFloatManagerI, mFloatManagerB,
            region.IStart(wm), region.BStart(wm),
            region.ISize(wm), region.BSize(wm));
   }
 
   if (nsBlockFrame::gNoisyReflow) {
@@ -1040,20 +1037,20 @@ BlockReflowInput::PushFloatPastBreak(nsI
   // This ensures that we:
   //  * don't try to place later but smaller floats (which CSS says
   //    must have their tops below the top of this float)
   //  * don't waste much time trying to reflow this float again until
   //    after the break
   StyleFloat floatStyle =
     aFloat->StyleDisplay()->PhysicalFloats(mReflowInput.GetWritingMode());
   if (floatStyle == StyleFloat::Left) {
-    mFloatManager->SetPushedLeftFloatPastBreak();
+    FloatManager()->SetPushedLeftFloatPastBreak();
   } else {
     MOZ_ASSERT(floatStyle == StyleFloat::Right, "Unexpected float value!");
-    mFloatManager->SetPushedRightFloatPastBreak();
+    FloatManager()->SetPushedRightFloatPastBreak();
   }
 
   // Put the float on the pushed floats list, even though it
   // isn't actually a continuation.
   DebugOnly<nsresult> rv = mBlock->StealFrame(aFloat);
   NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame should succeed");
   AppendPushedFloatChain(aFloat);
   NS_FRAME_SET_OVERFLOW_INCOMPLETE(mReflowStatus);
@@ -1098,27 +1095,27 @@ BlockReflowInput::ClearFloats(nscoord aB
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
     printf("clear floats: in: aBCoord=%d\n", aBCoord);
   }
 #endif
 
 #ifdef NOISY_FLOAT_CLEARING
   printf("BlockReflowInput::ClearFloats: aBCoord=%d breakType=%s\n",
          aBCoord, nsLineBox::BreakTypeToString(aBreakType));
-  mFloatManager->List(stdout);
+  FloatManager()->List(stdout);
 #endif
 
-  if (!mFloatManager->HasAnyFloats()) {
+  if (!FloatManager()->HasAnyFloats()) {
     return aBCoord;
   }
 
   nscoord newBCoord = aBCoord;
 
   if (aBreakType != StyleClear::None) {
-    newBCoord = mFloatManager->ClearFloats(newBCoord, aBreakType, aFlags);
+    newBCoord = FloatManager()->ClearFloats(newBCoord, aBreakType, aFlags);
   }
 
   if (aReplacedBlock) {
     for (;;) {
       nsFlowAreaRect floatAvailableSpace = GetFloatAvailableSpace(newBCoord);
       if (ReplacedBlockFitsInAvailSpace(aReplacedBlock, floatAvailableSpace)) {
         break;
       }
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -154,16 +154,23 @@ public:
 
   // Returns the first coordinate >= aBCoord that clears the
   // floats indicated by aBreakType and has enough inline size between floats
   // (or no floats remaining) to accomodate aReplacedBlock.
   nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
                       nsIFrame *aReplacedBlock = nullptr,
                       uint32_t aFlags = 0);
 
+  nsFloatManager* FloatManager() const {
+    MOZ_ASSERT(mReflowInput.mFloatManager,
+               "Float manager should be valid during the lifetime of "
+               "BlockReflowInput!");
+    return mReflowInput.mFloatManager;
+  }
+
   // Advances to the next band, i.e., the next horizontal stripe in
   // which there is a different set of floats.
   // Return false if it did not advance, which only happens for
   // constrained heights (and means that we should get pushed to the
   // next column/page).
   bool AdvanceToNextBand(const mozilla::LogicalRect& aFloatAvailableSpace,
                          nscoord *aBCoord) const {
     mozilla::WritingMode wm = mReflowInput.GetWritingMode();
@@ -235,18 +242,16 @@ public:
 
   // The block frame that is using this object
   nsBlockFrame* mBlock;
 
   nsPresContext* mPresContext;
 
   const ReflowInput& mReflowInput;
 
-  nsFloatManager* mFloatManager;
-
   // The coordinates within the float manager where the block is being
   // placed <b>after</b> taking into account the blocks border and
   // padding. This, therefore, represents the inner "content area" (in
   // spacemanager coordinates) where child frames will be placed,
   // including child blocks and floats.
   nscoord mFloatManagerI, mFloatManagerB;
 
   // XXX get rid of this
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1263,17 +1263,17 @@ nsBlockFrame::Reflow(nsPresContext*     
 
   NS_MergeReflowStatusInto(&state.mReflowStatus, ocStatus);
   NS_MergeReflowStatusInto(&state.mReflowStatus, fcStatus);
 
   // If we end in a BR with clear and affected floats continue,
   // we need to continue, too.
   if (NS_UNCONSTRAINEDSIZE != reflowInput->AvailableBSize() &&
       NS_FRAME_IS_COMPLETE(state.mReflowStatus) &&
-      state.mFloatManager->ClearContinues(FindTrailingClear())) {
+      state.FloatManager()->ClearContinues(FindTrailingClear())) {
     NS_FRAME_SET_INCOMPLETE(state.mReflowStatus);
   }
 
   if (!NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) {
     if (HasOverflowLines() || HasPushedFloats()) {
       state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
     }
 
@@ -1453,22 +1453,16 @@ nsBlockFrame::Reflow(nsPresContext*     
                                 state.mReflowStatus,
                                 containingBlock, flags,
                                 &aMetrics.mOverflowAreas);
     }
   }
 
   FinishAndStoreOverflow(&aMetrics);
 
-  // Clear the float manager pointer in the block reflow state so we
-  // don't waste time translating the coordinate system back on a dead
-  // float manager.
-  if (needFloatManager)
-    state.mFloatManager = nullptr;
-
   aStatus = state.mReflowStatus;
 
 #ifdef DEBUG
   // Between when we drain pushed floats and when we complete reflow,
   // we're allowed to have multiple continuations of the same float on
   // our floats list, since a first-in-flow might get pushed to a later
   // continuation of its containing block.  But it's not permitted
   // outside that time.
@@ -2034,17 +2028,17 @@ nsBlockFrame::PrepareResizeReflow(BlockR
  * |aDeltaBCoord| indicates how much it will later be slid (assuming it
  * doesn't get marked dirty and reflowed entirely).
  */
 void
 nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
                                    nsLineBox* aLine,
                                    nscoord aDeltaBCoord)
 {
-  nsFloatManager *floatManager = aState.mReflowInput.mFloatManager;
+  nsFloatManager* floatManager = aState.FloatManager();
   NS_ASSERTION((aState.mReflowInput.mParentReflowInput &&
                 aState.mReflowInput.mParentReflowInput->mFloatManager == floatManager) ||
                 aState.mReflowInput.mBlockDelta == 0, "Bad block delta passed in");
 
   // Check to see if there are any floats; if there aren't, there can't
   // be any float damage
   if (!floatManager->HasAnyFloats())
     return;
@@ -3447,17 +3441,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
       // brc.ReflowBlock() below does, so we need to remember now
       // whether it's empty.
       const bool shouldStoreClearance =
         aState.mReflowInput.mDiscoveredClearance &&
         !*aState.mReflowInput.mDiscoveredClearance;
 
       // Reflow the block into the available space
       if (mayNeedRetry || replacedBlock) {
-        aState.mFloatManager->PushState(&floatManagerState);
+        aState.FloatManager()->PushState(&floatManagerState);
       }
 
       if (mayNeedRetry) {
         blockHtmlRI->mDiscoveredClearance = &clearanceFrame;
       } else if (!applyBStartMargin) {
         blockHtmlRI->mDiscoveredClearance =
           aState.mReflowInput.mDiscoveredClearance;
       }
@@ -3523,17 +3517,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
       aState.ComputeBlockAvailSpace(frame, floatAvailableSpace,
                                     replacedBlock != nullptr, availSpace);
 
       if (!advanced && availSpace.IsEqualEdges(oldAvailSpace)) {
         break;
       }
 
       // We need another reflow.
-      aState.mFloatManager->PopState(&floatManagerState);
+      aState.FloatManager()->PopState(&floatManagerState);
 
       if (!treatWithClearance && !applyBStartMargin &&
           aState.mReflowInput.mDiscoveredClearance) {
         // We set shouldStoreClearance above to record only the first
         // frame that requires clearance.
         if (shouldStoreClearance) {
           *aState.mReflowInput.mDiscoveredClearance = frame;
         }
@@ -3555,17 +3549,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
 
       blockHtmlRI.reset();
       blockHtmlRI.emplace(
         aState.mPresContext, aState.mReflowInput, frame,
         availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm));
     } while (true);
 
     if (mayNeedRetry && clearanceFrame) {
-      aState.mFloatManager->PopState(&floatManagerState);
+      aState.FloatManager()->PopState(&floatManagerState);
       aState.mBCoord = startingBCoord;
       aState.mPrevBEndMargin = incomingMargin;
       continue;
     }
 
     aState.mPrevChild = frame;
 
     if (blockHtmlRI->WillReflowAgainForClearance()) {
@@ -3808,27 +3802,27 @@ nsBlockFrame::ReflowInlineFrames(BlockRe
     aState.mLineBSize.reset();
     do {
       bool allowPullUp = true;
       nsIFrame* forceBreakInFrame = nullptr;
       int32_t forceBreakOffset = -1;
       gfxBreakPriority forceBreakPriority = gfxBreakPriority::eNoBreak;
       do {
         nsFloatManager::SavedState floatManagerState;
-        aState.mReflowInput.mFloatManager->PushState(&floatManagerState);
+        aState.FloatManager()->PushState(&floatManagerState);
 
         // Once upon a time we allocated the first 30 nsLineLayout objects
         // on the stack, and then we switched to the heap.  At that time
         // these objects were large (1100 bytes on a 32 bit system).
         // Then the nsLineLayout object was shrunk to 156 bytes by
         // removing some internal buffers.  Given that it is so much
         // smaller, the complexity of 2 different ways of allocating
         // no longer makes sense.  Now we always allocate on the stack.
         nsLineLayout lineLayout(aState.mPresContext,
-                                aState.mReflowInput.mFloatManager,
+                                aState.FloatManager(),
                                 &aState.mReflowInput, &aLine, nullptr);
         lineLayout.Init(&aState, aState.mMinLineHeight, aState.mLineNumber);
         if (forceBreakInFrame) {
           lineLayout.ForceBreakAtPosition(forceBreakInFrame, forceBreakOffset);
         }
         DoReflowInlineFrames(aState, lineLayout, aLine,
                              floatAvailableSpace, availableSpaceBSize,
                              &floatManagerState, aKeepReflowGoing,
@@ -3844,17 +3838,17 @@ nsBlockFrame::ReflowInlineFrames(BlockRe
             // set forceBreakInFrame to null and we won't back up, which is
             // correct.
             forceBreakInFrame =
               lineLayout.GetLastOptionalBreakPosition(&forceBreakOffset, &forceBreakPriority);
           } else {
             forceBreakInFrame = nullptr;
           }
           // restore the float manager state
-          aState.mReflowInput.mFloatManager->PopState(&floatManagerState);
+          aState.FloatManager()->PopState(&floatManagerState);
           // Clear out float lists
           aState.mCurrentLineFloats.DeleteAll();
           aState.mBelowCurrentLineFloats.DeleteAll();
         }
 
         // Don't allow pullup on a subsequent LineReflowStatus::RedoNoPull pass
         allowPullUp = false;
       } while (LineReflowStatus::RedoNoPull == lineReflowStatus);
@@ -4044,30 +4038,30 @@ nsBlockFrame::DoReflowInlineFrames(Block
     // See the analogous code for blocks in BlockReflowInput::ClearFloats.
     if (aFloatAvailableSpace.mRect.BSize(outerWM) > 0) {
       NS_ASSERTION(aFloatAvailableSpace.mHasFloats,
                    "redo line on totally empty line with non-empty band...");
       // We should never hit this case if we've placed floats on the
       // line; if we have, then the GetFloatAvailableSpace call is wrong
       // and needs to happen after the caller pops the space manager
       // state.
-      aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
+      aState.FloatManager()->AssertStateMatches(aFloatStateBeforeLine);
       aState.mBCoord += aFloatAvailableSpace.mRect.BSize(outerWM);
       aFloatAvailableSpace = aState.GetFloatAvailableSpace();
     } else {
       NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowInput.AvailableBSize(),
                    "We shouldn't be running out of height here");
       if (NS_UNCONSTRAINEDSIZE == aState.mReflowInput.AvailableBSize()) {
         // just move it down a bit to try to get out of this mess
         aState.mBCoord += 1;
         // We should never hit this case if we've placed floats on the
         // line; if we have, then the GetFloatAvailableSpace call is wrong
         // and needs to happen after the caller pops the space manager
         // state.
-        aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
+        aState.FloatManager()->AssertStateMatches(aFloatStateBeforeLine);
         aFloatAvailableSpace = aState.GetFloatAvailableSpace();
       } else {
         // There's nowhere to retry placing the line, so we want to push
         // it to the next page/column where its contents can fit not
         // next to a float.
         lineReflowStatus = LineReflowStatus::Truncated;
         PushTruncatedLine(aState, aLine, aKeepReflowGoing);
       }
@@ -4318,20 +4312,20 @@ nsBlockFrame::SplitFloat(BlockReflowInpu
   }
   if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aFloatStatus)) {
     nextInFlow->AddStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
   }
 
   StyleFloat floatStyle =
     aFloat->StyleDisplay()->PhysicalFloats(aState.mReflowInput.GetWritingMode());
   if (floatStyle == StyleFloat::Left) {
-    aState.mFloatManager->SetSplitLeftFloatAcrossBreak();
+    aState.FloatManager()->SetSplitLeftFloatAcrossBreak();
   } else {
     MOZ_ASSERT(floatStyle == StyleFloat::Right, "Unexpected float side!");
-    aState.mFloatManager->SetSplitRightFloatAcrossBreak();
+    aState.FloatManager()->SetSplitRightFloatAcrossBreak();
   }
 
   aState.AppendPushedFloatChain(nextInFlow);
   NS_FRAME_SET_OVERFLOW_INCOMPLETE(aState.mReflowStatus);
   return NS_OK;
 }
 
 static nsFloatCache*
@@ -7280,17 +7274,17 @@ nsBlockFrame::CheckFloats(BlockReflowInp
     // be larger than necessary, causing this block to get an
     // incorrect desired height (or width).  Some of these floats
     // may not actually have been added to the float manager because
     // they weren't reflowed before being pushed; that's OK,
     // RemoveRegions will ignore them. It is safe to do this here
     // because we know from here on the float manager will only be
     // used for its XMost and YMost, not to place new floats and
     // lines.
-    aState.mFloatManager->RemoveTrailingRegions(oofs->FirstChild());
+    aState.FloatManager()->RemoveTrailingRegions(oofs->FirstChild());
   }
 }
 
 void
 nsBlockFrame::IsMarginRoot(bool* aBStartMarginRoot, bool* aBEndMarginRoot)
 {
   if (!(GetStateBits() & NS_BLOCK_MARGIN_ROOT)) {
     nsIFrame* parent = GetParent();