mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 654002 - Remove frame continuations iteratively, not recursively. r=roc
This commit is contained in:
parent
205547ec21
commit
bf73757e39
@ -219,8 +219,9 @@ nsContainerFrame::RemoveFrame(nsIAtom* aListName,
|
||||
generateReflowCommand = PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
nsContainerFrame* parent = static_cast<nsContainerFrame*>(aOldFrame->GetParent());
|
||||
while (aOldFrame) {
|
||||
nsContainerFrame* parent =
|
||||
static_cast<nsContainerFrame*>(aOldFrame->GetParent());
|
||||
// When the parent is an inline frame we have a simple task - just
|
||||
// remove the frame from its parents list and generate a reflow
|
||||
// command.
|
||||
@ -237,15 +238,17 @@ nsContainerFrame::RemoveFrame(nsIAtom* aListName,
|
||||
aOldFrame->Destroy();
|
||||
}
|
||||
} else {
|
||||
// This recursive call takes care of all continuations after aOldFrame,
|
||||
// so we don't need to loop anymore.
|
||||
parent->RemoveFrame(nsnull, aOldFrame);
|
||||
break;
|
||||
// We don't want to simply make a recursive call here because with
|
||||
// thousands of continuations it would exhaust the stack. Instead,
|
||||
// unhook aOldFrame from the continuation chain, destroy it, and
|
||||
// continue the loop.
|
||||
if (oldFrameNextContinuation) {
|
||||
oldFrameNextContinuation->SetPrevContinuation(nsnull);
|
||||
aOldFrame->SetNextContinuation(nsnull);
|
||||
}
|
||||
parent->RemoveFrame(aListName, aOldFrame);
|
||||
}
|
||||
aOldFrame = oldFrameNextContinuation;
|
||||
if (aOldFrame) {
|
||||
parent = static_cast<nsContainerFrame*>(aOldFrame->GetParent());
|
||||
}
|
||||
}
|
||||
|
||||
if (generateReflowCommand) {
|
||||
|
Loading…
Reference in New Issue
Block a user