From 515e16e79df64528563bed19f2812a9468235e51 Mon Sep 17 00:00:00 2001 From: "jgaunt%netscape.com" Date: Tue, 2 Jul 2002 17:39:40 +0000 Subject: [PATCH] bug 78390 accessible support for full page PDFs r=aaronl,peterl sr=jst git-svn-id: svn://10.0.0.236/trunk@124512 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/accessible/build/makefile.win | 1 - .../accessible/macbuild/accessible_xul.xml | 40 ++++++++ mozilla/accessible/src/html/Makefile.in | 42 +++++---- mozilla/accessible/src/html/makefile.win | 2 + .../src/html/nsHTMLPluginAccessible.h | 6 ++ mozilla/accessible/src/xul/Makefile.in | 38 +++++--- mozilla/accessible/src/xul/makefile.win | 7 ++ .../accessible/src/xul/nsXULTabAccessible.cpp | 94 ++++++++++++++++++- .../accessible/src/xul/nsXULTabAccessible.h | 8 ++ mozilla/modules/plugin/base/src/Makefile.in | 1 + mozilla/modules/plugin/base/src/makefile.win | 8 +- .../plugin/base/src/nsPluginViewer.cpp | 74 ++++----------- .../modules/plugin/base/src/nsPluginViewer.h | 64 +++++++++++++ .../xpfe/appshell/public/nsIWebShellWindow.h | 1 + 14 files changed, 291 insertions(+), 95 deletions(-) diff --git a/mozilla/accessible/build/makefile.win b/mozilla/accessible/build/makefile.win index 53957aab330..449d00c7cb0 100644 --- a/mozilla/accessible/build/makefile.win +++ b/mozilla/accessible/build/makefile.win @@ -49,7 +49,6 @@ LLIBS=\ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\gkgfx.lib \ $(DIST)\lib\contentshared_s.lib \ - $(DIST)\lib\raptorwidget_s.lib \ $(LIBNSPR) \ $(NULL) diff --git a/mozilla/accessible/macbuild/accessible_xul.xml b/mozilla/accessible/macbuild/accessible_xul.xml index a1309de30ad..443381408d5 100644 --- a/mozilla/accessible/macbuild/accessible_xul.xml +++ b/mozilla/accessible/macbuild/accessible_xul.xml @@ -95,6 +95,26 @@ FrameworkPathfalse HostFlagsAll + + SearchPath + Path:::layout:html:base:src: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::modules:plugin:base:src: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + SearchPath Path::build: @@ -1110,6 +1130,26 @@ FrameworkPathfalse HostFlagsAll + + SearchPath + Path:::layout:html:base:src: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::modules:plugin:base:src: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + SearchPath Path::build: diff --git a/mozilla/accessible/src/html/Makefile.in b/mozilla/accessible/src/html/Makefile.in index f7fd0187aa2..0089192918b 100644 --- a/mozilla/accessible/src/html/Makefile.in +++ b/mozilla/accessible/src/html/Makefile.in @@ -28,26 +28,28 @@ include $(DEPTH)/config/autoconf.mk MODULE = accessibility LIBRARY_NAME = accessibility_html_s -REQUIRES = content \ - docshell \ - dom \ - editor \ - gfx \ - gfx2 \ - htmlparser \ - imglib2 \ - intl \ - layout \ - locale \ - necko \ - plugin \ - string \ - uriloader \ - view \ - webshell \ - widget \ - xpcom \ - $(NULL) +REQUIRES = \ + appshell \ + content \ + docshell \ + dom \ + editor \ + gfx \ + gfx2 \ + htmlparser \ + imglib2 \ + intl \ + layout \ + locale \ + necko \ + plugin \ + string \ + uriloader \ + view \ + webshell \ + widget \ + xpcom \ + $(NULL) CPPSRCS = \ nsHTMLAreaAccessible.cpp \ diff --git a/mozilla/accessible/src/html/makefile.win b/mozilla/accessible/src/html/makefile.win index acb56bd7a53..a2bd7c6eb57 100755 --- a/mozilla/accessible/src/html/makefile.win +++ b/mozilla/accessible/src/html/makefile.win @@ -23,6 +23,7 @@ DEPTH = ..\..\.. MODULE = accessibility LIBRARY_NAME = accessibility_html_s REQUIRES = \ + appshell \ content \ docshell \ dom \ @@ -39,6 +40,7 @@ REQUIRES = \ string \ uriloader \ view \ + webBrowser_core \ webshell \ widget \ xpcom \ diff --git a/mozilla/accessible/src/html/nsHTMLPluginAccessible.h b/mozilla/accessible/src/html/nsHTMLPluginAccessible.h index aa9cbcea2c6..eee919e847a 100644 --- a/mozilla/accessible/src/html/nsHTMLPluginAccessible.h +++ b/mozilla/accessible/src/html/nsHTMLPluginAccessible.h @@ -39,6 +39,12 @@ #include "nsAccessible.h" +/** + * This class is used to wrap the window for the plugin. It's only child + * is a shim class that will allow the platform specific layer of our + * accessibility support to get the IAccessible from the plugin itself + * (via the windows call to get he accessible by window). + */ class nsHTMLPluginAccessible : public nsAccessible { public: diff --git a/mozilla/accessible/src/xul/Makefile.in b/mozilla/accessible/src/xul/Makefile.in index ab857402ea4..43b95b2af44 100644 --- a/mozilla/accessible/src/xul/Makefile.in +++ b/mozilla/accessible/src/xul/Makefile.in @@ -28,21 +28,26 @@ include $(DEPTH)/config/autoconf.mk MODULE = accessibility LIBRARY_NAME = accessibility_xul_s -REQUIRES = content \ - docshell \ - dom \ - gfx \ - htmlparser \ - intl \ - layout \ - locale \ - necko \ - pref \ - string \ - view \ - widget \ - xpcom \ - $(NULL) +REQUIRES = \ + appshell \ + content \ + docshell \ + dom \ + gfx \ + htmlparser \ + intl \ + layout \ + locale \ + necko \ + plugin \ + pref \ + string \ + view \ + webbrwsr \ + webshell \ + widget \ + xpcom \ + $(NULL) CPPSRCS = \ nsXULColorPickerAccessible.cpp \ @@ -62,4 +67,7 @@ include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ -I$(srcdir)/../base \ -I$(srcdir)/../html \ + -I$(srcdir)/../../../layout/html/base/src \ + -I$(srcdir)/../../../layout/html/forms/src \ + -I$(srcdir)/../../../layout/html/forms/public \ $(NULL) diff --git a/mozilla/accessible/src/xul/makefile.win b/mozilla/accessible/src/xul/makefile.win index 28745a21453..62d27b25481 100755 --- a/mozilla/accessible/src/xul/makefile.win +++ b/mozilla/accessible/src/xul/makefile.win @@ -23,6 +23,7 @@ DEPTH = ..\..\.. MODULE = accessibility LIBRARY_NAME = accessibility_xul_s REQUIRES = \ + appshell \ content \ docshell \ dom \ @@ -35,6 +36,8 @@ REQUIRES = \ plugin \ pref \ string \ + webBrowser_core \ + webshell \ widget \ xpcom \ $(NULL) @@ -55,6 +58,10 @@ EXPORTS = \ LINCS = \ -I..\base \ -I..\html \ + -I..\..\..\layout\html\forms\public \ + -I..\..\..\layout\html\forms\src \ + -I..\..\..\layout\html\base\src \ + -I..\..\..\widget\src\windows \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/accessible/src/xul/nsXULTabAccessible.cpp b/mozilla/accessible/src/xul/nsXULTabAccessible.cpp index 7d0b645ee05..4faeca1f86c 100644 --- a/mozilla/accessible/src/xul/nsXULTabAccessible.cpp +++ b/mozilla/accessible/src/xul/nsXULTabAccessible.cpp @@ -38,11 +38,22 @@ * ***** END LICENSE BLOCK ***** */ // NOTE: alphabetically ordered +#include "nsAccessibilityService.h" #include "nsXULTabAccessible.h" +#include "nsIContentViewer.h" +#include "nsIDocShell.h" +#include "nsIDocument.h" +#include "nsIDOMDocument.h" #include "nsIDOMXULSelectCntrlEl.h" #include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIFrame.h" +#include "nsIPluginViewer.h" +#include "nsIScriptGlobalObject.h" #include "nsIStyleContext.h" +#include "nsIWebShell.h" +#include "nsIWebShellWindow.h" +#include "nsplugindefs.h" +#include "nsPluginViewer.h" /** * XUL Tab @@ -179,7 +190,7 @@ NS_IMETHODIMP nsXULTabBoxAccessible::GetAccChildCount(PRInt32 *_retval) /** Constructor */ nsXULTabPanelsAccessible::nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): -nsAccessible(aNode, aShell) +nsAccessible(aNode, aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1")) { } @@ -211,6 +222,87 @@ NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccName(nsAString& _retval) return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccFirstChild(nsIAccessible **_retval) +{ + nsAccessible::GetAccFirstChild(_retval); + if (*_retval == nsnull) + GetAccPluginChild(_retval); + + return NS_OK; +} + +NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccLastChild(nsIAccessible **_retval) +{ + nsAccessible::GetAccLastChild(_retval); + if (*_retval == nsnull) + GetAccPluginChild(_retval); + + return NS_OK; +} + + +NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccChildCount(PRInt32 *_retval) +{ + nsAccessible::GetAccChildCount(_retval); + if (*_retval == 0) { + *_retval = 1; + } + return NS_OK; +} + +nsresult nsXULTabPanelsAccessible::GetAccPluginChild(nsIAccessible **_retval) +{ + // this big mess eventually gets the HWND for the full + // page plugin, and creates the shim class so we can + // get the IAccessible from the system in the widget/src code + nsCOMPtr domDoc; + mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); + nsCOMPtr doc(do_QueryInterface(domDoc)); + if (doc) { + nsCOMPtr globalObj; + doc->GetScriptGlobalObject(getter_AddRefs(globalObj)); + if (globalObj) { + nsCOMPtr docShell; + globalObj->GetDocShell(getter_AddRefs(docShell)); + nsCOMPtr webShell(do_QueryInterface(docShell)); + if (webShell) { + nsCOMPtr container; + webShell->GetContainer(*getter_AddRefs(container)); + nsCOMPtr wsWin(do_QueryInterface(container)); + if (wsWin) { + nsCOMPtr contentShell; + wsWin->GetContentWebShell(getter_AddRefs(contentShell)); + nsCOMPtr contentDocShell(do_QueryInterface(contentShell)); + if (contentDocShell) { + nsCOMPtr contentViewer; + contentDocShell->GetContentViewer(getter_AddRefs(contentViewer)); + nsCOMPtr pluginViewer (do_QueryInterface(contentViewer)); + if (pluginViewer) { + nsIPluginViewer *pViewer = pluginViewer.get(); + PluginViewerImpl *viewer = (PluginViewerImpl*)pViewer; +#ifdef XP_WIN + // Plugin code tends to be very platform specific, need to rev this + // when linux/mac plugins come into the picture HWND == windows + HWND pluginPort = nsnull; + viewer->GetPluginPort(&pluginPort); + if (pluginPort != 0) { + if (mAccService) { + mAccService->CreateHTMLNativeWindowAccessible(mDOMNode, mPresShell, (PRInt32)pluginPort, _retval); + return NS_OK; + } + } +#else + *_retval = nsnull; +#endif + } + } + } + } + } + } + return NS_ERROR_FAILURE; +} + /** * XUL Tabs - the s really stands for strip. this is a collection of tab objects */ diff --git a/mozilla/accessible/src/xul/nsXULTabAccessible.h b/mozilla/accessible/src/xul/nsXULTabAccessible.h index 6eec06f2fac..c9a288d3e05 100644 --- a/mozilla/accessible/src/xul/nsXULTabAccessible.h +++ b/mozilla/accessible/src/xul/nsXULTabAccessible.h @@ -80,12 +80,20 @@ class nsXULTabPanelsAccessible : public nsAccessible { public: nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell); + NS_IMETHOD GetAccChildCount(PRInt32 *_retval); + NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval); + NS_IMETHOD GetAccLastChild(nsIAccessible **_retval); NS_IMETHOD GetAccRole(PRUint32 *_retval); NS_IMETHOD GetAccName(nsAString& _retval); NS_IMETHOD GetAccState(PRUint32 *_retval); + protected: + nsresult GetAccPluginChild(nsIAccessible **_retval); + + // data members nsCOMPtr mGParentDOMNode; nsCOMPtr mParentDOMNode; + nsCOMPtr mAccService; }; /** merely a container of tab obejcts */ diff --git a/mozilla/modules/plugin/base/src/Makefile.in b/mozilla/modules/plugin/base/src/Makefile.in index d2ab08f8f2b..9c2d2ca4bbc 100644 --- a/mozilla/modules/plugin/base/src/Makefile.in +++ b/mozilla/modules/plugin/base/src/Makefile.in @@ -88,6 +88,7 @@ EXPORTS = \ nsPluginsCID.h \ nsIPluginHost.h \ nsIPluginInstanceOwner.h \ + nsPluginViewer.h \ $(NULL) ifeq ($(OS_ARCH),WINNT) diff --git a/mozilla/modules/plugin/base/src/makefile.win b/mozilla/modules/plugin/base/src/makefile.win index 72a9890745f..3ca466cb897 100644 --- a/mozilla/modules/plugin/base/src/makefile.win +++ b/mozilla/modules/plugin/base/src/makefile.win @@ -22,9 +22,11 @@ DEPTH=..\..\..\.. EXPORTS = \ - nsPluginsCID.h \ - nsIPluginHost.h \ - nsIPluginInstanceOwner.h + nsIPluginHost.h \ + nsIPluginInstanceOwner.h \ + nsPluginsCID.h \ + nsPluginViewer.h \ + $(NULL) MODULE = plugin LIBRARY_NAME = gkplugin diff --git a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp index 6c26a3a01a2..91d0cfdc9f8 100644 --- a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp @@ -155,9 +155,10 @@ public: NS_IMETHOD_(void) Notify(nsITimer *timer); void CancelTimer(); + nsPluginPort* GetPluginPort(); + #ifdef XP_MAC void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent); - nsPluginPort* GetPluginPort(); void FixUpPluginWindow(); #endif @@ -175,55 +176,6 @@ private: nsRect& aClipRect, PRBool& aIsVisible); #endif -class PluginViewerImpl : public nsIPluginViewer, - public nsIContentViewer, - public nsIContentViewerEdit, - public nsIWebBrowserPrint -{ -public: - PluginViewerImpl(const char* aCommand); - nsresult Init(nsIStreamListener** aDocListener); - - NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW - - // nsISupports - NS_DECL_ISUPPORTS - - // nsIPluginViewer - NS_IMETHOD StartLoad(nsIRequest* request, nsIStreamListener*& aResult); - - // nsIContentViewer - NS_DECL_NSICONTENTVIEWER - - // nsIContentViewerEdit - NS_DECL_NSICONTENTVIEWEREDIT - - // nsIWebBrowserPrint - NS_DECL_NSIWEBBROWSERPRINT - - virtual ~PluginViewerImpl(); - - nsresult CreatePlugin(nsIRequest* request, nsIPluginHost* aHost, const nsRect& aBounds, - nsIStreamListener*& aResult); - - nsresult MakeWindow(nsNativeWidget aParent, - nsIDeviceContext* aDeviceContext, - const nsRect& aBounds); - - void ForceRefresh(void); - - nsresult GetURI(nsIURI* *aURI); - - nsresult GetDocument(nsIDocument* *aDocument); - - nsIWidget* mWindow; - nsIDocument* mDocument; - nsCOMPtr mContainer; - nsIChannel* mChannel; - pluginInstanceOwner *mOwner; - PRBool mEnableRendering; - -}; //---------------------------------------------------------------------- @@ -589,6 +541,15 @@ PluginViewerImpl::GetBounds(nsRect& aResult) return NS_OK; } +#ifdef XP_WIN +NS_IMETHODIMP +PluginViewerImpl::GetPluginPort(HWND *aPort) +{ + *aPort = (HWND) mOwner->GetPluginPort(); + return NS_OK; +} +#endif + NS_IMETHODIMP PluginViewerImpl::GetPreviousViewer(nsIContentViewer** aViewer) { @@ -1396,17 +1357,20 @@ void pluginInstanceOwner::CancelTimer() } } - -#ifdef XP_MAC nsPluginPort* pluginInstanceOwner::GetPluginPort() { +//!!! Port must be released for windowless plugins on Windows, because it is HDC !!! nsPluginPort* result = NULL; - if (mWindow != NULL) - result = (nsPluginPort*) mWindow->GetNativeData(NS_NATIVE_PLUGIN_PORT); - return result; + if (mWindow != NULL) + { + result = (nsPluginPort*) mWindow->GetNativeData(NS_NATIVE_PLUGIN_PORT); + } + return result; } +#ifdef XP_MAC + // calculate the absolute position and clip for a widget // and use other windows in calculating the clip // also find out if we are visible or not diff --git a/mozilla/modules/plugin/base/src/nsPluginViewer.h b/mozilla/modules/plugin/base/src/nsPluginViewer.h index a1f7e61cf33..5e043a70b69 100644 --- a/mozilla/modules/plugin/base/src/nsPluginViewer.h +++ b/mozilla/modules/plugin/base/src/nsPluginViewer.h @@ -38,8 +38,72 @@ #ifndef nsPluginViewer_h__ #define nsPluginViewer_h__ +#include "nsCOMPtr.h" +#include "nscore.h" +#include "nsCRT.h" +#include "nsIContentViewer.h" +#include "nsIContentViewerEdit.h" +#include "nsIWebBrowserPrint.h" +#include "nsIWidget.h" +#include "nsIPluginViewer.h" + class nsIStreamListener; class nsIContentViewer; +class pluginInstanceOwner; + +class PluginViewerImpl : public nsIPluginViewer, + public nsIContentViewer, + public nsIContentViewerEdit, + public nsIWebBrowserPrint +{ +public: + PluginViewerImpl(const char* aCommand); + nsresult Init(nsIStreamListener** aDocListener); + + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIPluginViewer + NS_IMETHOD StartLoad(nsIRequest* request, nsIStreamListener*& aResult); + + // nsIContentViewer + NS_DECL_NSICONTENTVIEWER + + // nsIContentViewerEdit + NS_DECL_NSICONTENTVIEWEREDIT + + // nsIWebBrowserPrint + NS_DECL_NSIWEBBROWSERPRINT + +#ifdef XP_WIN + NS_IMETHOD GetPluginPort(HWND *aPort); +#endif + + virtual ~PluginViewerImpl(); + + nsresult CreatePlugin(nsIRequest* request, nsIPluginHost* aHost, const nsRect& aBounds, + nsIStreamListener*& aResult); + + nsresult MakeWindow(nsNativeWidget aParent, + nsIDeviceContext* aDeviceContext, + const nsRect& aBounds); + + void ForceRefresh(void); + + nsresult GetURI(nsIURI* *aURI); + + nsresult GetDocument(nsIDocument* *aDocument); + + nsIWidget* mWindow; + nsIDocument* mDocument; + nsCOMPtr mContainer; + nsIChannel* mChannel; + pluginInstanceOwner *mOwner; + PRBool mEnableRendering; + +}; extern nsresult NS_NewPluginContentViewer(const char* aCommand, diff --git a/mozilla/xpfe/appshell/public/nsIWebShellWindow.h b/mozilla/xpfe/appshell/public/nsIWebShellWindow.h index f198ea1690b..4b8ea3b0e27 100644 --- a/mozilla/xpfe/appshell/public/nsIWebShellWindow.h +++ b/mozilla/xpfe/appshell/public/nsIWebShellWindow.h @@ -60,6 +60,7 @@ public: NS_IMETHOD Toolbar() = 0; NS_IMETHOD Close() = 0; NS_IMETHOD GetWebShell(nsIWebShell *& aWebShell) = 0; + NS_IMETHOD GetContentWebShell(nsIWebShell **aResult) = 0; NS_IMETHOD GetWidget(nsIWidget *& aWidget) = 0; NS_IMETHOD GetDOMWindow(nsIDOMWindowInternal** aDOMWindow) = 0; NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowInternal** aDOMWindow) = 0;