Bug 843332 - Don't pass the nsBlockReflowState to PullFrameFrom that doesn't use it. Add some assertions. r=bzbarsky

This commit is contained in:
Mats Palmgren 2013-02-28 00:05:46 +01:00
parent 8dc003e7ba
commit 01418b86ec
2 changed files with 9 additions and 12 deletions

View File

@ -2514,7 +2514,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
{
// First check our remaining lines.
if (end_lines() != aLine.next()) {
return PullFrameFrom(aState, aLine, this, aLine.next());
return PullFrameFrom(aLine, this, aLine.next());
}
NS_ASSERTION(!GetOverflowLines(),
@ -2527,8 +2527,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
nextInFlow->DrainSelfOverflowList();
}
if (!nextInFlow->mLines.empty()) {
return PullFrameFrom(aState, aLine, nextInFlow,
nextInFlow->mLines.begin());
return PullFrameFrom(aLine, nextInFlow, nextInFlow->mLines.begin());
}
nextInFlow = static_cast<nsBlockFrame*>(nextInFlow->GetNextInFlow());
aState.mNextInFlow = nextInFlow;
@ -2538,8 +2537,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
}
nsIFrame*
nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
nsLineBox* aLine,
nsBlockFrame::PullFrameFrom(nsLineBox* aLine,
nsBlockFrame* aFromContainer,
nsLineList::iterator aFromLine)
{
@ -2562,10 +2560,9 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
nsIFrame* newFirstChild = frame->GetNextSibling();
if (aFromContainer != this) {
NS_ASSERTION(aState.mPrevChild == aLine->LastChild(),
"mPrevChild should be the LastChild of the line we are adding to");
// The frame is being pulled from a next-in-flow; therefore we
// need to add it to our sibling list.
MOZ_ASSERT(aLine == mLines.back());
MOZ_ASSERT(aFromLine == aFromContainer->mLines.begin(),
"should only pull from first line");
aFromContainer->mFrames.RemoveFrame(frame);
@ -2573,14 +2570,15 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
// When pushing and pulling frames we need to check for whether any
// views need to be reparented.
ReparentFrame(frame, aFromContainer, this);
mFrames.InsertFrame(nullptr, aState.mPrevChild, frame);
mFrames.AppendFrame(nullptr, frame);
// The frame might have (or contain) floats that need to be
// brought over too.
ReparentFloats(frame, aFromContainer, true);
} else {
MOZ_ASSERT(aLine == aFromLine.prev());
}
// when aFromContainer is 'this', then aLine->LastChild()'s next sibling
// is already set correctly.
aLine->NoteFrameAdded(frame);
fromLine->NoteFrameRemoved(frame);

View File

@ -693,8 +693,7 @@ protected:
*
* @return the pulled frame or nullptr
*/
nsIFrame* PullFrameFrom(nsBlockReflowState& aState,
nsLineBox* aLine,
nsIFrame* PullFrameFrom(nsLineBox* aLine,
nsBlockFrame* aFromContainer,
nsLineList::iterator aFromLine);