From 063882b8567dd33fab213df17022879b45e2d8f7 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Thu, 28 Feb 2013 00:05:46 +0100 Subject: [PATCH] Bug 843332 - Don't pass the nsBlockReflowState to PullFrameFrom that doesn't use it. Add some assertions. r=bzbarsky --- layout/generic/nsBlockFrame.cpp | 18 ++++++++---------- layout/generic/nsBlockFrame.h | 3 +-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 9447391365c1..7fc01e8e302d 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -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(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); diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index ff29f661dbc2..82ec0f9fbd0c 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -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);