зеркало из https://github.com/mozilla/gecko-dev.git
Bug 208812. Fire nsIObserver notifications for accessibility events for internal accessibility clients. r=kyle, sr=alecf
This commit is contained in:
Родитель
4f35b36130
Коммит
5d380d4f56
|
@ -47,6 +47,7 @@ XPIDLSRCS = \
|
|||
nsIAccessibleProvider.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
nsIAccessNode.idl \
|
||||
nsIAccessibleEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -23,12 +23,10 @@
|
|||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAtom.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsIAccessibleCaret.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
interface nsIAccessible;
|
||||
interface nsIAccessibleCaret;
|
||||
interface nsIWeakReference;
|
||||
interface nsIAccessibleEventListener;
|
||||
interface nsIDocument;
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAccessibleCaret.idl"
|
||||
|
||||
interface nsIDocument;
|
||||
interface nsIAccessible;
|
||||
interface nsIAccessibleCaret;
|
||||
interface nsIAccessNode;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
|
@ -39,11 +40,13 @@ interface nsIAccessibleDocument : nsISupports
|
|||
readonly attribute AString mimeType;
|
||||
readonly attribute AString docType;
|
||||
readonly attribute boolean isEditable;
|
||||
readonly attribute nsIDOMDocument document;
|
||||
readonly attribute nsIDOMWindow window;
|
||||
AString getNameSpaceURIForID(in short nameSpaceID);
|
||||
readonly attribute nsIAccessibleCaret caretAccessible;
|
||||
[noscript] readonly attribute voidPtr window;
|
||||
[noscript] readonly attribute voidPtr windowHandle;
|
||||
[noscript] nsIAccessNode getCachedAccessNode(in voidPtr aUniqueID);
|
||||
[noscript] void InvalidateCacheSubtree(in nsIDOMNode aStartNode);
|
||||
[noscript] void invalidateCacheSubtree(in nsIDOMNode aStartNode);
|
||||
[noscript] nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
|
||||
[noscript] void cacheAccessNode(in voidPtr aUniqueID, in nsIAccessNode aAccessNode);
|
||||
[noscript] void destroy();
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.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 nsIAccessible;
|
||||
interface nsIAccessibleDocument;
|
||||
|
||||
%{C++
|
||||
#define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(87F29033-C4A6-40a3-AC7A-3BA391F9992D)]
|
||||
interface nsIAccessibleEvent : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long eventType;
|
||||
readonly attribute nsIAccessible accessible;
|
||||
readonly attribute nsIAccessibleDocument docAccessible;
|
||||
[noscript] readonly attribute voidPtr eventData;
|
||||
};
|
|
@ -88,6 +88,9 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
|
||||
// First fire nsIObserver event for internal xpcom accessibility clients
|
||||
nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aEventData);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsAccessibleWrap *accWrap =
|
||||
|
|
|
@ -52,6 +52,7 @@ REQUIRES = commandhandler \
|
|||
|
||||
CPPSRCS = \
|
||||
nsAccessNode.cpp \
|
||||
nsAccessibleEventData.cpp \
|
||||
nsDocAccessible.cpp \
|
||||
nsOuterDocAccessible.cpp \
|
||||
nsAccessibilityAtoms.cpp \
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessNode.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
@ -161,7 +162,7 @@ NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
|
|||
{
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ASSERTION(docAccessible, "No root accessible pointer back, Init() not called.");
|
||||
return docAccessible->GetWindow(aWindow);
|
||||
return docAccessible->GetWindowHandle(aWindow);
|
||||
}
|
||||
|
||||
void nsAccessNode::InitXPAccessibility()
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.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 "nsAccessibleEventData.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAccessibleEventData, nsIAccessibleEvent);
|
||||
|
||||
nsAccessibleEventData::nsAccessibleEventData(PRUint32 aEventType, nsIAccessible *aAccessible,
|
||||
nsIAccessibleDocument *aDocAccessible,
|
||||
void *aEventData):
|
||||
mEventType(aEventType), mAccessible(aAccessible), mDocAccessible(aDocAccessible),
|
||||
mEventData(aEventData)
|
||||
{
|
||||
}
|
||||
|
|
@ -40,11 +40,38 @@
|
|||
#ifndef _nsAccessibleEventData_H_
|
||||
#define _nsAccessibleEventData_H_
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
class nsIAccessible;
|
||||
class nsAccessibleEventData: public nsIAccessibleEvent
|
||||
{
|
||||
public:
|
||||
nsAccessibleEventData(PRUint32 aEventType, nsIAccessible *aAccessible,
|
||||
nsIAccessibleDocument *aDocAccessible,
|
||||
void *aEventData);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIAccessibleEvent
|
||||
NS_IMETHOD GetEventType(PRUint32 *aEventType) {*aEventType = mEventType; return NS_OK;}
|
||||
NS_IMETHOD GetAccessible(nsIAccessible **aAccessible)
|
||||
{NS_ADDREF(*aAccessible = mAccessible); return NS_OK;}
|
||||
NS_IMETHOD GetDocAccessible(nsIAccessibleDocument **aDocAccessible)
|
||||
{NS_ADDREF(*aDocAccessible = mDocAccessible); return NS_OK;}
|
||||
NS_IMETHOD GetEventData(void **aEventData) {*aEventData = mEventData; return NS_OK;}
|
||||
|
||||
private:
|
||||
PRUint32 mEventType;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsIAccessibleDocument> mDocAccessible;
|
||||
void *mEventData;
|
||||
};
|
||||
|
||||
// XXX todo: We might want to use XPCOM interfaces instead of structs
|
||||
// e.g., nsAccessibleTextChangeEvent: public nsIAccessibleTextChangeEvent
|
||||
//
|
||||
|
||||
struct AtkStateChange {
|
||||
PRUint32 state;
|
||||
|
@ -92,6 +119,4 @@ struct AtkTableChange {
|
|||
PRUint32 count; // the number of inserted/deleted rows/columns
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsAccessibleEventData.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsICommandManager.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -57,6 +58,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -67,9 +69,6 @@
|
|||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsAccessibleEventData.h"
|
||||
#endif
|
||||
|
||||
//=============================//
|
||||
// nsDocAccessible //
|
||||
|
@ -256,12 +255,43 @@ NS_IMETHODIMP nsDocAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAcc
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetWindow(void **aWindow)
|
||||
NS_IMETHODIMP nsDocAccessible::GetWindowHandle(void **aWindow)
|
||||
{
|
||||
*aWindow = mWnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetWindow(nsIDOMWindow **aDOMWin)
|
||||
{
|
||||
*aDOMWin = nsnull;
|
||||
if (!mDocument) {
|
||||
return NS_ERROR_FAILURE; // Accessible is Shutdown()
|
||||
}
|
||||
nsCOMPtr<nsIScriptGlobalObject> ourGlobal;
|
||||
mDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal));
|
||||
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(ourGlobal));
|
||||
|
||||
if (!domWindow)
|
||||
return NS_ERROR_FAILURE; // No DOM Window
|
||||
|
||||
NS_ADDREF(*aDOMWin = domWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetDocument(nsIDOMDocument **aDOMDoc)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDocument));
|
||||
*aDOMDoc = domDoc;
|
||||
|
||||
if (domDoc) {
|
||||
NS_ADDREF(*aDOMDoc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void nsDocAccessible::CheckForEditor()
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> ourGlobal;
|
||||
|
@ -987,3 +1017,18 @@ void nsDocAccessible::HandleMutationEvent(nsIDOMEvent *aEvent, PRUint32 aAccessi
|
|||
accessible->FireToolkitEvent(aAccessibleEventType, accessible, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsService =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (!obsService) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIAccessibleEvent *accEvent = new nsAccessibleEventData(aEvent, aAccessible, this, aData);
|
||||
NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(accEvent);
|
||||
return obsService->NotifyObservers(accEvent, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,8 @@ class nsDocAccessible : public nsBlockAccessible,
|
|||
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData);
|
||||
|
||||
// nsIAccessNode
|
||||
NS_IMETHOD Shutdown();
|
||||
NS_IMETHOD Init();
|
||||
|
|
|
@ -160,6 +160,8 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessib
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aData); // Fire nsIObserver message
|
||||
|
||||
#ifdef SWALLOW_DOC_FOCUS_EVENTS
|
||||
// Remove this until we can figure out which focus events are coming at
|
||||
// the same time as native window focus events, although
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "winable.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleCaret.h"
|
||||
#include "nsIAccessNode.h"
|
||||
#ifndef WM_GETOBJECT
|
||||
#define WM_GETOBJECT 0x03d
|
||||
|
@ -6997,7 +6998,6 @@ VOID CALLBACK nsWindow::HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent,
|
|||
DealWithPopups(gRollupMsgId, 0, 0, &popupHandlingResult);
|
||||
gRollupMsgId = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче