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
Родитель 76d488f34c
Коммит 063882b856
2 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

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

Просмотреть файл

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