Bug 540433 - Remove nsIDocumentViewer; r=smaug

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

View File

@ -45,7 +45,7 @@
"@mozilla.org/layout/htmlCopyEncoder;1"
// {972D8D8F-F0DA-11d4-9885-00C04FA0CF4B}
#define NS_DOCUMENT_VIEWER_CID \
#define NS_CONTENT_VIEWER_CID \
{ 0x972d8d8f, 0xf0da, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {FC886801-E768-11d4-9885-00C04FA0CF4B}

View File

@ -200,9 +200,12 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
#include "nsDOMTouchEvent.h"
#include "nsIScriptElement.h"
#include "nsIContentViewer.h"
#include "prdtoa.h"
#include "mozilla/Preferences.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla::dom;

View File

@ -869,7 +869,7 @@ TransferShowingState(nsIDocument* aFromDoc, nsIDocument* aToDoc)
nsresult
nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
nsIDocumentViewer* aViewer,
nsIContentViewer* aViewer,
nsILoadGroup* aLoadGroup,
nsIDocument* aDisplayDocument)
{
@ -951,7 +951,7 @@ nsExternalResourceMap::PendingLoad::OnStartRequest(nsIRequest *aRequest,
return NS_BINDING_ABORTED;
}
nsCOMPtr<nsIDocumentViewer> viewer;
nsCOMPtr<nsIContentViewer> viewer;
nsCOMPtr<nsILoadGroup> loadGroup;
nsresult rv = SetupViewer(aRequest, getter_AddRefs(viewer),
getter_AddRefs(loadGroup));
@ -972,7 +972,7 @@ nsExternalResourceMap::PendingLoad::OnStartRequest(nsIRequest *aRequest,
nsresult
nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
nsIDocumentViewer** aViewer,
nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup)
{
NS_PRECONDITION(!mTargetListener, "Unexpected call to OnStartRequest");
@ -1030,9 +1030,7 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
getter_AddRefs(listener),
getter_AddRefs(viewer));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED);
NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
if (!parser) {
@ -1048,8 +1046,8 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
}
listener.swap(mTargetListener);
docViewer.swap(*aViewer);
newLoadGroup.swap(*aLoadGroup);
viewer.forget(aViewer);
newLoadGroup.forget(aLoadGroup);
return NS_OK;
}

View File

