This commit is contained in:
Chris Pearce 2012-08-15 13:51:19 +12:00
Родитель b8a94acfbf
Коммит 60b0bda8c8
2 изменённых файлов: 30 добавлений и 5 удалений

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

@ -94,4 +94,7 @@ LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/layout/base \
-I$(topsrcdir)/xpcom/ds \
-I$(topsrcdir)/layout/generic \
-I$(topsrcdir)/layout/xul/base/src \
-I$(topsrcdir)/content/base/src \
$(NULL)

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

@ -170,6 +170,7 @@
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsSubDocumentFrame.h"
// for embedding
#include "nsIWebBrowserChromeFocus.h"
@ -7162,7 +7163,7 @@ nsDocShell::RestoreFromHistory()
// Make sure to blow away our mLoadingURI just in case. No loads
// from inside this pagehide.
mLoadingURI = nullptr;
// Notify the old content viewer that it's being hidden.
FirePageHideNotification(!mSavingOldViewer);
@ -7243,6 +7244,17 @@ nsDocShell::RestoreFromHistory()
}
}
nsCOMPtr<nsIContent> container;
nsCOMPtr<nsIDocument> sibling;
if (rootViewParent && rootViewParent->GetParent()) {
nsIFrame* frame = rootViewParent->GetParent()->GetFrame();
container = frame ? frame->GetContent() : nullptr;
}
if (rootViewSibling) {
nsIFrame *frame = rootViewSibling->GetFrame();
sibling = frame ? frame->PresContext()->PresShell()->GetDocument() : nullptr;
}
// Transfer ownership to mContentViewer. By ensuring that either the
// docshell or the session history, but not both, have references to the
// content viewer, we prevent the viewer from being torn down after
@ -7331,7 +7343,7 @@ nsDocShell::RestoreFromHistory()
// mLSHE is now our currently-loaded document.
SetHistoryEntry(&mOSHE, mLSHE);
// XXX special wyciwyg handling in Embed()?
// We aren't going to restore any items from the LayoutHistoryState,
@ -7445,10 +7457,20 @@ nsDocShell::RestoreFromHistory()
nsIView *newRootView = newVM ? newVM->GetRootView() : nullptr;
// Insert the new root view at the correct location in the view tree.
if (rootViewParent) {
if (container) {
nsSubDocumentFrame* subDocFrame = do_QueryFrame(container->GetPrimaryFrame());
rootViewParent = subDocFrame ? subDocFrame->EnsureInnerView() : nullptr;
}
if (sibling &&
sibling->GetShell() &&
sibling->GetShell()->GetViewManager()) {
rootViewSibling = sibling->GetShell()->GetViewManager()->GetRootView();
} else {
rootViewSibling = nullptr;
}
if (rootViewParent && newRootView && newRootView->GetParent() != rootViewParent) {
nsIViewManager *parentVM = rootViewParent->GetViewManager();
if (parentVM && newRootView) {
if (parentVM) {
// InsertChild(parent, child, sib, 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