nsIViewManager::InsertChild does things a little oddly if the sibling is null.

Work around that by twiddling the aAfter parameter appropriately.  Bug 300538,
r=bryner, sr=roc, a=asa
This commit is contained in:
bzbarsky%mit.edu 2005-07-13 19:27:07 +00:00
parent 2757334237
commit 290c7c8457

View File

@ -5248,8 +5248,16 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, PRBool aSavePresentation,
nsIViewManager *parentVM = rootViewParent->GetViewManager(); nsIViewManager *parentVM = rootViewParent->GetViewManager();
if (parentVM && newRootView) { if (parentVM && newRootView) {
// InsertChild(parent, child, sib, PR_TRUE) inserts the child after
// sib in content order, which is before sib in view order. BUT
// when sib is null it inserts at the end of the the document
// order, i.e., first in view order. But when oldRootSibling is
// null, the old root as at the end of the view list --- last in
// content order --- and we want to call InsertChild(parent, child,
// nsnull, PR_FALSE) in that case.
parentVM->InsertChild(rootViewParent, newRootView, parentVM->InsertChild(rootViewParent, newRootView,
rootViewSibling, PR_TRUE); rootViewSibling,
rootViewSibling ? PR_TRUE : PR_FALSE);
NS_ASSERTION(newRootView->GetNextSibling() == rootViewSibling, NS_ASSERTION(newRootView->GetNextSibling() == rootViewSibling,
"error in InsertChild"); "error in InsertChild");