bug 78390 accessible support for full page PDFs

r=aaronl,peterl
sr=jst
This commit is contained in:
jgaunt%netscape.com 2002-07-02 17:39:40 +00:00
parent f76a85174c
commit 0a7856e064
14 changed files with 291 additions and 95 deletions

View File

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

View File

@ -95,6 +95,26 @@
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:::layout:html:base:src:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:::modules:plugin:base:src:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>::build:</VALUE></SETTING>
@ -1110,6 +1130,26 @@
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:::layout:html:base:src:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:::modules:plugin:base:src:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>::build:</VALUE></SETTING>

View File

@ -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 \

View File

@ -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 \

View File

@ -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:

View File

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

View File

@ -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>

View File

@ -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<nsIDOMDocument> domDoc;
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (doc) {
nsCOMPtr<nsIScriptGlobalObject> globalObj;
doc->GetScriptGlobalObject(getter_AddRefs(globalObj));
if (globalObj) {
nsCOMPtr<nsIDocShell> docShell;
globalObj->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
if (webShell) {
nsCOMPtr<nsIWebShellContainer> container;
webShell->GetContainer(*getter_AddRefs(container));
nsCOMPtr<nsIWebShellWindow> wsWin(do_QueryInterface(container));
if (wsWin) {
nsCOMPtr<nsIWebShell> contentShell;
wsWin->GetContentWebShell(getter_AddRefs(contentShell));
nsCOMPtr<nsIDocShell> contentDocShell(do_QueryInterface(contentShell));
if (contentDocShell) {
nsCOMPtr<nsIContentViewer> contentViewer;
contentDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIPluginViewer> 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
*/

View File

@ -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<nsIDOMNode> mGParentDOMNode;
nsCOMPtr<nsIDOMNode> mParentDOMNode;
nsCOMPtr<nsIAccessibilityService> mAccService;
};
/** merely a container of tab obejcts */

View File

@ -88,6 +88,7 @@ EXPORTS = \
nsPluginsCID.h \
nsIPluginHost.h \
nsIPluginInstanceOwner.h \
nsPluginViewer.h \
$(NULL)
ifeq ($(OS_ARCH),WINNT)

View File

@ -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

View File

@ -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<nsISupports> 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

View File

@ -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<nsISupports> mContainer;
nsIChannel* mChannel;
pluginInstanceOwner *mOwner;
PRBool mEnableRendering;
};
extern nsresult
NS_NewPluginContentViewer(const char* aCommand,

View File

@ -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;