diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 23a1a16aeda..59a576257a6 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -51,6 +51,7 @@ #include "nsIDOMHTMLElement.h" #include "nsIDOMRange.h" #include "nsLayoutCID.h" +#include "nsHTMLParts.h" #include "nsViewsCID.h" #include "nsWidgetsCID.h" @@ -74,6 +75,7 @@ #include "nsIDocShellTreeOwner.h" #include "nsIDocShell.h" #include "nsIFrameDebug.h" +#include "nsILayoutHistoryState.h" #include "nsLayoutAtoms.h" #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" @@ -1003,9 +1005,27 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, cx->SetCompatibilityMode(mode); cx->SetContainer(aParent); + + // get the old history + nsCOMPtr presShell; + nsCOMPtr layoutState; + NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE); + presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE); + + ps->BeginObservingDocument(); //lay it out... ps->InitialReflow(width, height); + // update the history from the old presentation shell + nsCOMPtr fm; + rv = ps->GetFrameManager(getter_AddRefs(fm)); + if(NS_SUCCEEDED(rv) && fm) { + nsIFrame* root; + ps->GetRootFrame(&root); + fm->RestoreFrameState(cx, root, layoutState); + } + ps->EndObservingDocument(); + // Ask the page sequence frame to print all the pages nsIPageSequenceFrame* pageSequence; nsPrintOptions options; diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 23a1a16aeda..59a576257a6 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -51,6 +51,7 @@ #include "nsIDOMHTMLElement.h" #include "nsIDOMRange.h" #include "nsLayoutCID.h" +#include "nsHTMLParts.h" #include "nsViewsCID.h" #include "nsWidgetsCID.h" @@ -74,6 +75,7 @@ #include "nsIDocShellTreeOwner.h" #include "nsIDocShell.h" #include "nsIFrameDebug.h" +#include "nsILayoutHistoryState.h" #include "nsLayoutAtoms.h" #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" @@ -1003,9 +1005,27 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, cx->SetCompatibilityMode(mode); cx->SetContainer(aParent); + + // get the old history + nsCOMPtr presShell; + nsCOMPtr layoutState; + NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE); + presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE); + + ps->BeginObservingDocument(); //lay it out... ps->InitialReflow(width, height); + // update the history from the old presentation shell + nsCOMPtr fm; + rv = ps->GetFrameManager(getter_AddRefs(fm)); + if(NS_SUCCEEDED(rv) && fm) { + nsIFrame* root; + ps->GetRootFrame(&root); + fm->RestoreFrameState(cx, root, layoutState); + } + ps->EndObservingDocument(); + // Ask the page sequence frame to print all the pages nsIPageSequenceFrame* pageSequence; nsPrintOptions options; diff --git a/mozilla/layout/base/src/nsDocumentViewer.cpp b/mozilla/layout/base/src/nsDocumentViewer.cpp index 23a1a16aeda..59a576257a6 100644 --- a/mozilla/layout/base/src/nsDocumentViewer.cpp +++ b/mozilla/layout/base/src/nsDocumentViewer.cpp @@ -51,6 +51,7 @@ #include "nsIDOMHTMLElement.h" #include "nsIDOMRange.h" #include "nsLayoutCID.h" +#include "nsHTMLParts.h" #include "nsViewsCID.h" #include "nsWidgetsCID.h" @@ -74,6 +75,7 @@ #include "nsIDocShellTreeOwner.h" #include "nsIDocShell.h" #include "nsIFrameDebug.h" +#include "nsILayoutHistoryState.h" #include "nsLayoutAtoms.h" #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" @@ -1003,9 +1005,27 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, cx->SetCompatibilityMode(mode); cx->SetContainer(aParent); + + // get the old history + nsCOMPtr presShell; + nsCOMPtr layoutState; + NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE); + presShell->CaptureHistoryState(getter_AddRefs(layoutState),PR_TRUE); + + ps->BeginObservingDocument(); //lay it out... ps->InitialReflow(width, height); + // update the history from the old presentation shell + nsCOMPtr fm; + rv = ps->GetFrameManager(getter_AddRefs(fm)); + if(NS_SUCCEEDED(rv) && fm) { + nsIFrame* root; + ps->GetRootFrame(&root); + fm->RestoreFrameState(cx, root, layoutState); + } + ps->EndObservingDocument(); + // Ask the page sequence frame to print all the pages nsIPageSequenceFrame* pageSequence; nsPrintOptions options;