Bug 729519 - Simplify DestroyOverflowList() by requiring that the list is empty. r=bzbarsky

This commit is contained in:
Mats Palmgren 2013-04-01 17:26:02 +02:00
Родитель 7fed9e6d53
Коммит 07c2d4d760
3 изменённых файлов: 17 добавлений и 27 удалений

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

@ -1278,7 +1278,7 @@ nsContainerFrame::StealFrame(nsPresContext* aPresContext,
if (frameList) {
removed = frameList->ContinueRemoveFrame(aChild);
if (frameList->IsEmpty()) {
DestroyOverflowList(aPresContext, nullptr);
DestroyOverflowList(aPresContext);
}
}
}
@ -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

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

@ -441,12 +441,9 @@ protected:
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
@ -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___ */

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

@ -767,21 +767,20 @@ 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.
@ -789,7 +788,7 @@ nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,
}
}
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.
@ -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;
}