Bug 540433 - Remove nsIDocumentViewer; r=smaug

This commit is contained in:
Ms2ger
2011-10-15 09:33:26 +02:00
parent 60e22b6a33
commit b91bd49779
28 changed files with 189 additions and 303 deletions

View File

@@ -55,7 +55,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMStorage.h"
#include "nsPIDOMStorage.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsCURILoader.h"
#include "nsURILoader.h"
@@ -1675,8 +1675,6 @@ nsDocShell::ValidateOrigin(nsIDocShellTreeItem* aOriginTreeItem,
NS_IMETHODIMP
nsDocShell::GetEldestPresContext(nsPresContext** aPresContext)
{
nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aPresContext);
*aPresContext = nsnull;
@@ -1684,17 +1682,13 @@ nsDocShell::GetEldestPresContext(nsPresContext** aPresContext)
while (viewer) {
nsCOMPtr<nsIContentViewer> prevViewer;
viewer->GetPreviousViewer(getter_AddRefs(prevViewer));
if (prevViewer)
viewer = prevViewer;
else {
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(viewer));
if (docv)
rv = docv->GetPresContext(aPresContext);
break;
if (!prevViewer) {
return viewer->GetPresContext(aPresContext);
}
viewer = prevViewer;
}
return rv;
return NS_OK;
}
NS_IMETHODIMP
@@ -1706,10 +1700,7 @@ nsDocShell::GetPresContext(nsPresContext ** aPresContext)
if (!mContentViewer)
return NS_OK;
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
NS_ENSURE_TRUE(docv, NS_ERROR_NO_INTERFACE);
return docv->GetPresContext(aPresContext);
return mContentViewer->GetPresContext(aPresContext);
}
NS_IMETHODIMP
@@ -7676,16 +7667,11 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
// Try to extract the canvas background color from the old
// presentation shell, so we can use it for the next document.
nsCOMPtr<nsIDocumentViewer> docviewer =
do_QueryInterface(mContentViewer);
nsCOMPtr<nsIPresShell> shell;
mContentViewer->GetPresShell(getter_AddRefs(shell));
if (docviewer) {
nsCOMPtr<nsIPresShell> shell;
docviewer->GetPresShell(getter_AddRefs(shell));
if (shell) {
bgcolor = shell->GetCanvasBackground();
}
if (shell) {
bgcolor = shell->GetCanvasBackground();
}
mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull);
@@ -7710,11 +7696,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
nsIntRect bounds(x, y, cx, cy);
nsCOMPtr<nsIDocumentViewer> docviewer =
do_QueryInterface(mContentViewer);
if (docviewer) {
docviewer->SetNavigationTiming(mTiming);
}
mContentViewer->SetNavigationTiming(mTiming);
if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
mContentViewer = nsnull;
@@ -7748,13 +7730,11 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
// Stuff the bgcolor from the old pres shell into the new
// pres shell. This improves page load continuity.
if (docviewer) {
nsCOMPtr<nsIPresShell> shell;
docviewer->GetPresShell(getter_AddRefs(shell));
nsCOMPtr<nsIPresShell> shell;
mContentViewer->GetPresShell(getter_AddRefs(shell));
if (shell) {
shell->SetCanvasBackground(bgcolor);
}
if (shell) {
shell->SetCanvasBackground(bgcolor);
}
// XXX: It looks like the LayoutState gets restored again in Embed()