From 87187c390cfbd9807c26e7cc63aff5437b168970 Mon Sep 17 00:00:00 2001 From: "disttsc%bart.nl" Date: Thu, 9 Nov 2000 20:30:35 +0000 Subject: [PATCH] Moving nsIContentViewer over from webshell to docshell, converting from .h to .idl. Needed for bug 46200, r=moa=adam@netscape.com, a=alecf --- content/xul/document/src/nsXULDocument.cpp | 1 + docshell/base/MANIFEST_IDL | 1 + docshell/base/Makefile.in | 1 + docshell/base/makefile.win | 1 + docshell/base/nsDocShell.cpp | 6 +- docshell/base/nsIContentViewer.idl | 42 +++++++++ docshell/base/nsIDocShell.idl | 5 +- modules/plugin/base/src/nsPluginViewer.cpp | 5 +- modules/plugin/nglsrc/nsPluginViewer.cpp | 5 +- rdf/content/src/nsXULDocument.cpp | 1 + webshell/public/MANIFEST | 1 - webshell/public/Makefile.in | 1 - webshell/public/makefile.win | 1 - webshell/public/nsIContentViewer.h | 86 ------------------- xpfe/global/resources/content/xulBindings.xml | 16 +++- 15 files changed, 69 insertions(+), 104 deletions(-) create mode 100644 docshell/base/nsIContentViewer.idl delete mode 100644 webshell/public/nsIContentViewer.h diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index dcb24d9dbdc08..3ce42724a7d45 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -54,6 +54,7 @@ #include "nsIComponentManager.h" #include "nsICodebasePrincipal.h" #include "nsIContentSink.h" // for NS_CONTENT_ID_COUNTER_BASE +#include "nsIScrollableView.h" #include "nsIContentViewer.h" #include "nsICSSStyleSheet.h" #include "nsIDOMEvent.h" diff --git a/docshell/base/MANIFEST_IDL b/docshell/base/MANIFEST_IDL index 9453529499241..ae91ead772dcf 100644 --- a/docshell/base/MANIFEST_IDL +++ b/docshell/base/MANIFEST_IDL @@ -30,5 +30,6 @@ nsIDocShellTreeOwner.idl nsIMarkupDocumentViewer.idl nsIScrollable.idl nsITextScroll.idl +nsIContentViewer.idl nsIContentViewerEdit.idl nsIURIFixup.idl diff --git a/docshell/base/Makefile.in b/docshell/base/Makefile.in index 2ffb4360506b2..f50225db5e023 100644 --- a/docshell/base/Makefile.in +++ b/docshell/base/Makefile.in @@ -41,6 +41,7 @@ XPIDLSRCS = \ nsIScrollable.idl \ nsITextScroll.idl \ nsIWebNavigation.idl \ + nsIContentViewer.idl \ nsIContentViewerEdit.idl \ nsIURIFixup.idl \ $(NULL) diff --git a/docshell/base/makefile.win b/docshell/base/makefile.win index ecfb00403c517..e497405c8aa11 100644 --- a/docshell/base/makefile.win +++ b/docshell/base/makefile.win @@ -33,6 +33,7 @@ XPIDLSRCS= \ .\nsIDocShellTreeItem.idl \ .\nsIDocShellTreeNode.idl \ .\nsIDocShellTreeOwner.idl \ + .\nsIContentViewer.idl \ .\nsIContentViewerEdit.idl \ # .\nsIContentViewerFile.idl \ .\nsIMarkupDocumentViewer.idl \ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index d6bec5ef85524..8702cdaf46a1a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -46,6 +46,7 @@ #include "nsIHTTPEventSink.h" #include "nsISecurityEventSink.h" #include "nsScriptSecurityManager.h" +#include "nsDocumentCharsetInfoCID.h" // Local Includes #include "nsDocShell.h" @@ -124,10 +125,10 @@ nsDocShell::nsDocShell() : mLastViewMode(viewNormal), mRestoreViewMode(PR_FALSE), mEODForCurrentDocument (PR_FALSE), + mURIResultedInDocument(PR_FALSE), mUseExternalProtocolHandler (PR_FALSE), mParent(nsnull), mTreeOwner(nsnull), - mURIResultedInDocument(PR_FALSE), mChromeEventHandler(nsnull) { NS_INIT_REFCNT(); @@ -1110,7 +1111,8 @@ NS_IMETHODIMP nsDocShell::AddChild(nsIDocShellTreeItem *aChild) if (NS_FAILED(res)) return NS_OK; // set the child's parentCharset - res = dcInfo->SetParentCharset(&parentCS); + nsCOMPtr parentCSAtom(dont_AddRef(NS_NewAtom(parentCS))); + res = dcInfo->SetParentCharset(parentCSAtom); if (NS_FAILED(res)) return NS_OK; // printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType); diff --git a/docshell/base/nsIContentViewer.idl b/docshell/base/nsIContentViewer.idl new file mode 100644 index 0000000000000..30f35020402f4 --- /dev/null +++ b/docshell/base/nsIContentViewer.idl @@ -0,0 +1,42 @@ +#include "nsISupports.idl" +#include "domstubs.idl" + +%{ C++ +#include "nsIWidget.h" + +class nsIDeviceContext; +struct nsRect; +%} + +[ptr] native nsIWidgetPtr(nsIWidget); +[ptr] native nsIDeviceContextPtr(nsIDeviceContext); +[ref] native nsRectRef(nsRect); + +[scriptable, uuid(a6cf9056-15b3-11d2-932e-00805f8add32)] +interface nsIContentViewer : nsISupports +{ + + [noscript] void init(in nsIWidgetPtr aParentWidget, + in nsIDeviceContextPtr aDeviceContext, + [const] in nsRectRef aBounds); + + void bindToDocument(in nsISupports aDoc, in string aCommand); + + attribute nsISupports container; + + void loadComplete(in unsigned long aStatus); + void destroy(); + void stop(); + + attribute nsIDOMDocument DOMDocument; + + [noscript] void getBounds(in nsRectRef aBounds); + [noscript] void setBounds([const] in nsRectRef aBounds); + + void move(in long aX, in long aY); + + void show(); + void hide(); + + attribute boolean enableRendering; +}; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 4eebec3fca20c..92888b0aa5d3f 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -25,10 +25,10 @@ #include "domstubs.idl" #include "nsIURIContentListener.idl" #include "nsIURI.idl" +#include "nsIContentViewer.idl" %{ C++ #include "nsIPresContext.h" -#include "nsIContentViewer.h" #include "nsIDocumentLoaderObserver.h" %} @@ -38,7 +38,6 @@ [ptr] native nsIPresContext(nsIPresContext); [ptr] native nsIPresShell(nsIPresShell); -[ptr] native nsIContentViewer(nsIContentViewer); interface nsIChromeEventHandler; interface nsIDocumentLoaderObserver; @@ -118,7 +117,7 @@ interface nsIDocShell : nsISupports Content Viewer that is currently loaded for this DocShell. This may change as the underlying content changes. */ - [noscript] readonly attribute nsIContentViewer contentViewer; + readonly attribute nsIContentViewer contentViewer; /* This attribute allows chrome to tie in to handle DOM events that may be of diff --git a/modules/plugin/base/src/nsPluginViewer.cpp b/modules/plugin/base/src/nsPluginViewer.cpp index a3f070dffc61b..7f06315c0617c 100644 --- a/modules/plugin/base/src/nsPluginViewer.cpp +++ b/modules/plugin/base/src/nsPluginViewer.cpp @@ -49,14 +49,11 @@ static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID); static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); // Interface IDs -static NS_DEFINE_IID(kIContentViewerIID, NS_ICONTENT_VIEWER_IID); +static NS_DEFINE_IID(kIContentViewerIID, NS_ICONTENTVIEWER_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID); static NS_DEFINE_IID(kIPluginInstanceOwnerIID, NS_IPLUGININSTANCEOWNER_IID); static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); -static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID); static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); diff --git a/modules/plugin/nglsrc/nsPluginViewer.cpp b/modules/plugin/nglsrc/nsPluginViewer.cpp index a3f070dffc61b..7f06315c0617c 100644 --- a/modules/plugin/nglsrc/nsPluginViewer.cpp +++ b/modules/plugin/nglsrc/nsPluginViewer.cpp @@ -49,14 +49,11 @@ static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID); static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); // Interface IDs -static NS_DEFINE_IID(kIContentViewerIID, NS_ICONTENT_VIEWER_IID); +static NS_DEFINE_IID(kIContentViewerIID, NS_ICONTENTVIEWER_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID); static NS_DEFINE_IID(kIPluginInstanceOwnerIID, NS_IPLUGININSTANCEOWNER_IID); static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); -static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID); static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp index dcb24d9dbdc08..3ce42724a7d45 100644 --- a/rdf/content/src/nsXULDocument.cpp +++ b/rdf/content/src/nsXULDocument.cpp @@ -54,6 +54,7 @@ #include "nsIComponentManager.h" #include "nsICodebasePrincipal.h" #include "nsIContentSink.h" // for NS_CONTENT_ID_COUNTER_BASE +#include "nsIScrollableView.h" #include "nsIContentViewer.h" #include "nsICSSStyleSheet.h" #include "nsIDOMEvent.h" diff --git a/webshell/public/MANIFEST b/webshell/public/MANIFEST index b617b302090ad..78f7557a8bfee 100644 --- a/webshell/public/MANIFEST +++ b/webshell/public/MANIFEST @@ -2,7 +2,6 @@ # This is a list of local files which get copied to the mozilla:dist:webshell directory # -nsIContentViewer.h nsIDocStreamLoaderFactory.h nsILinkHandler.h nsIWebShell.h diff --git a/webshell/public/Makefile.in b/webshell/public/Makefile.in index fc6da922ae4d7..e14f6009a0a07 100644 --- a/webshell/public/Makefile.in +++ b/webshell/public/Makefile.in @@ -37,7 +37,6 @@ XPIDLSRCS = \ $(NULL) EXPORTS = \ - nsIContentViewer.h \ nsIDocStreamLoaderFactory.h \ nsILinkHandler.h \ nsIWebShell.h \ diff --git a/webshell/public/makefile.win b/webshell/public/makefile.win index ed09ce20f8bc2..149689094f9a0 100644 --- a/webshell/public/makefile.win +++ b/webshell/public/makefile.win @@ -34,7 +34,6 @@ XPIDLSRCS = \ $(NULL) EXPORTS = \ - nsIContentViewer.h \ nsIDocStreamLoaderFactory.h \ nsILinkHandler.h \ nsIWebShell.h \ diff --git a/webshell/public/nsIContentViewer.h b/webshell/public/nsIContentViewer.h deleted file mode 100644 index ecbef361b37c4..0000000000000 --- a/webshell/public/nsIContentViewer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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 Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsIContentViewer_h___ -#define nsIContentViewer_h___ - -#include "nsIWidget.h" -#include "nsIScrollableView.h" - -// Forward declarations... -class nsIDeviceContext; -class nsString; -struct nsRect; -class nsIContentViewerContainer; -class nsIDOMDocument; - -// IID for the nsIContentViewer interface -#define NS_ICONTENT_VIEWER_IID \ - { 0xa6cf9056, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} - -/** - * Content viewer interface. When a stream of data is to be presented - * visually to the user, a content viewer is found for the underlying - * mime-type associated with the data in the stream. This interface - * defines the capabilities of the viewer. - */ -class nsIContentViewer : public nsISupports -{ -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENT_VIEWER_IID) - - /** - * Initialize the content viewer. Make it a child of the - * the given native parent widget. - */ - NS_IMETHOD Init(nsIWidget* aParentWidget, - nsIDeviceContext* aDeviceContext, - const nsRect& aBounds)=0; - - NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand) = 0; - - NS_IMETHOD SetContainer(nsISupports* aContainer) = 0; - - NS_IMETHOD GetContainer(nsISupports** aContainerResult) = 0; - - NS_IMETHOD LoadComplete(nsresult aStatus) = 0; - NS_IMETHOD Destroy(void) = 0; - NS_IMETHOD Stop(void) = 0; - - NS_IMETHOD GetDOMDocument(nsIDOMDocument **aResult) = 0; - NS_IMETHOD SetDOMDocument(nsIDOMDocument *aDocument) = 0; - - NS_IMETHOD GetBounds(nsRect& aBounds) = 0; - - NS_IMETHOD SetBounds(const nsRect& aBounds) = 0; - - NS_IMETHOD Move(PRInt32 aX, PRInt32 aY) = 0; - - NS_IMETHOD Show(void) = 0; - - NS_IMETHOD Hide(void) = 0; - - NS_IMETHOD SetEnableRendering(PRBool aOn) = 0; - - NS_IMETHOD GetEnableRendering(PRBool* aResult) = 0; -}; - -#endif /* nsIContentViewer_h___ */ diff --git a/xpfe/global/resources/content/xulBindings.xml b/xpfe/global/resources/content/xulBindings.xml index 447d4933da280..4444059ca57f1 100644 --- a/xpfe/global/resources/content/xulBindings.xml +++ b/xpfe/global/resources/content/xulBindings.xml @@ -679,9 +679,21 @@ - + + + + + onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"/>