diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index c5172d046354..497f535ca9ed 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -5013,7 +5013,7 @@ bool nsBlockFrame::DrainOverflowLines() { mLines.splice(mLines.begin(), overflowLines->mLines); NS_ASSERTION(overflowLines->mLines.empty(), "splice should empty list"); delete overflowLines; - AddFrames(ocContinuations, mFrames.LastChild()); + AddFrames(ocContinuations, mFrames.LastChild(), nullptr); didFindOverflow = true; } } @@ -5339,7 +5339,7 @@ void nsBlockFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) { GetParent()->AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY); } - AddFrames(aFrameList, lastKid); + AddFrames(aFrameList, lastKid, nullptr); if (aListID != kNoReflowPrincipalList) { PresShell()->FrameNeedsReflow( this, IntrinsicDirty::TreeChange, @@ -5375,7 +5375,7 @@ void nsBlockFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame, printf("\n"); #endif - AddFrames(aFrameList, aPrevFrame); + AddFrames(aFrameList, aPrevFrame, aPrevFrameLine); if (aListID != kNoReflowPrincipalList) { PresShell()->FrameNeedsReflow( this, IntrinsicDirty::TreeChange, @@ -5436,7 +5436,8 @@ static bool ShouldPutNextSiblingOnNewLine(nsIFrame* aLastFrame) { return false; } -void nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling) { +void nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling, + const nsLineList::iterator* aPrevSiblingLine) { // Clear our line cursor, since our lines may change. ClearLineCursor(); @@ -7027,7 +7028,7 @@ void nsBlockFrame::SetInitialChildList(ChildListID aListID, "NS_BLOCK_HAS_FIRST_LETTER_STYLE state out of sync"); #endif - AddFrames(aChildList, nullptr); + AddFrames(aChildList, nullptr, nullptr); } else { nsContainerFrame::SetInitialChildList(aListID, aChildList); } diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 6511fd018d2c..2c53666196ad 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -485,8 +485,12 @@ class nsBlockFrame : public nsContainerFrame { * contains aPrevSibling and add aFrameList after aPrevSibling on that line. * New lines are created as necessary to handle block data in aFrameList. * This function will clear aFrameList. + * + * aPrevSiblingLine, if present, must be the line containing aPrevSibling. + * Providing it will make this function faster. */ - void AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling); + void AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling, + const nsLineList::iterator* aPrevSiblingLine); /** * Perform Bidi resolution on this frame