зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
ec68e28def
Коммит
c8114e3187
|
@ -4448,11 +4448,25 @@ 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.
|
||||
// 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(aContainer, &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));
|
||||
MOZ_TIMER_STOP(mFrameCreationWatch);
|
||||
|
|
|
@ -4448,11 +4448,25 @@ 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.
|
||||
// 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(aContainer, &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));
|
||||
MOZ_TIMER_STOP(mFrameCreationWatch);
|
||||
|
|
Загрузка…
Ссылка в новой задаче