Fix for bug 74319, removing O(n^2) algorithm when restoring session frame state. This saves time on big pages. r=waterson sr=attinasi

This commit is contained in:
bratell%lysator.liu.se 2001-04-05 03:11:30 +00:00
Родитель ec68e28def
Коммит c8114e3187
2 изменённых файлов: 36 добавлений и 8 удалений

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

@ -4448,10 +4448,24 @@ PresShell::ContentAppended(nsIDocument *aDocument,
// If history state has been set by session history, ask the frame manager
// to restore frame state for the frame hierarchy created for the chunk of
// content that just came in.
nsIFrame* frame;
rv = GetPrimaryFrameFor(aContainer, &frame);
if (NS_SUCCEEDED(rv) && nsnull != frame)
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
// That is the frames with numbers after aNewIndexInContainer.
PRInt32 count = 0;
aContainer->ChildCount(count);
PRInt32 i;
nsCOMPtr<nsIContent> newChild;
for (i = aNewIndexInContainer; i < count; ++i) {
aContainer->ChildAt(i, *getter_AddRefs(newChild));
if (!newChild) {
// We should never get here.
NS_ERROR("Got a null child when restoring state!");
continue;
}
nsIFrame* frame;
rv = GetPrimaryFrameFor(newChild, &frame);
if (NS_SUCCEEDED(rv) && nsnull != frame)
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
}
}
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));

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

@ -4448,10 +4448,24 @@ PresShell::ContentAppended(nsIDocument *aDocument,
// If history state has been set by session history, ask the frame manager
// to restore frame state for the frame hierarchy created for the chunk of
// content that just came in.
nsIFrame* frame;
rv = GetPrimaryFrameFor(aContainer, &frame);
if (NS_SUCCEEDED(rv) && nsnull != frame)
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
// That is the frames with numbers after aNewIndexInContainer.
PRInt32 count = 0;
aContainer->ChildCount(count);
PRInt32 i;
nsCOMPtr<nsIContent> newChild;
for (i = aNewIndexInContainer; i < count; ++i) {
aContainer->ChildAt(i, *getter_AddRefs(newChild));
if (!newChild) {
// We should never get here.
NS_ERROR("Got a null child when restoring state!");
continue;
}
nsIFrame* frame;
rv = GetPrimaryFrameFor(newChild, &frame);
if (NS_SUCCEEDED(rv) && nsnull != frame)
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
}
}
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));