From b34ed638cd3d60a60c73ff9614c15fe7e5dee9aa 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 git-svn-id: svn://10.0.0.236/trunk@82496 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xul/document/src/nsXULDocument.cpp | 1 + mozilla/docshell/base/MANIFEST_IDL | 1 + mozilla/docshell/base/Makefile.in | 1 + mozilla/docshell/base/makefile.win | 1 + mozilla/docshell/base/nsDocShell.cpp | 6 +- mozilla/docshell/base/nsIContentViewer.idl | 42 +++++++++ mozilla/docshell/base/nsIDocShell.idl | 5 +- .../plugin/base/src/nsPluginViewer.cpp | 5 +- .../modules/plugin/nglsrc/nsPluginViewer.cpp | 5 +- mozilla/rdf/content/src/nsXULDocument.cpp | 1 + mozilla/webshell/public/MANIFEST | 1 - mozilla/webshell/public/Makefile.in | 1 - mozilla/webshell/public/makefile.win | 1 - mozilla/webshell/public/nsIContentViewer.h | 86 ------------------- .../global/resources/content/xulBindings.xml | 16 +++- 15 files changed, 69 insertions(+), 104 deletions(-) create mode 100644 mozilla/docshell/base/nsIContentViewer.idl delete mode 100644 mozilla/webshell/public/nsIContentViewer.h diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index dcb24d9dbdc..3ce42724a7d 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/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/mozilla/docshell/base/MANIFEST_IDL b/mozilla/docshell/base/MANIFEST_IDL index 94535294992..ae91ead772d 100644 --- a/mozilla/docshell/base/MANIFEST_IDL +++ b/mozilla/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/mozilla/docshell/base/Makefile.in b/mozilla/docshell/base/Makefile.in index 2ffb4360506..f50225db5e0 100644 --- a/mozilla/docshell/base/Makefile.in +++ b/mozilla/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/mozilla/docshell/base/makefile.win b/mozilla/docshell/base/makefile.win index ecfb00403c5..e497405c8aa 100644 --- a/mozilla/docshell/base/makefile.win +++ b/mozilla/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/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index d6bec5ef855..8702cdaf46a 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/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/mozilla/docshell/base/nsIContentViewer.idl b/mozilla/docshell/base/nsIContentViewer.idl new file mode 100644 index 00000000000..30f35020402 --- /dev/null +++ b/mozilla/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/mozilla/docshell/base/nsIDocShell.idl b/mozilla/docshell/base/nsIDocShell.idl index 4eebec3fca2..92888b0aa5d 100644 --- a/mozilla/docshell/base/nsIDocShell.idl +++ b/mozilla/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/mozilla/modules/plugin/base/src/nsPluginViewer.cpp b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp index a3f070dffc6..7f06315c061 100644 --- a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp +++ b/mozilla/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/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp b/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp index a3f070dffc6..7f06315c061 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp +++ b/mozilla/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/mozilla/rdf/content/src/nsXULDocument.cpp b/mozilla/rdf/content/src/nsXULDocument.cpp index dcb24d9dbdc..3ce42724a7d 100644 --- a/mozilla/rdf/content/src/nsXULDocument.cpp +++ b/mozilla/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/mozilla/webshell/public/MANIFEST b/mozilla/webshell/public/MANIFEST index b617b302090..78f7557a8bf 100644 --- a/mozilla/webshell/public/MANIFEST +++ b/mozilla/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/mozilla/webshell/public/Makefile.in b/mozilla/webshell/public/Makefile.in index fc6da922ae4..e14f6009a0a 100644 --- a/mozilla/webshell/public/Makefile.in +++ b/mozilla/webshell/public/Makefile.in @@ -37,7 +37,6 @@ XPIDLSRCS = \ $(NULL) EXPORTS = \ - nsIContentViewer.h \ nsIDocStreamLoaderFactory.h \ nsILinkHandler.h \ nsIWebShell.h \ diff --git a/mozilla/webshell/public/makefile.win b/mozilla/webshell/public/makefile.win index ed09ce20f8b..149689094f9 100644 --- a/mozilla/webshell/public/makefile.win +++ b/mozilla/webshell/public/makefile.win @@ -34,7 +34,6 @@ XPIDLSRCS = \ $(NULL) EXPORTS = \ - nsIContentViewer.h \ nsIDocStreamLoaderFactory.h \ nsILinkHandler.h \ nsIWebShell.h \ diff --git a/mozilla/webshell/public/nsIContentViewer.h b/mozilla/webshell/public/nsIContentViewer.h deleted file mode 100644 index ecbef361b37..00000000000 --- a/mozilla/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/mozilla/xpfe/global/resources/content/xulBindings.xml b/mozilla/xpfe/global/resources/content/xulBindings.xml index 447d4933da2..4444059ca57 100644 --- a/mozilla/xpfe/global/resources/content/xulBindings.xml +++ b/mozilla/xpfe/global/resources/content/xulBindings.xml @@ -679,9 +679,21 @@ - + onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"/> + + + +