@ -88,7 +88,7 @@
#include "nsAttrAndChildArray.h"
#include "nsDOMAttributeMap.h"
#include "nsThreadUtils.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIDOMXPathNSResolver.h"
#include "nsIInterfaceRequestor.h"
#include "nsILoadContext.h"
@ -401,10 +401,10 @@ protected:
nsresult StartLoad(nsIURI* aURI, nsINode* aRequestingNode);
/**
* Set up an nsIDocumentViewer based on aRequest. This is guaranteed to
* Set up an nsIContentViewer based on aRequest. This is guaranteed to
* put null in *aViewer and *aLoadGroup on all failures.
*/
nsresult SetupViewer(nsIRequest* aRequest, nsIDocumentViewer** aViewer,
nsresult SetupViewer(nsIRequest* aRequest, nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup);
private:
@ -467,7 +467,7 @@ protected:
* function makes sure to remove the pending load for aURI, if any, from our
* hashtable, and to notify its observers, if any.
*/
nsresult AddExternalResource(nsIURI* aURI, nsIDocumentViewer* aViewer,
nsresult AddExternalResource(nsIURI* aURI, nsIContentViewer* aViewer,
nsILoadGroup* aLoadGroup,
nsIDocument* aDisplayDocument);

View File

@ -111,7 +111,7 @@
#include "nsICharsetResolver.h"
#include "nsICachingChannel.h"
#include "nsIJSContextStack.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIWyciwygChannel.h"
#include "nsIScriptElement.h"
#include "nsIScriptError.h"
@ -1771,9 +1771,8 @@ nsHTMLDocument::Open(const nsAString& aContentTypeOrUrl,
nsCOMPtr<nsIContentViewer> cv;
shell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(cv);
if (docViewer) {
docViewer->LoadStart(static_cast<nsIHTMLDocument *>(this));
if (cv) {
cv->LoadStart(static_cast<nsIHTMLDocument *>(this));
}
// Add a wyciwyg channel request into the document load group

View File

@ -86,7 +86,7 @@
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsIContentPolicy.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsContentPolicyUtils.h"
#include "nsContentErrors.h"
#include "nsIDOMProcessingInstruction.h"
@ -375,9 +375,8 @@ nsXMLContentSink::OnDocumentCreated(nsIDocument* aResultDocument)
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(contentViewer);
if (docViewer) {
return docViewer->SetDocumentInternal(aResultDocument, PR_TRUE);
if (contentViewer) {
return contentViewer->SetDocumentInternal(aResultDocument, PR_TRUE);
}
return NS_OK;
}

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()

View File

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ms2ger <ms2ger@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMDocument;
@ -9,13 +46,21 @@ interface nsIPrintSettings;
class nsIWidget;
class nsIDocument;
struct nsIntRect;
class nsIPresShell;
class nsPresContext;
class nsIView;
class nsDOMNavigationTiming;
%}
[ptr] native nsIWidgetPtr(nsIWidget);
[ptr] native nsIDocumentPtr(nsIDocument);
[ref] native nsIntRectRef(nsIntRect);
[ptr] native nsIPresShellPtr(nsIPresShell);
[ptr] native nsPresContextPtr(nsPresContext);
[ptr] native nsIViewPtr(nsIView);
[ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming);
[scriptable, uuid(75306a89-e3ad-4a2b-9daf-ac4de06661a4)]
[scriptable, builtinclass, uuid(26b2380b-4a1a-46cd-b7d8-7600e41c1688)]
interface nsIContentViewer : nsISupports
{
@ -142,4 +187,20 @@ interface nsIContentViewer : nsISupports
* See bug 613800.
*/
readonly attribute boolean isTabModalPromptAllowed;
[noscript] readonly attribute nsIPresShellPtr presShell;
[noscript] readonly attribute nsPresContextPtr presContext;
[noscript] void setDocumentInternal(in nsIDocumentPtr aDocument,
in boolean aForceReuseInnerWindow);
/**
* Find the view to use as the container view for MakeWindow. Returns
* null if this will be the root of a view manager hierarchy. In that
* case, if mParentWidget is null then this document should not even
* be displayed.
*/
[noscript,notxpcom,nostdcall] nsIViewPtr findContainerView();
/**
* Set collector for navigation timing data (load, unload events).
*/
[noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming);
};

View File

@ -78,7 +78,6 @@
#include "nsPIDOMWindow.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIDocumentViewer.h"
#include "nsIWindowProvider.h"
#include "nsIMutableArray.h"
#include "nsISupportsArray.h"

View File

@ -74,7 +74,6 @@ EXPORTS = \
nsFrameManager.h \
nsFrameManagerBase.h \
nsFrameTraversal.h \
nsIDocumentViewer.h \
nsIFrameTraversal.h \
nsILayoutDebugger.h \
nsILayoutHistoryState.h \

View File

@ -49,7 +49,7 @@
#include "nsISupports.h"
#include "nsIContent.h"
#include "nsIContentViewerContainer.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "mozilla/FunctionTimer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIPrivateDOMEvent.h"
@ -282,7 +282,7 @@ private:
//-------------------------------------------------------------
class DocumentViewerImpl : public nsIDocumentViewer,
class DocumentViewerImpl : public nsIContentViewer,
public nsIContentViewerEdit,
public nsIContentViewerFile,
public nsIMarkupDocumentViewer,
@ -308,24 +308,6 @@ public:
// nsIContentViewer interface...
NS_DECL_NSICONTENTVIEWER
// nsIDocumentViewer interface...
NS_IMETHOD GetPresShell(nsIPresShell** aResult);
NS_IMETHOD GetPresContext(nsPresContext** aResult);
NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
bool aForceReuseInnerWindow);
/**
* Find the view to use as the container view for MakeWindow. Returns
* null if this will be the root of a view manager hierarchy. In that
* case, if mParentWidget is null then this document should not even
* be displayed.
*/
virtual nsIView* FindContainerView();
/**
* Set collector for navigation timing data (load, unload events).
*/
virtual void SetNavigationTiming(nsDOMNavigationTiming* timing);
// nsIContentViewerEdit
NS_DECL_NSICONTENTVIEWEREDIT
@ -536,7 +518,7 @@ static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID);
//------------------------------------------------------------------
nsresult
NS_NewDocumentViewer(nsIDocumentViewer** aResult)
NS_NewContentViewer(nsIContentViewer** aResult)
{
*aResult = new DocumentViewerImpl();
@ -593,7 +575,6 @@ NS_IMPL_RELEASE(DocumentViewerImpl)
NS_INTERFACE_MAP_BEGIN(DocumentViewerImpl)
NS_INTERFACE_MAP_ENTRY(nsIContentViewer)
NS_INTERFACE_MAP_ENTRY(nsIDocumentViewer)
NS_INTERFACE_MAP_ENTRY(nsIMarkupDocumentViewer)
NS_INTERFACE_MAP_ENTRY(nsIContentViewerFile)
NS_INTERFACE_MAP_ENTRY(nsIContentViewerEdit)
@ -1015,7 +996,7 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
http://bugzilla.mozilla.org/show_bug.cgi?id=78445 for more
explanation.
*/
nsCOMPtr<nsIDocumentViewer> kungFuDeathGrip(this);
nsRefPtr<DocumentViewerImpl> kungFuDeathGrip(this);
// Flush out layout so it's up-to-date by the time onload is called.
// Note that this could destroy the window, so do this before
@ -1333,20 +1314,19 @@ AttachContainerRecurse(nsIDocShell* aShell)
{
nsCOMPtr<nsIContentViewer> viewer;
aShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
if (docViewer) {
nsIDocument* doc = docViewer->GetDocument();
if (viewer) {
nsIDocument* doc = viewer->GetDocument();
if (doc) {
doc->SetContainer(aShell);
}
nsRefPtr<nsPresContext> pc;
docViewer->GetPresContext(getter_AddRefs(pc));
viewer->GetPresContext(getter_AddRefs(pc));
if (pc) {
pc->SetContainer(aShell);
pc->SetLinkHandler(nsCOMPtr<nsILinkHandler>(do_QueryInterface(aShell)));
}
nsCOMPtr<nsIPresShell> presShell;
docViewer->GetPresShell(getter_AddRefs(presShell));
viewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
presShell->SetForwardingContainer(nsnull);
}
@ -1491,20 +1471,19 @@ DetachContainerRecurse(nsIDocShell *aShell)
// Unhook this docshell's presentation
nsCOMPtr<nsIContentViewer> viewer;
aShell->GetContentViewer(getter_AddRefs(viewer));
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
if (docViewer) {
nsIDocument* doc = docViewer->GetDocument();
if (viewer) {
nsIDocument* doc = viewer->GetDocument();
if (doc) {
doc->SetContainer(nsnull);
}
nsRefPtr<nsPresContext> pc;
docViewer->GetPresContext(getter_AddRefs(pc));
viewer->GetPresContext(getter_AddRefs(pc));
if (pc) {
pc->SetContainer(nsnull);
pc->SetLinkHandler(nsnull);
}
nsCOMPtr<nsIPresShell> presShell;
docViewer->GetPresShell(getter_AddRefs(presShell));
viewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
presShell->SetForwardingContainer(nsWeakPtr(do_GetWeakReference(aShell)));
}

View File

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* container for a document and its presentation */
#ifndef nsIDocumentViewer_h___
#define nsIDocumentViewer_h___
#include "nsIContentViewer.h"
class nsIDocument;
class nsPresContext;
class nsIPresShell;
class nsIStyleSheet;
class nsIView;
class nsDOMNavigationTiming;
#define NS_IDOCUMENT_VIEWER_IID \
{ 0x5a5c9a1d, 0x49c4, 0x4f3f, \
{ 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } }
/**
* A document viewer is a kind of content viewer that uses NGLayout
* to manage the presentation of the content.
*/
class nsIDocumentViewer : public nsIContentViewer
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_VIEWER_IID)
NS_IMETHOD GetPresShell(nsIPresShell** aResult) = 0;
NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
bool aForceReuseInnerWindow) = 0;
virtual nsIView* FindContainerView() = 0;
virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID)
#endif /* nsIDocumentViewer_h___ */

View File

@ -46,7 +46,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIDocumentViewer.h"
#include "nsPIDOMWindow.h"
#include "nsStyleSet.h"
#include "nsImageLoader.h"
@ -1735,10 +1734,9 @@ nsPresContext::EnsureVisible()
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
// Make sure this is the content viewer we belong with
nsCOMPtr<nsIDocumentViewer> docV(do_QueryInterface(cv));
if (docV) {
if (cv) {
nsRefPtr<nsPresContext> currentPresContext;
docV->GetPresContext(getter_AddRefs(currentPresContext));
cv->GetPresContext(getter_AddRefs(currentPresContext));
if (currentPresContext == this) {
// OK, this is us. We want to call Show() on the content viewer.
cv->Show();

View File

@ -41,10 +41,10 @@
#include "nsGkAtoms.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIContentViewer.h"
#include "nsICategoryManager.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDocument.h"
#include "nsIDocumentViewer.h"
#include "nsIURL.h"
#include "nsNodeInfo.h"
#include "nsNodeInfoManager.h"
@ -84,7 +84,7 @@ static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
nsresult
NS_NewDocumentViewer(nsIDocumentViewer** aResult);
NS_NewContentViewer(nsIContentViewer** aResult);
// XXXbz if you change the MIME types here, be sure to update
// nsIParser.h and DetermineParseMode in nsParser.cpp accordingly.
@ -325,24 +325,17 @@ NS_IMETHODIMP
nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
nsIDocument* aDocument,
const char *aCommand,
nsIContentViewer** aDocViewerResult)
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
nsresult rv = NS_ERROR_FAILURE;
do {
nsCOMPtr<nsIDocumentViewer> docv;
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
if (NS_FAILED(rv))
break;
// Bind the document to the Content Viewer
nsIContentViewer* cv = static_cast<nsIContentViewer*>(docv.get());
rv = cv->LoadStart(aDocument);
NS_ADDREF(*aDocViewerResult = cv);
} while (PR_FALSE);
nsCOMPtr<nsIContentViewer> contentViewer;
nsresult rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
NS_ENSURE_SUCCESS(rv, rv);
// Bind the document to the Content Viewer
rv = contentViewer->LoadStart(aDocument);
contentViewer.forget(aContentViewer);
return rv;
}
@ -431,7 +424,7 @@ nsContentDLF::CreateDocument(const char* aCommand,
nsISupports* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
@ -450,34 +443,26 @@ nsContentDLF::CreateDocument(const char* aCommand,
}
#endif
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIDocumentViewer> docv;
do {
// Create the document
doc = do_CreateInstance(aDocumentCID, &rv);
if (NS_FAILED(rv))
break;
// Create the document
nsCOMPtr<nsIDocument> doc = do_CreateInstance(aDocumentCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// Create the document viewer XXX: could reuse document viewer here!
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
if (NS_FAILED(rv))
break;
// Create the content viewer XXX: could reuse content viewer here!
nsCOMPtr<nsIContentViewer> contentViewer;
rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
NS_ENSURE_SUCCESS(rv, rv);
doc->SetContainer(aContainer);
doc->SetContainer(aContainer);
// Initialize the document to begin loading the data. An
// nsIStreamListener connected to the parser is returned in
// aDocListener.
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
if (NS_FAILED(rv))
break;
// Bind the document to the Content Viewer
rv = docv->LoadStart(doc);
*aDocViewer = docv;
NS_IF_ADDREF(*aDocViewer);
} while (PR_FALSE);
// Initialize the document to begin loading the data. An
// nsIStreamListener connected to the parser is returned in
// aDocListener.
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, true);
NS_ENSURE_SUCCESS(rv, rv);
// Bind the document to the Content Viewer
rv = contentViewer->LoadStart(doc);
contentViewer.forget(aContentViewer);
return rv;
}
@ -489,7 +474,7 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
nsIContentViewer** aContentViewer)
{
NS_TIME_FUNCTION;
@ -497,8 +482,8 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
nsCOMPtr<nsIDocument> doc = do_CreateInstance(kXULDocumentCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDocumentViewer> docv;
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
nsCOMPtr<nsIContentViewer> contentViewer;
rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIURI> aURL;
@ -515,15 +500,13 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
doc->SetContainer(aContainer);
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
/*
* Bind the document to the Content Viewer...
*/
rv = docv->LoadStart(doc);
*aDocViewer = docv;
NS_IF_ADDREF(*aDocViewer);
}
if (NS_FAILED(rv)) return rv;
/*
* Bind the document to the Content Viewer...
*/
rv = contentViewer->LoadStart(doc);
contentViewer.forget(aContentViewer);
return rv;
}

View File

@ -39,13 +39,11 @@
#define nsContentDLF_h__
#include "nsIDocumentLoaderFactory.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsMimeTypes.h"
class nsIChannel;
class nsIContentViewer;
class nsIDocumentViewer;
class nsIFile;
class nsIInputStream;
class nsILoadGroup;
@ -71,7 +69,7 @@ public:
nsISupports* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsIContentViewer** aContentViewer);
nsresult CreateXULDocument(const char* aCommand,
nsIChannel* aChannel,
@ -80,7 +78,7 @@ public:
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsIContentViewer** aContentViewer);
private:
static nsresult EnsureUAStyleSheet();

View File

@ -53,13 +53,13 @@
#include "nsIComponentManager.h"
#include "nsIContentIterator.h"
#include "nsIContentSerializer.h"
#include "nsIContentViewer.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMRange.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsIDocumentViewer.h"
#include "nsIFactory.h"
#include "nsIFrameUtil.h"
#include "nsHTMLStyleSheet.h"
@ -441,7 +441,7 @@ nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
nsresult NS_NewDomSelection(nsISelection** aResult);
nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
nsresult NS_NewContentViewer(nsIContentViewer** aResult);
nsresult NS_NewRange(nsIDOMRange** aResult);
nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
nsresult NS_NewContentIterator(nsIContentIterator** aResult);
@ -505,7 +505,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateContentViewer, nsIContentViewer, NS_NewContentViewer)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
@ -740,7 +740,7 @@ NS_DEFINE_NAMED_CID(IN_FLASHER_CID);
NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOCUMENT_VIEWER_CID);
NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
@ -874,7 +874,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kIN_CSSVALUESEARCH_CID, false, NULL, inCSSValueSearchConstructor },
{ &kIN_DOMUTILS_CID, false, NULL, inDOMUtilsConstructor },
{ &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
{ &kNS_DOCUMENT_VIEWER_CID, false, NULL, CreateDocumentViewer },
{ &kNS_CONTENT_VIEWER_CID, false, NULL, CreateContentViewer },
{ &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },
{ &kNS_XMLDOCUMENT_CID, false, NULL, CreateXMLDocument },
{ &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },

View File

@ -55,7 +55,6 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIBaseWindow.h"
#include "nsIContentViewer.h"
#include "nsIDocumentViewer.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
@ -964,15 +963,12 @@ EndSwapDocShellsForDocument(nsIDocument* aDocument, void*)
nsCOMPtr<nsIContentViewer> cv;
ds->GetContentViewer(getter_AddRefs(cv));
while (cv) {
nsCOMPtr<nsIDocumentViewer> dv = do_QueryInterface(cv);
if (dv) {
nsCOMPtr<nsPresContext> pc;
dv->GetPresContext(getter_AddRefs(pc));
nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull;
if (dc) {
nsIView* v = dv->FindContainerView();
dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull);
}
nsCOMPtr<nsPresContext> pc;
cv->GetPresContext(getter_AddRefs(pc));
nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull;
if (dc) {
nsIView* v = cv->FindContainerView();
dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull);
}
nsCOMPtr<nsIContentViewer> prev;
cv->GetPreviousViewer(getter_AddRefs(prev));

View File

@ -154,7 +154,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIDOMHTMLImageElement.h"
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"
#include "nsIDocumentViewer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsPIDOMWindow.h"
@ -1914,9 +1913,9 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
documentIsTopLevel = PR_TRUE;
if (mIsCreatingPrintPreview) {
nsCOMPtr<nsIDocumentViewer> dv = do_QueryInterface(mDocViewerPrint);
if (dv) {
parentView = dv->FindContainerView();
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(mDocViewerPrint);
if (cv) {
parentView = cv->FindContainerView();
}
}
}

View File

@ -43,7 +43,7 @@
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsPIDOMWindow.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIServiceManager.h"
#include "nsIAtom.h"
@ -80,29 +80,14 @@ doc_viewer(nsIDocShell *aDocShell)
static already_AddRefed<nsIPresShell>
pres_shell(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIDocumentViewer> dv =
do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
if (!dv)
nsCOMPtr<nsIContentViewer> cv = doc_viewer(aDocShell);
if (!cv)
return nsnull;
nsIPresShell *result = nsnull;
dv->GetPresShell(&result);
return result;
nsCOMPtr<nsIPresShell> result;
cv->GetPresShell(getter_AddRefs(result));
return result.forget();
}
#if 0 // not currently needed
static already_AddRefed<nsPresContext>
pres_context(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIDocumentViewer> dv =
do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
if (!dv)
return nsnull;
nsPresContext *result = nsnull;
dv->GetPresContext(result);
return result;
}
#endif
static nsIViewManager*
view_manager(nsIDocShell *aDocShell)
{

View File

@ -37,13 +37,14 @@
* ***** END LICENSE BLOCK ***** */
#include "SVGDocumentWrapper.h"
#include "mozilla/dom/Element.h"
#include "nsIAtom.h"
#include "nsICategoryManager.h"
#include "nsIChannel.h"
#include "nsIContentViewer.h"
#include "nsIDocument.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDocumentViewer.h"
#include "nsIDOMSVGAnimatedLength.h"
#include "nsIDOMSVGLength.h"
#include "nsIHttpChannel.h"
@ -351,7 +352,7 @@ SVGDocumentWrapper::Observe(nsISupports* aSubject,
// nsExternalResourceMap::PendingLoad::SetupViewer.
nsresult
SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
nsIDocumentViewer** aViewer,
nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup)
{
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
@ -396,8 +397,7 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
getter_AddRefs(viewer));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED);
NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
NS_ENSURE_TRUE(parser, NS_ERROR_UNEXPECTED);
@ -408,8 +408,8 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
NS_ENSURE_TRUE(sink, NS_ERROR_UNEXPECTED);
listener.swap(mListener);
docViewer.swap(*aViewer);
newLoadGroup.swap(*aLoadGroup);
viewer.forget(aViewer);
newLoadGroup.forget(aLoadGroup);
RegisterForXPCOMShutdown();
return NS_OK;

View File

@ -44,13 +44,12 @@
#include "nsCOMPtr.h"
#include "nsIStreamListener.h"
#include "nsIObserver.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsWeakReference.h"
class nsIAtom;
class nsIPresShell;
class nsIRequest;
class nsIDocumentViewer;
class nsILoadGroup;
class nsIFrame;
struct nsIntSize;
@ -171,7 +170,7 @@ public:
private:
nsresult SetupViewer(nsIRequest *aRequest,
nsIDocumentViewer** aViewer,
nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup);
void DestroyViewer();
void RegisterForXPCOMShutdown();
@ -179,7 +178,7 @@ private:
void FlushLayout();
nsCOMPtr<nsIDocumentViewer> mViewer;
nsCOMPtr<nsIContentViewer> mViewer;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIStreamListener> mListener;
bool mIgnoreInvalidation;

View File

@ -37,13 +37,13 @@
* ***** END LICENSE BLOCK ***** */
#include "VectorImage.h"
#include "imgIDecoderObserver.h"
#include "SVGDocumentWrapper.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "nsPresContext.h"
#include "nsRect.h"
#include "nsIDocumentViewer.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsIStreamListener.h"
@ -55,9 +55,10 @@
#include "gfxUtils.h"
#include "nsSVGSVGElement.h"
using namespace mozilla::dom;
namespace mozilla {
using namespace dom;
namespace imagelib {
// Helper-class: SVGRootRenderingObserver

View File

@ -58,7 +58,6 @@
#include "nsIObserverService.h"
#include "nsCURILoader.h"
#include "nsIDocShell.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIPrincipal.h"
#include "nsIDOMElement.h"

View File

@ -44,8 +44,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIBaseWindow.h"
#include "nsIContentViewer.h"
#include "nsIDocumentViewer.h"
#include "nsIWidget.h"
#include "nsIStringBundle.h"

View File

@ -35,9 +35,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAppShellWindowEnumerator.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
@ -47,7 +48,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIXULWindow.h"
#include "nsAppShellWindowEnumerator.h"
#include "nsWindowMediator.h"
//
@ -83,7 +83,7 @@ nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell)
nsCOMPtr<nsIDOMElement> element;
domdoc->GetDocumentElement(getter_AddRefs(element));
if (element)
node = do_QueryInterface(element);
node = element;
}
}

View File

@ -42,7 +42,7 @@
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsIWeakReference.h"
#include "nsIContentViewer.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIURL.h"
@ -83,7 +83,6 @@
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNode.h"
@ -750,11 +749,9 @@ bool nsWebShellWindow::ExecuteCloseHandler()
if (eventTarget) {
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
if (docViewer) {
if (contentViewer) {
nsRefPtr<nsPresContext> presContext;
docViewer->GetPresContext(getter_AddRefs(presContext));
contentViewer->GetPresContext(getter_AddRefs(presContext));
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(PR_TRUE, NS_XUL_CLOSE, nsnull,

View File

@ -44,10 +44,6 @@
#include "nsIBaseWindow.h"
#include "nsIWidget.h"
#include "nsIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIObserverService.h"
#include "nsIServiceManager.h"
#include "nsISimpleEnumerator.h"

View File

@ -54,7 +54,7 @@
#include "nsIAppShell.h"
#include "nsIAppShellService.h"
#include "nsIServiceManager.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMBarProp.h"
#include "nsIDOMDocument.h"