Skip to content

Commit

Permalink
Bug 729519 - Simplify DestroyOverflowList() by requiring that the lis…
Browse files Browse the repository at this point in the history
…t is empty. r=bzbarsky
  • Loading branch information
MatsPalmgren committed Apr 1, 2013
1 parent 6e8b9f5 commit 75567bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
16 changes: 1 addition & 15 deletions layout/generic/nsContainerFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ nsContainerFrame::StealFrame(nsPresContext* aPresContext,
if (frameList) {
removed = frameList->ContinueRemoveFrame(aChild);
if (frameList->IsEmpty()) {
DestroyOverflowList(aPresContext, nullptr);
DestroyOverflowList(aPresContext);
}
}
}
Expand Down Expand Up @@ -1325,20 +1325,6 @@ nsContainerFrame::StealFramesAfter(nsIFrame* aChild)
return nsFrameList::EmptyList();
}

void
nsContainerFrame::DestroyOverflowList(nsPresContext* aPresContext,
nsIFrame* aDestructRoot)
{
nsFrameList* list =
RemovePropTableFrames(aPresContext, OverflowProperty());
if (list) {
if (aDestructRoot)
list->DestroyFrom(aDestructRoot);
else
list->Destroy();
}
}

/*
* Create a next-in-flow for aFrame. Will return the newly created
* frame in aNextInFlowResult <b>if and only if</b> a new frame is
Expand Down
15 changes: 10 additions & 5 deletions layout/generic/nsContainerFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,9 @@ class nsContainerFrame : public nsSplittableFrame
const nsFrameList& aOverflowFrames);

/**
* Destroy the overflow list and any frames that are on it.
* Calls DestructFrom() insead of Destruct() on the frames if
* aDestructRoot is non-null.
* Destroy the overflow list, which must be empty.
*/
void DestroyOverflowList(nsPresContext* aPresContext,
nsIFrame* aDestructRoot);
inline void DestroyOverflowList(nsPresContext* aPresContext);

/**
* Moves any frames on both the prev-in-flow's overflow list and the
Expand Down Expand Up @@ -678,4 +675,12 @@ nsContainerFrame::StealOverflowFrames()
return list;
}

inline void
nsContainerFrame::DestroyOverflowList(nsPresContext* aPresContext)
{
nsFrameList* list = RemovePropTableFrames(aPresContext, OverflowProperty());
MOZ_ASSERT(list && list->IsEmpty());
delete list;
}

#endif /* nsContainerFrame_h___ */
13 changes: 6 additions & 7 deletions layout/generic/nsInlineFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,29 +767,28 @@ nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,

nsIFrame* frame = nullptr;
nsInlineFrame* nextInFlow = irs.mNextInFlow;
while (nullptr != nextInFlow) {
while (nextInFlow) {
frame = nextInFlow->mFrames.FirstChild();
if (!frame) {
// The nextInFlow's principal list has no frames, try its overflow list.
nsFrameList* overflowFrames = nextInFlow->GetOverflowFrames();
if (overflowFrames) {
frame = overflowFrames->FirstChild();
if (!frame->GetNextSibling()) {
frame = overflowFrames->RemoveFirstChild();
if (overflowFrames->IsEmpty()) {
// We're stealing the only frame - delete the overflow list.
delete nextInFlow->StealOverflowFrames();
nextInFlow->DestroyOverflowList(aPresContext);
} else {
// We leave the remaining frames on the overflow list (rather than
// putting them on nextInFlow's principal list) so we don't have to
// set up the parent for them.
overflowFrames->RemoveFirstChild();
}
// ReparentFloatsForInlineChild needs it to be on a child list -
// we remove it again below.
nextInFlow->mFrames.SetFrames(frame);
}
}

if (nullptr != frame) {
if (frame) {
// If our block has no next continuation, then any floats belonging to
// the pulled frame must belong to our block already. This check ensures
// we do no extra work in the common non-vertical-breaking case.
Expand All @@ -810,7 +809,7 @@ nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,
nsContainerFrame::ReparentFrameView(aPresContext, frame, nextInFlow, this);
break;
}
nextInFlow = (nsInlineFrame*) nextInFlow->GetNextInFlow();
nextInFlow = static_cast<nsInlineFrame*>(nextInFlow->GetNextInFlow());
irs.mNextInFlow = nextInFlow;
}

Expand Down

0 comments on commit 75567bc

Please sign in to comment.