Bug 212157. Move accessibility interfaces toward eventual freezing, mark @status UNDER_REVIEW. r=kyle, sr=alecf

This commit is contained in:
aaronl%netscape.com 2003-07-22 14:55:22 +00:00
parent e206c0a230
commit de009d6679
29 changed files with 759 additions and 348 deletions

View File

@ -46,7 +46,6 @@ XPIDLSRCS = \
nsIAccessibleCaret.idl \
nsIAccessibleDocument.idl \
nsPIAccessibleDocument.idl \
nsIAccessibleEventReceiver.idl \
nsIAccessibleProvider.idl \
nsIAccessibleSelectable.idl \
nsIAccessNode.idl \

View File

@ -38,7 +38,9 @@
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMDocument.h")
cpp_quote("// ISimpleDOMDocument")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("//")
cpp_quote("// get_URL(out] BSTR *url)")

View File

@ -38,15 +38,18 @@
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMNode.h ")
cpp_quote("// ISimpleDOMNode")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// An interface that extends MSAA's IAccessible to provide readonly DOM node information via cross-process COM.")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("//")
cpp_quote("// get_nodeInfo(")
cpp_quote("// /* [out] */ BSTR *nodeName, // For elements, this is the tag name")
cpp_quote("// /* [out] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *nodeValue, ")
cpp_quote("// /* [out] */ unsigned int *numChildren); ")
cpp_quote("// /* [out] */ unsigned int *uniqueID; // In Win32 accessible events we generate, the target's childID matches to this")
cpp_quote("// /* [out] */ unsigned int *numChildren); ")
cpp_quote("// /* [out] */ unsigned int *uniqueID; // In Win32 accessible events we generate, the target's childID matches to this")
cpp_quote("// /* [out] */ unsigned short *nodeType,")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get the basic information about a node.")
@ -56,7 +59,7 @@ cpp_quote("// get_attributes(")
cpp_quote("// /* [in] */ unsigned short maxAttribs,")
cpp_quote("// /* [out] */ unsigned short *numAttribs,")
cpp_quote("// /* [out] */ BSTR *attribNames,")
cpp_quote("// /* [out] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *attribValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns 3 arrays - the attribute names and values, and a namespace ID for each")
@ -64,7 +67,7 @@ cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's na
cpp_quote("//")
cpp_quote("// get_attributesForNames(")
cpp_quote("// /* [in] */ unsigned short numAttribs,")
cpp_quote("// /* [in] */ BSTR *attribNames,")
cpp_quote("// /* [in] */ BSTR *attribNames,")
cpp_quote("// /* [in] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *attribValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
@ -100,14 +103,23 @@ cpp_quote("// Returns 2 arrays -- the style properties and their values")
cpp_quote("// useAlternateView=FALSE: gets properties for the default media type (usually screen)")
cpp_quote("// useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
cpp_quote("//")
cpp_quote("// get_parentNode (/* [in] */ ISimpleDOMNode *newNodePtr);")
cpp_quote("// get_firstChild (/* [in] */ ISimpleDOMNode *newNodePtr);")
cpp_quote("// get_lastChild (/* [in] */ ISimpleDOMNode *newNodePtr);")
cpp_quote("// get_previousSibling(/* [in] */ ISimpleDOMNode *newNodePtr);")
cpp_quote("// get_nextSibling (/* [in] */ ISimpleDOMNode *newNodePtr);")
cpp_quote("// get_parentNode (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_firstChild (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_lastChild (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_previousSibling(/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_nextSibling (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_childAt (/* [in] */ unsigned childIndex, /* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// DOM navigation - get a different node.")
cpp_quote("//")
cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
cpp_quote("//")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")

View File

@ -24,6 +24,47 @@
import "objidl.idl";
import "oaidl.idl";
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMText")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// An interface that extends MSAA's IAccessible to provide important additional capabilities on text nodes")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("//")
cpp_quote("// get_domText(/* out */ BSTR *domText")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Similar to IAccessible::get_accName, but does not strip out whitespace characters.")
cpp_quote("// Important for retrieving the correct start/end substring indices to use with other")
cpp_quote("// methods in ISimpleDOMText.")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// get_[un]clippedSubstringBounds(")
cpp_quote("// /* [in] */ unsigned int startIndex,")
cpp_quote("// /* [in] */ unsigned int endIndex,")
cpp_quote("// /* [out] */ int *x,")
cpp_quote("// /* [out] */ int *y,")
cpp_quote("// /* [out] */ int *width,")
cpp_quote("// /* [out] */ int *height);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Both methods get_clippedSubstringBounds and get_unclippedSubstringBounds return the screen pixel")
cpp_quote("// coordinates of the given text substring. The in parameters for start and end indices refer")
cpp_quote("// to the string returned by ISimpleDOMText::get_domText().")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// scrollToSubstring(")
cpp_quote("// /* [in] */ unsigned int startIndex,")
cpp_quote("// /* [in] */ unsigned int endIndex);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// In scrollable views, scrolls to ensure that the specified substring is visible onscreen.")
cpp_quote("// The in parameters for start and end indices refer to the string returned")
cpp_quote("// by ISimpleDOMText::get_domText().")
cpp_quote("//")
cpp_quote("//")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")
cpp_quote("")
[object, uuid(aa24e510-a4e6-4112-a258-0ba7f12e85a9)]
interface ISimpleDOMText: IUnknown
{

View File

@ -41,24 +41,101 @@
interface nsIDOMNode;
interface nsIAccessibleDocument;
/**
* An interface used by in-process accessibility clients
* to get style, window, markup and other information about
* a DOM node. When accessibility is active in Gecko,
* every DOM node can have one nsIAccessNode for each
* pres shell the DOM node is rendered in.
* The nsIAccessNode implementations are instantiated lazily.
* The nsIAccessNode tree for a given dom window
* has a one to one relationship to the DOM tree.
* If the DOM node for this access node is "accessible",
* then a QueryInterface to nsIAccessible will succeed.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(46820F9B-3088-4046-AB0F-56FDACDC7A82)]
interface nsIAccessNode : nsISupports
{
/**
* The DOM node this nsIAccessNode is associated with.
*/
readonly attribute nsIDOMNode DOMNode;
/**
* The number of DOM children for the DOM node, which
* matches the number of nsIAccessNode children for this
* nsIAccessNode.
*/
readonly attribute long numChildren;
/**
* Get the nth child of this node
* @param childNum Zero-based child index
* @return The nth nsIAccessNode child
*/
nsIAccessNode getChildAt(in long childNum);
/**
* The parent nsIAccessNode
*/
readonly attribute nsIAccessNode parent;
/**
* The first nsIAccessNode child
*/
readonly attribute nsIAccessNode firstChild;
/**
* The last nsIAccessNode child
*/
readonly attribute nsIAccessNode lastChild;
/**
* The previous nsIAccessNode sibling
*/
readonly attribute nsIAccessNode previousSibling;
/**
* The next nsIAccessNode sibling
*/
readonly attribute nsIAccessNode nextSibling;
/**
* The nsIAccessibleDocument that this nsIAccessNode
* resides in.
*/
readonly attribute nsIAccessibleDocument accessibleDocument;
/**
* The innerHTML for the DOM node
* This is a text string of all the markup inside the DOM
* node, not including the start and end tag for the node.
*/
readonly attribute DOMString innerHTML;
/**
* The OS window handle for the window this node
* is being displayed in.
*/
[noscript] readonly attribute voidPtr ownerWindow;
/**
* A unique ID calculated for this DOM node, for the
* purposes of caching and referencing this object.
*/
[noscript] readonly attribute voidPtr uniqueID;
/**
* Retrieve the computed style value for this DOM node, if it is a DOM element.
* Note: the meanings of width, height and other size measurements depend
* on the version of CSS being used. Therefore, for bounds information,
* it is better to use nsIAccessible::accGetBounds.
* @param pseudoElt The pseudo element to retrieve style for, or NULL
* for general computed style information for this node.
* @param propertyName Retrieve the computed style value for this property name,
* for example "border-bottom".
*/
DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName);
};

View File

@ -22,6 +22,7 @@
* Original Author: Eric D Vaughan (evaughan@netscape.com)
* Contributor(s): Aaron Leventhal (aaronl@netscape.com)
* John Gaunt (jgaunt@netscape.com)
* Kyle Yuan (kyle.yuan@sun.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
@ -41,58 +42,201 @@
#include "nsIDOMNode.idl"
#include "domstubs.idl"
/**
* A cross-platform interface that supports platform-specific
* accessibility APIs like MSAA and ATK. Contains the sum of what's needed
* to support IAccessible as well as ATK's generic accessibility objects.
* Can also be used by in-process accessibility clients to get information
* about objects in the accessible tree. The accessible tree is a subset of
* nodes in the DOM tree -- such as documents, focusable elements and text.
* Mozilla creates the implementations of nsIAccessible on demand.
* See http://www.mozilla.org/projects/ui/accessibility for more information.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(B26FBE47-9A5F-42a1-822B-082461AE4D6D)]
interface nsIAccessible : nsISupports
{
/**
* Parent node in accessible tree.
*/
readonly attribute nsIAccessible accParent;
/**
* Next sibling in accessible tree
*/
readonly attribute nsIAccessible accNextSibling;
/**
* Previous sibling in accessible tree
*/
readonly attribute nsIAccessible accPreviousSibling;
/**
* First child in accessible tree
*/
readonly attribute nsIAccessible accFirstChild;
/**
* Last child in accessible tree
*/
readonly attribute nsIAccessible accLastChild;
/**
* Number of accessible children
*/
readonly attribute long accChildCount;
/**
* Accessible name -- the main text equivalent for this node
*/
attribute AString accName;
/**
* Accessible value -- a number or a secondary text equivalent for this node
*/
readonly attribute AString accValue;
/**
* Accessible description -- long text associated with this node
*/
readonly attribute AString accDescription;
/**
* Provides localized string of accesskey name, such as Alt+D.
* The modifier may be affected by user and platform preferences.
* Usually alt+letter, or just the letter alone for menu items.
*/
readonly attribute AString accKeyboardShortcut;
/**
* First child in accessible tree
*/
readonly attribute AString accKeybinding;
/**
* Enumerated accessible role. The values depend on platform because of variations.
* See the ROLE_* constants defined later in this file.
*/
readonly attribute unsigned long accRole;
/**
* Accessible states -- bit field which describes boolean properties of node.
* See the STATE_* constants defined later in this file.
*/
readonly attribute unsigned long accState;
/**
* Extended accessible states -- second bit field describing node
*/
readonly attribute unsigned long accExtState;
/**
* Help text associated with node
*/
readonly attribute AString accHelp;
/**
* Focused accessible child of node
*/
readonly attribute nsIAccessible accFocused;
/**
* Accessible child which contains the coordinate at x,y
*/
nsIAccessible accGetAt(in long x, in long y);
nsIAccessible getChildAt(in long aChildIndex); // zero-based index
nsIAccessible accNavigateRight();
nsIAccessible accNavigateLeft();
nsIAccessible accNavigateUp();
nsIAccessible accNavigateDown();
/**
* Nth accessible child using zero-based index
*/
nsIAccessible getChildAt(in long aChildIndex);
/**
* Accessible node geometrically to the right of this one
*/
nsIAccessible accGetFromRight();
/**
* Accessible node geometrically to the left of this one
*/
nsIAccessible accGetFromLeft();
/**
* Accessible node geometrically above this one
*/
nsIAccessible accGetFromAbove();
/**
* Accessible node geometrically below this one
*/
nsIAccessible accGetFromBelow();
void accGetBounds(out long x,
out long y,
out long width,
out long height);
/**
* Add this accessible to the current selection
*/
void accAddSelection();
/**
* Remove this accessible from the current selection
*/
void accRemoveSelection();
/**
* Extend the current selection from its current accessible anchor node
* to this accessible
*/
void accExtendSelection();
/**
* Select this accessible node only
*/
void accTakeSelection();
/**
* Focus this accessible node,
* The state STATE_FOCUSABLE indicates whether this node is normally focusable.
* It is the callers responsibility to determine whether this node is focusable.
* accTakeFocus on a node that is not normally focusable (such as a table),
* will still set focus on that node, although normally that will not be visually
* indicated in most style sheets.
*/
void accTakeFocus();
/**
* The number of accessible actions associated with this accessible
*/
readonly attribute PRUint8 accNumActions;
AString getAccActionName(in PRUint8 index);
void accDoAction(in PRUint8 index); // Action number 0 is the default action
/**
* The name of the accessible action at the given zero-based index
*/
AString getAccActionName(in PRUint8 index);
/**
* Perform the accessible action at the given zero-based index
* Action number 0 is the default action
*/
void accDoAction(in PRUint8 index);
/**
* Get the DOM node described by this accessible node
*/
nsIDOMNode accGetDOMNode();
/**
* Get a pointer to accessibility interface for this node, which is specific
* to the OS/accessibility toolkit we're running on.
*/
[noscript] void getNativeInterface(out voidPtr aOutAccessible);
// MSAA State flags - used for bitfield. More than 1 allowed.
/**
* MSAA State flags - used for bitfield. More than 1 allowed.
*/
const unsigned long STATE_UNAVAILABLE = 0x00000001; // Disabled, maps to opposite of Java ENABLED, Gnome/ATK SENSITIVE?
const unsigned long STATE_SELECTED = 0x00000002;
const unsigned long STATE_FOCUSED = 0x00000004;
@ -125,9 +269,11 @@ interface nsIAccessible : nsISupports
const unsigned long STATE_PROTECTED = 0x20000000; // Maps to Gnome's *Role* ATK_ROLE_PASSWD_TEXT, nothing for Java?
const unsigned long STATE_HASPOPUP = 0x40000000; // New in MSAA 2.0
// Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
// This is only the states that there isn't already a mapping for in MSAA
// See www.accessmozilla.org/article.php?sid=11 for information on the mappings between accessibility API states
/**
* Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
* This is only the states that there isn't already a mapping for in MSAA
* See www.accessmozilla.org/article.php?sid=11 for information on the mappings between accessibility API states
*/
const unsigned long STATE_INVALID = 0x00200000; // No explanation given
const unsigned long STATE_ACTIVE = 0x00400000; // This window is currently the active window
const unsigned long STATE_EXPANDABLE = 0x00800000; // An item that can be expanded, such as a tree item with children
@ -144,32 +290,32 @@ interface nsIAccessible : nsISupports
%{C++
#ifdef MOZ_ACCESSIBILITY_ATK
/*******************************************************************************
The following nsIAccessible roles are traslated to ATK_ROLE_UNKNOWN
ROLE_TITLEBAR, ROLE_SOUND, ROLE_CURSOR, ROLE_CARET, ROLE_BORDER,
ROLE_GROUPING, ROLE_EQUATION, ROLE_COLUMN, ROLE_ROW, ROLE_LINK,
ROLE_WHITESPACE, ROLE_CLOCK,
ROLE_IPADDRESS
ROLE_GRIP
The object represents a special mouse pointer, which allows a user to
manipulate user interface elements such as windows.
ROLE_HELPBALLOON
The object displays a Help topic in the form of a ToolTip or Help balloon.
ROLE_PROPERTYPAGE
The object represents a property sheet.
ROLE_INDICATOR
The object represents an indicator, such as a pointer graphic pointing to
the currrent item.
ROLE_HOTKEYFIELD
The object represents a hot-key field that allow the user to enter a
sequence of keystroke.
/**
* The following nsIAccessible roles are translated to ATK_ROLE_UNKNOWN
*
* ROLE_TITLEBAR, ROLE_SOUND, ROLE_CURSOR, ROLE_CARET, ROLE_BORDER,
* ROLE_GROUPING, ROLE_EQUATION, ROLE_COLUMN, ROLE_ROW, ROLE_LINK,
* ROLE_WHITESPACE, ROLE_CLOCK,
* ROLE_IPADDRESS
*
* ROLE_GRIP
* The object represents a special mouse pointer, which allows a user to
* manipulate user interface elements such as windows.
*
* ROLE_HELPBALLOON
* The object displays a Help topic in the form of a ToolTip or Help balloon.
*
* ROLE_PROPERTYPAGE
* The object represents a property sheet.
*
* ROLE_INDICATOR
* The object represents an indicator, such as a pointer graphic pointing to
* the current item.
*
* ROLE_HOTKEYFIELD
* The object represents a hot-key field that allow the user to enter a
* sequence of keystroke.
*/
The following ATK roles have no corresponding nsIAccessible roles. Perhaps
there are not these types of widget/control in Mozilla, so don't need these

View File

@ -39,25 +39,97 @@
#include "nsISupports.idl"
interface nsIAccessible;
interface nsIAccessibleCaret;
interface nsIAccessNode;
interface nsIDOMDocument;
interface nsIDOMNode;
interface nsIDOMWindow;
/**
* An interface for in-process accessibility clients
* that wish to retrieve information about a document.
* When accessibility is turned on in Gecko,
* there is an nsIAccessibleDocument for each document
* whether it is XUL, HTML or whatever.
* You can QueryInterface to nsIAccessibleDocument from
* the nsIAccessible or nsIAccessNode for the root node
* of a document. You can also get one from
* nsIAccessNode::GetAccessibleDocument() or
* nsIAccessibleEvent::GetAccessibleDocument()
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
interface nsIAccessibleDocument : nsISupports
{
/**
* The URL of the document
*/
readonly attribute AString URL;
/**
* The title of the document, as specified in the document.
*/
readonly attribute AString title;
/**
* The mime type of the document
*/
readonly attribute AString mimeType;
/**
* The doc type of the document, as specified in the document.
*/
readonly attribute AString docType;
/**
* True if the document is live in an editor.
* False if the document is being displayed but not edited.
* If a <div> is contentEditable, then it has its own document,
* with isEditable == true.
*/
readonly attribute boolean isEditable;
/**
* The nsIDOMDocument interface associated with this document.
*/
readonly attribute nsIDOMDocument document;
/**
* The nsIDOMWindow that the document resides in.
*/
readonly attribute nsIDOMWindow window;
/*
* The accessible for the caret belonging to this window.
*/
readonly attribute nsIAccessible caretAccessible;
/**
* The namespace for each ID that is handed back.
*/
AString getNameSpaceURIForID(in short nameSpaceID);
readonly attribute nsIAccessibleCaret caretAccessible;
/**
* The window handle for the OS window the document is being displayed in.
* For example, in Windows you can static cast it to an HWND.
*/
[noscript] readonly attribute voidPtr windowHandle;
/**
* Returns the access node cached by this document
* @param aUniqueID The unique ID used to cache the node.
* This matches up with the uniqueID attribute on
* nsIAccessNode.
* @return The nsIAccessNode cached for this particular unique ID.
*/
[noscript] nsIAccessNode getCachedAccessNode(in voidPtr aUniqueID);
[noscript] nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
/**
* Returns the first accessible parent of a DOM node.
* Guaranteed not to return nsnull if the DOM node is in a document.
* @param aDOMNode The DOM node we need an accessible for.
* @return An first nsIAccessible found by crawling up the DOM node
* to the document root.
*/
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
};

View File

@ -19,7 +19,6 @@
* 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
@ -45,11 +44,96 @@ interface nsIAccessibleDocument;
#define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
%}
/**
* An interface for accessibility events listened to
* by in-process accessibility clients, which can be used
* to find out how to get accessibility and DOM interfaces for
* the event and its target. To listen to in-process accessibility invents,
* make your object an nsIObserver, and listen for accessible-event by
* using code something like this:
* nsCOMPtr<nsIObserverService> observerService =
* do_GetService("@mozilla.org/observer-service;1", &rv);
* if (NS_SUCCEEDED(rv))
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(87F29033-C4A6-40a3-AC7A-3BA391F9992D)]
interface nsIAccessibleEvent : nsISupports
{
/**
* The type of event, based on the enumerated event values
* defined in this interface.
*/
readonly attribute unsigned long eventType;
/**
* The nsIAccessible associated with the event.
* Accessible events must have an nsIAccessible.
*/
readonly attribute nsIAccessible accessible;
readonly attribute nsIAccessibleDocument docAccessible;
[noscript] readonly attribute voidPtr eventData;
/**
* The nsIAccessibleDocument that the event target nsIAccessible
* resides in. This can be used to get the DOM window,
* the DOM document and the window handler, among other things.
*/
readonly attribute nsIAccessibleDocument accessibleDocument;
// these are set to the values given by MSAA
const unsigned long EVENT_CREATE = 0x8000;
const unsigned long EVENT_DESTROY = 0x8001;
const unsigned long EVENT_SHOW = 0x8002;
const unsigned long EVENT_HIDE = 0x8003;
const unsigned long EVENT_REORDER = 0x8004;
const unsigned long EVENT_FOCUS = 0x8005;
const unsigned long EVENT_STATE_CHANGE = 0x800A;
const unsigned long EVENT_LOCATION_CHANGE = 0x800B;
const unsigned long EVENT_NAME_CHANGE = 0x800C;
const unsigned long EVENT_DESCRIPTIONCHANGE = 0x800D;
const unsigned long EVENT_VALUE_CHANGE = 0x800E;
const unsigned long EVENT_PARENTCHANGE = 0x800F;
const unsigned long EVENT_HELPCHANGE = 0x8010;
const unsigned long EVENT_DEFACTIONCHANGE = 0x8011;
const unsigned long EVENT_ACCELERATORCHANGE = 0x8012;
const unsigned long EVENT_SELECTION = 0x8006;
const unsigned long EVENT_SELECTION_ADD = 0x8007;
const unsigned long EVENT_SELECTION_REMOVE = 0x8008;
const unsigned long EVENT_SELECTION_WITHIN = 0x8009;
const unsigned long EVENT_ALERT = 0x0002;
const unsigned long EVENT_FOREGROUND = 0x0003;
const unsigned long EVENT_MENUSTART = 0x0004;
const unsigned long EVENT_MENUEND = 0x0005;
const unsigned long EVENT_MENUPOPUPSTART = 0x0006;
const unsigned long EVENT_MENUPOPUPEND = 0x0007;
const unsigned long EVENT_CAPTURESTART = 0x0008;
const unsigned long EVENT_CAPTUREEND = 0x0009;
const unsigned long EVENT_MOVESIZESTART = 0x000A;
const unsigned long EVENT_MOVESIZEEND = 0x000B;
const unsigned long EVENT_CONTEXTHELPSTART = 0x000C;
const unsigned long EVENT_CONTEXTHELPEND = 0x000D;
const unsigned long EVENT_DRAGDROPSTART = 0x000E;
const unsigned long EVENT_DRAGDROPEND = 0x000F;
const unsigned long EVENT_DIALOGSTART = 0x0010;
const unsigned long EVENT_DIALOGEND = 0x0011;
const unsigned long EVENT_SCROLLINGSTART = 0x0012;
const unsigned long EVENT_SCROLLINGEND = 0x0013;
const unsigned long EVENT_MINIMIZESTART = 0x0016;
const unsigned long EVENT_MINIMIZEEND = 0x0017;
// the additional events for ATK
const unsigned long EVENT_ATK_PROPERTY_CHANGE = 0x0100;
const unsigned long EVENT_ATK_SELECTION_CHANGE = 0x0101;
const unsigned long EVENT_ATK_TEXT_CHANGE = 0x0102;
const unsigned long EVENT_ATK_TEXT_SELECTION_CHANGE = 0x0103;
const unsigned long EVENT_ATK_TEXT_CARET_MOVE = 0x0104;
const unsigned long EVENT_ATK_VISIBLE_DATA_CHANGE = 0x0105;
const unsigned long EVENT_ATK_TABLE_MODEL_CHANGE = 0x0110;
const unsigned long EVENT_ATK_TABLE_ROW_INSERT = 0x0111;
const unsigned long EVENT_ATK_TABLE_ROW_DELETE = 0x0112;
const unsigned long EVENT_ATK_TABLE_ROW_REORDER = 0x0113;
const unsigned long EVENT_ATK_TABLE_COLUMN_INSERT = 0x0114;
const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE = 0x0115;
const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER = 0x0116;
const unsigned long EVENT_ATK_LINK_SELECTED = 0x0117;
};

View File

@ -1,89 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric D Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsISupports.idl"
[scriptable, uuid(AB331E47-4FAA-4a12-9480-9B480DD78B39)]
interface nsIAccessibleEventReceiver : nsISupports
{
void addEventListeners();
void removeEventListeners();
// these are set to the values given by MSAA
const unsigned long EVENT_CREATE = 0x8000;
const unsigned long EVENT_DESTROY = 0x8001;
const unsigned long EVENT_SHOW = 0x8002;
const unsigned long EVENT_HIDE = 0x8003;
const unsigned long EVENT_REORDER = 0x8004;
const unsigned long EVENT_FOCUS = 0x8005;
const unsigned long EVENT_STATE_CHANGE = 0x800A;
const unsigned long EVENT_LOCATION_CHANGE = 0x800B;
const unsigned long EVENT_NAME_CHANGE = 0x800C;
const unsigned long EVENT_DESCRIPTIONCHANGE = 0x800D;
const unsigned long EVENT_VALUE_CHANGE = 0x800E;
const unsigned long EVENT_PARENTCHANGE = 0x800F;
const unsigned long EVENT_HELPCHANGE = 0x8010;
const unsigned long EVENT_DEFACTIONCHANGE = 0x8011;
const unsigned long EVENT_ACCELERATORCHANGE = 0x8012;
const unsigned long EVENT_SELECTION = 0x8006;
const unsigned long EVENT_SELECTION_ADD = 0x8007;
const unsigned long EVENT_SELECTION_REMOVE = 0x8008;
const unsigned long EVENT_SELECTION_WITHIN = 0x8009;
const unsigned long EVENT_ALERT = 0x0002;
const unsigned long EVENT_FOREGROUND = 0x0003;
const unsigned long EVENT_MENUSTART = 0x0004;
const unsigned long EVENT_MENUEND = 0x0005;
const unsigned long EVENT_MENUPOPUPSTART = 0x0006;
const unsigned long EVENT_MENUPOPUPEND = 0x0007;
const unsigned long EVENT_CAPTURESTART = 0x0008;
const unsigned long EVENT_CAPTUREEND = 0x0009;
const unsigned long EVENT_MOVESIZESTART = 0x000A;
const unsigned long EVENT_MOVESIZEEND = 0x000B;
const unsigned long EVENT_CONTEXTHELPSTART = 0x000C;
const unsigned long EVENT_CONTEXTHELPEND = 0x000D;
const unsigned long EVENT_DRAGDROPSTART = 0x000E;
const unsigned long EVENT_DRAGDROPEND = 0x000F;
const unsigned long EVENT_DIALOGSTART = 0x0010;
const unsigned long EVENT_DIALOGEND = 0x0011;
const unsigned long EVENT_SCROLLINGSTART = 0x0012;
const unsigned long EVENT_SCROLLINGEND = 0x0013;
const unsigned long EVENT_MINIMIZESTART = 0x0016;
const unsigned long EVENT_MINIMIZEEND = 0x0017;
// the additional events for ATK
const unsigned long EVENT_ATK_PROPERTY_CHANGE = 0x0100;
const unsigned long EVENT_ATK_SELECTION_CHANGE = 0x0101;
const unsigned long EVENT_ATK_TEXT_CHANGE = 0x0102;
const unsigned long EVENT_ATK_TEXT_SELECTION_CHANGE = 0x0103;
const unsigned long EVENT_ATK_TEXT_CARET_MOVE = 0x0104;
const unsigned long EVENT_ATK_VISIBLE_DATA_CHANGE = 0x0105;
const unsigned long EVENT_ATK_TABLE_MODEL_CHANGE = 0x0110;
const unsigned long EVENT_ATK_TABLE_ROW_INSERT = 0x0111;
const unsigned long EVENT_ATK_TABLE_ROW_DELETE = 0x0112;
const unsigned long EVENT_ATK_TABLE_ROW_REORDER = 0x0113;
const unsigned long EVENT_ATK_TABLE_COLUMN_INSERT = 0x0114;
const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE = 0x0115;
const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER = 0x0116;
const unsigned long EVENT_ATK_LINK_SELECTED = 0x0117;
};

View File

@ -20,7 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* Contributor(s):
* Contributor(s): Kyle Yuan (kyle.yuan@sun.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
@ -45,14 +45,75 @@ interface nsIPresShell;
interface nsIDOMWindow;
interface nsIAccessNode;
/**
* An interface for in-process accessibility clients
* wishing to get an nsIAccessible or nsIAccessNode for
* a given DOM node.
* More documentation at:
* http://www.mozilla.org/projects/ui/accessibility
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(663CA4A8-D219-4000-925D-D8F66406B626)]
interface nsIAccessibleRetrieval : nsISupports
{
/**
* Return an nsIAccessible for a DOM node in pres shell 0.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
/**
* Return an nsIAccessible for a DOM node in pres shell for this DOM window.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aDOMWin The DOM window containing the node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInWindow(in nsIDOMNode aNode, in nsIDOMWindow aDOMWin);
/**
* Return an nsIAccessible for a DOM node in the given weak shell.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInWeakShell(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
/**
* Return an nsIAccessible for a DOM node in the given pres shell.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInShell(in nsIDOMNode aNode, in nsIPresShell aPresShell);
/**
* Return an nsIAccessNode for an already created DOM node in the given weak shell.
* Does not create a new one -- only returns cached access nodes.
* @param aNode The DOM node to get an access node for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessNode for the given DOM node or null if
* an access node does not already exist for this DOM node.
*/
nsIAccessNode getCachedAccessNode(in nsIDOMNode aNode, in nsIWeakReference aShell);
/**
* Return an nsIAccessible for an already created DOM node in the given weak shell.
* Does not create a new one -- only returns cached accessibles.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node or null if
* an accessible does not already exist for this DOM node.
*/
nsIAccessible getCachedAccessible(in nsIDOMNode aNode, in nsIWeakReference aShell);
};

View File

@ -1,80 +1,112 @@
/* -*- 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.
*
* 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
* John Gaunt
* Marc Mulcahy (marc.mulcahy@sun.com)
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* Kyle Yuan (kyle.yuan@sun.com)
*/
* 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"
#include "nsIAccessible.idl"
#include "nsISupportsArray.idl"
#include "nsIArray.idl"
/**
* An interface for the accessibility module and in-process accessibility clients
* for dealing with getting and changing the selection of accessible nodes.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
interface nsIAccessibleSelectable : nsISupports
{
%{C++
enum { eSelection_Add = 0U, eSelection_Remove = 1U, eSelection_GetState = 2U };
enum { eSelection_Add = 0U, eSelection_Remove = 1U, eSelection_GetState = 2U };
%}
nsISupportsArray GetSelectedChildren();
/**
* Return an nsIArray of selected nsIAccessible children
*/
nsIArray GetSelectedChildren();
/**
* Returns the number of accessible children currently selected.
*/
* Returns the number of accessible children currently selected.
*/
readonly attribute long selectionCount;
/**
* Adds the specified accessible child of the object to the
* object's selection.
*/
* Adds the specified accessible child of the object to the
* object's selection.
* If the specified object is already selected, then it does nothing.
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
*/
void addSelection(in long index);
/**
* Removes the specified child of the object from the object's selection.
*/
* Removes the specified child of the object from the object's selection.
* If the specified object was not selected, then it does nothing.
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
*/
void removeSelection(in long index);
/**
* Clears the selection in the object so that no children in the object
* are selected.
*/
* Clears the selection in the object so that no children in the object
* are selected.
*/
void clearSelection();
/**
* Returns a reference to the accessible object representing the specified
* selected child of the object.
*/
* Returns a reference to the accessible object representing the specified
* selected child of the object.
* @param index Zero-based selected accessible child index
* @return The nth selected accessible child
*/
nsIAccessible refSelection(in long index);
/**
* Determines if the current child of this object is selected
* @param The zero-based accessible child index
* @return Returns true if the child is selected, false if not.
*/
boolean isChildSelected(in long index);
/**
* If the object does not accept multiple selection, return false.
*/
* Select all children
* @return If the object does not accept multiple selection, return false.
* Otherwise, returns true.
*/
boolean selectAllSelection();
};

View File

@ -40,7 +40,6 @@
// NOTE: alphabetically ordered
#include "nsAccessibleText.h"
#include "nsContentCID.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIClipboard.h"
#include "nsIDOMAbstractView.h"
#include "nsIDOMCharacterData.h"
@ -137,7 +136,7 @@ nsresult nsAccessibleText::DOMPointToOffset(nsISupports *aClosure, nsIDOMNode* a
*aResult = aNodeOffset;
nsCOMPtr<nsISupportsArray> domNodeArray(do_QueryInterface(aClosure));
nsCOMPtr<nsIArray> domNodeArray(do_QueryInterface(aClosure));
if (domNodeArray) {
// Static text, calculate the offset from a given set of (text) node
PRUint32 textLength, totalLength = 0;
@ -926,7 +925,7 @@ nsresult nsAccessibleEditableText::FireTextChangeEvent(AtkTextChange *aTextData)
#ifdef DEBUG
printf(" [start=%d, length=%d, add=%d]\n", aTextData->start, aTextData->length, aTextData->add);
#endif
privAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_TEXT_CHANGE, accessible, aTextData);
privAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_ATK_TEXT_CHANGE, accessible, aTextData);
}
return NS_OK;

View File

@ -102,13 +102,13 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
AtkTableChange * pAtkTableChange = nsnull;
switch (aEvent) {
case nsIAccessibleEventReceiver::EVENT_FOCUS:
case nsIAccessibleEvent::EVENT_FOCUS:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
atk_focus_tracker_notify(accWrap->GetAtkObject());
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_STATE_CHANGE:
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
AtkStateChange *pAtkStateChange;
AtkStateType atkState;
@ -138,7 +138,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
* More complex than I ever thought.
* Need handle them separately.
*/
case nsIAccessibleEventReceiver::EVENT_ATK_PROPERTY_CHANGE :
case nsIAccessibleEvent::EVENT_ATK_PROPERTY_CHANGE :
AtkPropertyChange *pAtkPropChange;
AtkPropertyValues values;
@ -202,14 +202,14 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
break;
case nsIAccessibleEventReceiver::EVENT_ATK_SELECTION_CHANGE:
case nsIAccessibleEvent::EVENT_ATK_SELECTION_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_SELECTION_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TEXT_CHANGE:
case nsIAccessibleEvent::EVENT_ATK_TEXT_CHANGE:
AtkTextChange *pAtkTextChange;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_CHANGE\n"));
@ -225,14 +225,14 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TEXT_SELECTION_CHANGE:
case nsIAccessibleEvent::EVENT_ATK_TEXT_SELECTION_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_SELECTION_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"text_selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TEXT_CARET_MOVE:
case nsIAccessibleEvent::EVENT_ATK_TEXT_CARET_MOVE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_CARET_MOVE\n"));
if (!aEventData)
break;
@ -245,14 +245,14 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_MODEL_CHANGE:
case nsIAccessibleEvent::EVENT_ATK_TABLE_MODEL_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_MODEL_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"model_changed");
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_ROW_INSERT:
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_INSERT:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_INSERT\n"));
if (!aEventData)
break;
@ -268,7 +268,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_ROW_DELETE:
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_DELETE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_DELETE\n"));
if (!aEventData)
break;
@ -284,14 +284,14 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_ROW_REORDER:
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_REORDER\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"row_reordered");
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_COLUMN_INSERT:
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_INSERT:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_INSERT\n"));
if (!aEventData)
break;
@ -307,7 +307,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_COLUMN_DELETE:
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_DELETE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_DELETE\n"));
if (!aEventData)
break;
@ -323,14 +323,14 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_TABLE_COLUMN_REORDER:
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_REORDER\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"column_reordered");
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_ATK_VISIBLE_DATA_CHANGE:
case nsIAccessibleEvent::EVENT_ATK_VISIBLE_DATA_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_VISIBLE_DATA_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"visible_data_changed");
@ -345,7 +345,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
break;
// Is a superclass of ATK event children_changed
case nsIAccessibleEventReceiver::EVENT_REORDER:
case nsIAccessibleEvent::EVENT_REORDER:
AtkChildrenChange *pAtkChildrenChange;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_REORDER(children_change)\n"));
@ -379,7 +379,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
* following two event.
* Need more verification by AT test.
*/
case nsIAccessibleEventReceiver::EVENT_MENUSTART:
case nsIAccessibleEvent::EVENT_MENUSTART:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUSTART\n"));
atk_focus_tracker_notify(accWrap->GetAtkObject());
g_signal_emit_by_name(accWrap->GetAtkObject(),
@ -387,7 +387,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
rv = NS_OK;
break;
case nsIAccessibleEventReceiver::EVENT_MENUEND:
case nsIAccessibleEvent::EVENT_MENUEND:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUEND\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"selection_changed");

View File

@ -319,11 +319,6 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell,
*aRootAcc = new nsRootAccessibleWrap(rootNode, weakShell);
}
nsCOMPtr<nsIAccessibleEventReceiver> eventReceiver =
do_QueryInterface(*aRootAcc);
NS_ASSERTION(eventReceiver, "Doc accessible does not receive events");
eventReceiver->AddEventListeners();
nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(*aRootAcc));
privateAccessNode->Init();

View File

@ -972,9 +972,7 @@ NS_IMETHODIMP nsAccessible::AccTakeFocus()
if (!content) {
return NS_ERROR_FAILURE;
}
content->SetFocus(nsCOMPtr<nsIPresContext>(GetPresContext()));
return NS_OK;
return content->SetFocus(nsCOMPtr<nsIPresContext>(GetPresContext()));
}
NS_IMETHODIMP nsAccessible::AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent)
@ -1415,26 +1413,26 @@ NS_IMETHODIMP nsAccessible::GetAccHelp(nsAString& _retval)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateRight (); */
NS_IMETHODIMP nsAccessible::AccNavigateRight(nsIAccessible **_retval)
/* nsIAccessible accGetFromRight(); */
NS_IMETHODIMP nsAccessible::AccGetFromRight(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateLeft (); */
NS_IMETHODIMP nsAccessible::AccNavigateLeft(nsIAccessible **_retval)
/* nsIAccessible accGetFromLeft(); */
NS_IMETHODIMP nsAccessible::AccGetFromLeft(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateUp (); */
NS_IMETHODIMP nsAccessible::AccNavigateUp(nsIAccessible **_retval)
/* nsIAccessible accGetFromAbove(); */
NS_IMETHODIMP nsAccessible::AccGetFromAbove(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateDown (); */
NS_IMETHODIMP nsAccessible::AccNavigateDown(nsIAccessible **_retval)
/* nsIAccessible accGetFromBelow(); */
NS_IMETHODIMP nsAccessible::AccGetFromBelow(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -58,9 +58,8 @@ class nsAccessibleEventData: public 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_IMETHOD GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
{NS_ADDREF(*aDocAccessible = mDocAccessible); return NS_OK;}
NS_IMETHOD GetEventData(void **aEventData) {*aEventData = mEventData; return NS_OK;}
private:
PRUint32 mEventType;

View File

@ -38,7 +38,7 @@
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsCaretAccessible.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIAccessibleEvent.h"
#include "nsICaret.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLBodyElement.h"
@ -157,8 +157,8 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
caret->GetCaretVisible(&visible);
if (visible != mVisible) {
mVisible = visible;
mRootAccessible->FireToolkitEvent(mVisible? nsIAccessibleEventReceiver::EVENT_SHOW:
nsIAccessibleEventReceiver::EVENT_HIDE, this, nsnull);
mRootAccessible->FireToolkitEvent(mVisible? nsIAccessibleEvent::EVENT_SHOW:
nsIAccessibleEvent::EVENT_HIDE, this, nsnull);
}
nsCOMPtr<nsIPresContext> presContext;
@ -191,7 +191,7 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
#ifndef MOZ_ACCESSIBILITY_ATK
if (visible) {
mRootAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_LOCATION_CHANGE, this, nsnull);
mRootAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_LOCATION_CHANGE, this, nsnull);
}
#else
nsCOMPtr<nsIDOMNode> focusNode;
@ -230,11 +230,11 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
if (isCollapsed) {
PRInt32 caretOffset;
domSel->GetFocusOffset(&caretOffset);
mRootAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_TEXT_CARET_MOVE, accessible, &caretOffset);
mRootAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_ATK_TEXT_CARET_MOVE, accessible, &caretOffset);
}
else {
//Current text interface doesn't support this event yet
//mListener->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_TEXT_SELECTION_CHANGE, accessible, nsnull);
//mListener->FireToolkitEvent(nsIAccessibleEvent::EVENT_ATK_TEXT_SELECTION_CHANGE, accessible, nsnull);
}
}
#endif

View File

@ -122,7 +122,6 @@ nsDocAccessible::~nsDocAccessible()
NS_INTERFACE_MAP_BEGIN(nsDocAccessible)
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
NS_INTERFACE_MAP_ENTRY(nsPIAccessibleDocument)
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIDOMMutationListener)
NS_INTERFACE_MAP_ENTRY(nsIScrollPositionListener)
@ -134,19 +133,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsBlockAccessible)
NS_IMPL_ADDREF_INHERITED(nsDocAccessible, nsBlockAccessible)
NS_IMPL_RELEASE_INHERITED(nsDocAccessible, nsBlockAccessible)
NS_IMETHODIMP nsDocAccessible::AddEventListeners()
{
AddContentDocListeners();
return NS_OK;
}
/* void removeAccessibleEventListener (); */
NS_IMETHODIMP nsDocAccessible::RemoveEventListeners()
{
RemoveContentDocListeners();
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::GetAccName(nsAString& aAccName)
{
return GetTitle(aAccName);
@ -249,7 +235,7 @@ NS_IMETHODIMP nsDocAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAStr
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsDocAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAccessible)
NS_IMETHODIMP nsDocAccessible::GetCaretAccessible(nsIAccessible **aCaretAccessible)
{
// We only have a caret accessible on the root document
*aCaretAccessible = nsnull;
@ -369,6 +355,7 @@ NS_IMETHODIMP nsDocAccessible::Init()
}
}
}
AddEventListeners();
return nsBlockAccessible::Init();
}
@ -474,7 +461,7 @@ void nsDocAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
}
void nsDocAccessible::AddContentDocListeners()
nsresult nsDocAccessible::AddEventListeners()
{
// 1) Set up scroll position listener
// 2) Set up web progress listener - we need to know
@ -485,15 +472,13 @@ void nsDocAccessible::AddContentDocListeners()
// Do this only for top level content documents
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
if (!presShell)
return;
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsISupports> container;
mDocument->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
if (!docShellTreeItem)
return;
NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
// Make sure we're a content docshell
// We don't want to listen to chrome progress
@ -521,18 +506,16 @@ void nsDocAccessible::AddContentDocListeners()
docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(topOfContentTree));
if (topOfContentTree != docShellTreeItem) {
mBusy = eBusyStateDone;
return;
return NS_OK;
}
}
nsCOMPtr<nsIPresContext> context;
presShell->GetPresContext(getter_AddRefs(context));
if (!context)
return;
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
mWebProgress = do_GetInterface(docShellTreeItem);
if (!mWebProgress)
return;
NS_ENSURE_TRUE(mWebProgress, NS_ERROR_FAILURE);
mWebProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_LOCATION |
nsIWebProgress::NOTIFY_STATE_DOCUMENT);
@ -576,9 +559,11 @@ void nsDocAccessible::AddContentDocListeners()
rv = target->AddEventListener(NS_LITERAL_STRING("DOMNodeRemovedFromDocument"),
this, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
return rv;
}
void nsDocAccessible::RemoveContentDocListeners()
nsresult nsDocAccessible::RemoveEventListeners()
{
// Remove listeners associated with content documents
@ -616,8 +601,7 @@ void nsDocAccessible::RemoveContentDocListeners()
nsCOMPtr<nsISupports> container;
mDocument->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
if (!docShellTreeItem)
return;
NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
PRInt32 itemType;
docShellTreeItem->GetItemType(&itemType);
@ -627,6 +611,8 @@ void nsDocAccessible::RemoveContentDocListeners()
commandManager->RemoveCommandObserver(this, "obs_documentCreated");
}
}
return NS_OK;
}
void nsDocAccessible::FireDocLoadFinished()
@ -639,7 +625,7 @@ void nsDocAccessible::FireDocLoadFinished()
if (mBusy != eBusyStateDone) {
#ifndef MOZ_ACCESSIBILITY_ATK
FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, this, nsnull);
FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, this, nsnull);
#endif
}
}
@ -669,7 +655,7 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
// We only want to fire accessibilty scroll event when scrolling stops or pauses
// Therefore, we wait for no scroll events to occur between 2 ticks of this timer
// That indicates a pause in scrolling, so we fire the accessibilty scroll event
docAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_SCROLLINGEND, docAcc, nsnull);
docAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_SCROLLINGEND, docAcc, nsnull);
docAcc->mScrollPositionChangedTicks = 0;
if (docAcc->mScrollWatchTimer) {
docAcc->mScrollWatchTimer->Cancel();
@ -766,13 +752,13 @@ NS_IMETHODIMP nsDocAccessible::OnLocationChange(nsIWebProgress *aWebProgress,
mBusy = eBusyStateLoading;
// Fire a "new doc has started to load" event
#ifndef MOZ_ACCESSIBILITY_ATK
FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, this, nsnull);
FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, this, nsnull);
#else
AtkChildrenChange childrenData;
childrenData.index = -1;
childrenData.child = 0;
childrenData.add = PR_FALSE;
FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_REORDER , this, &childrenData);
FireToolkitEvent(nsIAccessibleEvent::EVENT_REORDER , this, &childrenData);
#endif
}
@ -838,7 +824,7 @@ void nsDocAccessible::GetEventDocAccessible(nsIDOMNode *aNode,
// ---------- Mutation event listeners ------------
NS_IMETHODIMP nsDocAccessible::NodeInserted(nsIDOMEvent* aEvent)
{
HandleMutationEvent(aEvent, nsIAccessibleEventReceiver::EVENT_CREATE);
HandleMutationEvent(aEvent, nsIAccessibleEvent::EVENT_CREATE);
return NS_OK;
}
@ -847,14 +833,14 @@ NS_IMETHODIMP nsDocAccessible::NodeRemoved(nsIDOMEvent* aEvent)
{
// The related node for the event will be the parent of the removed node or subtree
HandleMutationEvent(aEvent, nsIAccessibleEventReceiver::EVENT_DESTROY);
HandleMutationEvent(aEvent, nsIAccessibleEvent::EVENT_DESTROY);
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::SubtreeModified(nsIDOMEvent* aEvent)
{
HandleMutationEvent(aEvent, nsIAccessibleEventReceiver::EVENT_REORDER);
HandleMutationEvent(aEvent, nsIAccessibleEvent::EVENT_REORDER);
return NS_OK;
}
@ -1005,7 +991,7 @@ void nsDocAccessible::HandleMutationEvent(nsIDOMEvent *aEvent, PRUint32 aAccessi
if (!targetNode) {
targetNode = subTreeToInvalidate;
}
else if (aAccessibleEventType == nsIAccessibleEventReceiver::EVENT_REORDER) {
else if (aAccessibleEventType == nsIAccessibleEvent::EVENT_REORDER) {
subTreeToInvalidate = targetNode; // targetNode is parent for DOMNodeRemoved event
}
@ -1032,7 +1018,7 @@ void nsDocAccessible::HandleMutationEvent(nsIDOMEvent *aEvent, PRUint32 aAccessi
#ifdef XP_WIN
// Windows MSAA clients crash if they listen to create or destroy events
aAccessibleEventType = nsIAccessibleEventReceiver::EVENT_REORDER;
aAccessibleEventType = nsIAccessibleEvent::EVENT_REORDER;
#endif
privateAccessible->FireToolkitEvent(aAccessibleEventType, accessible, nsnull);
}

View File

@ -42,7 +42,6 @@
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleDocument.h"
#include "nsPIAccessibleDocument.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIDocument.h"
#include "nsIDOMMutationListener.h"
#include "nsIEditor.h"
@ -60,7 +59,6 @@ const PRUint32 kDefaultCacheSize = 256;
class nsDocAccessible : public nsBlockAccessible,
public nsIAccessibleDocument,
public nsPIAccessibleDocument,
public nsIAccessibleEventReceiver,
public nsIWebProgressListener,
public nsIObserver,
public nsIDOMMutationListener,
@ -72,7 +70,6 @@ class nsDocAccessible : public nsBlockAccessible,
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEDOCUMENT
NS_DECL_NSPIACCESSIBLEDOCUMENT
NS_DECL_NSIACCESSIBLEEVENTRECEIVER
NS_DECL_NSIOBSERVER
public:
@ -109,8 +106,8 @@ class nsDocAccessible : public nsBlockAccessible,
protected:
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
virtual nsIFrame* GetFrame();
void AddContentDocListeners();
void RemoveContentDocListeners();
virtual nsresult AddEventListeners();
virtual nsresult RemoveEventListeners();
void AddScrollListener(nsIPresShell *aPresShell);
void RemoveScrollListener(nsIPresShell *aPresShell);
void FireDocLoadFinished();

View File

@ -72,7 +72,6 @@
#include "nsAccessibilityService.h"
#include "nsISelectionPrivate.h"
#include "nsICaret.h"
#include "nsIAccessibleCaret.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsAccessibleEventData.h"
#include "nsIDOMDocument.h"
@ -158,7 +157,7 @@ nsRootAccessible::GetChromeEventHandler(nsIDOMEventTarget **aChromeTarget)
NS_IF_ADDREF(*aChromeTarget);
}
NS_IMETHODIMP nsRootAccessible::AddEventListeners()
nsresult nsRootAccessible::AddEventListeners()
{
// use AddEventListener from the nsIDOMEventTarget interface
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
@ -193,8 +192,6 @@ NS_IMETHODIMP nsRootAccessible::AddEventListeners()
rv = target->AddEventListener(NS_LITERAL_STRING("DOMMenuBarInactive"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
AddContentDocListeners();
}
GetChromeEventHandler(getter_AddRefs(target));
@ -209,10 +206,10 @@ NS_IMETHODIMP nsRootAccessible::AddEventListeners()
if (!mCaretAccessible)
mCaretAccessible = new nsCaretAccessible(mDOMNode, mWeakShell, this);
return NS_OK;
return nsDocAccessible::AddEventListeners();
}
NS_IMETHODIMP nsRootAccessible::RemoveEventListeners()
nsresult nsRootAccessible::RemoveEventListeners()
{
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
if (target) {
@ -233,7 +230,6 @@ NS_IMETHODIMP nsRootAccessible::RemoveEventListeners()
NS_STATIC_CAST(nsIDOMXULListener*, this),
PR_TRUE);
}
RemoveContentDocListeners();
if (mCaretAccessible) {
mCaretAccessible->RemoveSelectionListener();
@ -242,12 +238,12 @@ NS_IMETHODIMP nsRootAccessible::RemoveEventListeners()
mAccService = nsnull;
return NS_OK;
return nsDocAccessible::RemoveEventListeners();
}
NS_IMETHODIMP nsRootAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAccessible)
NS_IMETHODIMP nsRootAccessible::GetCaretAccessible(nsIAccessible **aCaretAccessible)
{
*aCaretAccessible = mCaretAccessible;
*aCaretAccessible = (nsCOMPtr<nsIAccessible>)do_QueryInterface(mCaretAccessible);
NS_IF_ADDREF(*aCaretAccessible);
return NS_OK;
}
@ -256,7 +252,7 @@ void nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *focusAccessible,
{
if (focusAccessible && focusNode && gLastFocusedNode != focusNode) {
nsCOMPtr<nsPIAccessible> privateFocusAcc(do_QueryInterface(focusAccessible));
privateFocusAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, focusAccessible, nsnull);
privateFocusAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS, focusAccessible, nsnull);
NS_IF_RELEASE(gLastFocusedNode);
PRUint32 role = ROLE_NOTHING;
focusAccessible->GetAccRole(&role);
@ -365,7 +361,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (treeItemAccessible && (eventType.EqualsIgnoreCase("DOMMenuItemActive") ||
eventType.EqualsIgnoreCase("select"))) {
privAcc = do_QueryInterface(treeItemAccessible);
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
treeItemAccessible, nsnull);
return NS_OK;
}
@ -397,7 +393,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
FireAccessibleFocusEvent(accessible, targetNode);
}
else if (eventType.EqualsIgnoreCase("CheckboxStateChange")) {
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE,
accessible, nsnull);
}
else if (eventType.EqualsIgnoreCase("RadioStateChange") ) {
@ -405,19 +401,19 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (targetNode &&
NS_SUCCEEDED(mAccService->GetAccessibleInShell(targetNode, eventShell,
getter_AddRefs(accessible)))) {
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE,
accessible, nsnull);
FireAccessibleFocusEvent(accessible, targetNode);
}
else { // for the html radio buttons -- apparently the focus code just works. :-)
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE,
accessible, nsnull);
}
}
else if (eventType.EqualsIgnoreCase("DOMMenuBarActive"))
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUSTART, accessible, nsnull);
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_MENUSTART, accessible, nsnull);
else if (eventType.EqualsIgnoreCase("DOMMenuBarInactive")) {
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUEND, accessible, nsnull);
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_MENUEND, accessible, nsnull);
GetAccFocused(getter_AddRefs(accessible));
if (accessible) {
accessible->AccGetDOMNode(getter_AddRefs(targetNode));
@ -428,9 +424,9 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
// Menu popup events
PRUint32 menuEvent = 0;
if (eventType.EqualsIgnoreCase("popupshowing"))
menuEvent = nsIAccessibleEventReceiver::EVENT_MENUPOPUPSTART;
menuEvent = nsIAccessibleEvent::EVENT_MENUPOPUPSTART;
else if (eventType.EqualsIgnoreCase("popuphiding"))
menuEvent = nsIAccessibleEventReceiver::EVENT_MENUPOPUPEND;
menuEvent = nsIAccessibleEvent::EVENT_MENUPOPUPEND;
if (menuEvent) {
PRUint32 role = ROLE_NOTHING;
accessible->GetAccRole(&role);
@ -444,7 +440,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
eventType.EqualsIgnoreCase("DOMMenuItemActive")) {
if (treeItemAccessible) { // use focused treeitem
privAcc = do_QueryInterface(treeItemAccessible);
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
treeItemAccessible, nsnull);
}
else if (anchorElement) {
@ -452,7 +448,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (hyperText) {
PRInt32 selectedLink;
hyperText->GetSelectedLinkIndex(&selectedLink);
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_LINK_SELECTED, accessible, &selectedLink);
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_ATK_LINK_SELECTED, accessible, &selectedLink);
}
}
else if (optionTargetNode && // use focused option
@ -466,7 +462,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (treeBox && treeIndex >= 0) // it's a XUL <tree>
// use EVENT_FOCUS instead of EVENT_ATK_SELECTION_CHANGE
privAcc = do_QueryInterface(treeItemAccessible);
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS,
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
treeItemAccessible, nsnull);
}
else if (eventType.EqualsIgnoreCase("CheckboxStateChange") || // it's a XUL <checkbox>
@ -474,7 +470,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
accessible->GetAccState(&stateData.state);
stateData.enable = (stateData.state & STATE_CHECKED) != 0;
stateData.state = STATE_CHECKED;
privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, &stateData);
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, accessible, &stateData);
if (eventType.EqualsIgnoreCase("RadioStateChange")) {
FireAccessibleFocusEvent(accessible, targetNode);
}

View File

@ -42,12 +42,12 @@
#include "nsDocAccessibleWrap.h"
#include "nsHashtable.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocument.h"
#include "nsIDOMFocusListener.h"
#include "nsIDOMFormListener.h"
#include "nsIDOMXULListener.h"
#include "nsIAccessibleCaret.h"
class nsIAccessibleEventListener;
@ -59,7 +59,6 @@ class nsRootAccessible : public nsDocAccessibleWrap,
public nsIDOMXULListener
{
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEEVENTRECEIVER
public:
nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
@ -94,7 +93,7 @@ class nsRootAccessible : public nsDocAccessibleWrap,
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent);
// nsIAccessibleDocument
NS_IMETHOD GetCaretAccessible(nsIAccessibleCaret **aAccessibleCaret);
NS_IMETHOD GetCaretAccessible(nsIAccessible **aAccessibleCaret);
// nsIAccessNode
NS_IMETHOD Shutdown();
@ -102,6 +101,8 @@ class nsRootAccessible : public nsDocAccessibleWrap,
void ShutdownAll();
protected:
nsresult AddEventListeners();
nsresult RemoveEventListeners();
static void GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNode);
void FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode);
void GetEventShell(nsIDOMNode *aNode, nsIPresShell **aEventShell);

View File

@ -50,6 +50,7 @@
#include "nsIListControlFrame.h"
#include "nsIServiceManager.h"
#include "nsITextContent.h"
#include "nsArray.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
@ -113,7 +114,7 @@ void nsHTMLSelectableAccessible::iterator::CalcSelectionCount(PRInt32 *aSelectio
}
void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibilityService *aAccService,
nsISupportsArray *aSelectedAccessibles,
nsIMutableArray *aSelectedAccessibles,
nsIPresContext *aContext)
{
PRBool isSelected = PR_FALSE;
@ -128,7 +129,7 @@ void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibil
}
if (tempAccess)
aSelectedAccessibles->AppendElement(tempAccess);
aSelectedAccessibles->AppendElement(NS_STATIC_CAST(nsISupports*, tempAccess), PR_FALSE);
}
PRBool nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
@ -190,15 +191,16 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint
return NS_ERROR_FAILURE;
tempOption->GetSelected(aSelState);
nsresult rv = NS_OK;
if (eSelection_Add == aMethod && !(*aSelState))
tempOption->SetSelected(PR_TRUE);
rv = tempOption->SetSelected(PR_TRUE);
else if (eSelection_Remove == aMethod && (*aSelState))
tempOption->SetSelected(PR_FALSE);
return NS_OK;
rv = tempOption->SetSelected(PR_FALSE);
return rv;
}
// Interface methods
NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsISupportsArray **_retval)
NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsIArray **_retval)
{
*_retval = nsnull;
@ -206,8 +208,8 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsISupportsArray *
if (!accService)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupportsArray> selectedAccessibles;
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
nsCOMPtr<nsIMutableArray> selectedAccessibles;
NS_NewArray(getter_AddRefs(selectedAccessibles));
if (!selectedAccessibles)
return NS_ERROR_OUT_OF_MEMORY;
@ -220,8 +222,8 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsISupportsArray *
iter.AddAccessibleIfSelected(accService, selectedAccessibles, context);
PRUint32 uLength = 0;
selectedAccessibles->Count(&uLength);
if (uLength != 0) { // length of nsISupportsArray containing selected options
selectedAccessibles->GetLength(&uLength);
if (uLength != 0) { // length of nsIArray containing selected options
*_retval = selectedAccessibles;
NS_ADDREF(*_retval);
}

View File

@ -104,7 +104,9 @@ protected:
void CalcSelectionCount(PRInt32 *aSelectionCount);
void Select(PRBool aSelect);
void AddAccessibleIfSelected(nsIAccessibilityService *aAccService, nsISupportsArray *aSelectedAccessibles, nsIPresContext *aContext);
void AddAccessibleIfSelected(nsIAccessibilityService *aAccService,
nsIMutableArray *aSelectedAccessibles,
nsIPresContext *aContext);
PRBool GetAccessibleIfSelected(PRInt32 aIndex, nsIAccessibilityService *aAccService, nsIPresContext *aContext, nsIAccessible **_retval);
PRBool Advance();

View File

@ -39,6 +39,7 @@
#include "nsAccessibleWrap.h"
#include "nsIAccessibleSelectable.h"
#include "nsIAccessibleWin32Object.h"
#include "nsArray.h"
// for the COM IEnumVARIANT solution in get_AccSelection()
#define _ATLBASE_IMPL
@ -423,23 +424,21 @@ STDMETHODIMP nsAccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
if (select) { // do we have an nsIAccessibleSelectable?
// we have an accessible that can have children selected
nsCOMPtr<nsISupportsArray> selectedOptions;
nsCOMPtr<nsIArray> selectedOptions;
// gets the selected options as nsIAccessibles.
select->GetSelectedChildren(getter_AddRefs(selectedOptions));
if (selectedOptions) { // false if the select has no children or none are selected
PRUint32 length;
selectedOptions->Count(&length);
selectedOptions->GetLength(&length);
CComVariant* optionArray = new CComVariant[length]; // needs to be a CComVariant to go into the EnumeratorType object
// 1) Populate an array to store in the enumeration
for (PRUint32 i = 0 ; i < length ; i++) {
nsCOMPtr<nsISupports> tempOption;
selectedOptions->GetElementAt(i,getter_AddRefs(tempOption)); // this expects an nsISupports
if (tempOption) {
nsCOMPtr<nsIAccessible> tempAccess(do_QueryInterface(tempOption));
if ( tempAccess ) {
optionArray[i] = NativeAccessible(tempAccess);
}
nsCOMPtr<nsIAccessible> tempAccess;
selectedOptions->QueryElementAt(i, NS_GET_IID(nsIAccessible),
getter_AddRefs(tempAccess));
if (tempAccess) {
optionArray[i] = NativeAccessible(tempAccess);
}
}
@ -541,7 +540,7 @@ STDMETHODIMP nsAccessibleWrap::accNavigate(
switch(navDir) {
case NAVDIR_DOWN:
xpAccessibleStart->AccNavigateDown(getter_AddRefs(xpAccessibleResult));
xpAccessibleStart->AccGetFromBelow(getter_AddRefs(xpAccessibleResult));
break;
case NAVDIR_FIRSTCHILD:
xpAccessibleStart->GetAccFirstChild(getter_AddRefs(xpAccessibleResult));
@ -550,7 +549,7 @@ STDMETHODIMP nsAccessibleWrap::accNavigate(
xpAccessibleStart->GetAccLastChild(getter_AddRefs(xpAccessibleResult));
break;
case NAVDIR_LEFT:
xpAccessibleStart->AccNavigateLeft(getter_AddRefs(xpAccessibleResult));
xpAccessibleStart->AccGetFromLeft(getter_AddRefs(xpAccessibleResult));
break;
case NAVDIR_NEXT:
xpAccessibleStart->GetAccNextSibling(getter_AddRefs(xpAccessibleResult));
@ -559,10 +558,10 @@ STDMETHODIMP nsAccessibleWrap::accNavigate(
xpAccessibleStart->GetAccPreviousSibling(getter_AddRefs(xpAccessibleResult));
break;
case NAVDIR_RIGHT:
xpAccessibleStart->AccNavigateRight(getter_AddRefs(xpAccessibleResult));
xpAccessibleStart->AccGetFromRight(getter_AddRefs(xpAccessibleResult));
break;
case NAVDIR_UP:
xpAccessibleStart->AccNavigateUp(getter_AddRefs(xpAccessibleResult));
xpAccessibleStart->AccGetFromAbove(getter_AddRefs(xpAccessibleResult));
break;
}

View File

@ -38,7 +38,7 @@
#include "nsDocAccessibleWrap.h"
#include "ISimpleDOMDocument_i.c"
#include "nsIAccessibleEventReceiver.h"
#include "nsIAccessibleEvent.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIWidget.h"
@ -166,7 +166,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessib
// Remove this until we can figure out which focus events are coming at
// the same time as native window focus events, although
// perhaps 2 duplicate focus events on the window isn't really a problem
if (aEvent == EVENT_FOCUS) {
if (aEvent == nsIAccessibleEvent::EVENT_FOCUS) {
// Don't fire accessible focus event for documents,
// Microsoft Windows will generate those from native window focus events
nsCOMPtr<nsIAccessibleDocument> accessibleDoc(do_QueryInterface(aAccessible));
@ -185,15 +185,15 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessib
else
childID = GetChildIDFor(aAccessible); // get the id for the accessible
if (role == ROLE_SYSTEM_PANE && aEvent == EVENT_STATE_CHANGE) {
if (role == ROLE_SYSTEM_PANE && aEvent == nsIAccessibleEvent::EVENT_STATE_CHANGE) {
// Something on the document has changed
// Clear out the cache in this subtree
}
HWND hWnd = NS_REINTERPRET_CAST(HWND, mWnd);
if (gmGetGUIThreadInfo && (aEvent == EVENT_FOCUS ||
aEvent == EVENT_MENUPOPUPSTART ||
aEvent == EVENT_MENUPOPUPEND)) {
if (gmGetGUIThreadInfo && (aEvent == nsIAccessibleEvent::EVENT_FOCUS ||
aEvent == nsIAccessibleEvent::EVENT_MENUPOPUPSTART ||
aEvent == nsIAccessibleEvent::EVENT_MENUPOPUPEND)) {
GUITHREADINFO guiInfo;
guiInfo.cbSize = sizeof(GUITHREADINFO);
if (gmGetGUIThreadInfo(NULL, &guiInfo)) {

View File

@ -39,7 +39,6 @@
#include "nsRootAccessibleWrap.h"
#include "nsIAccessible.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"

View File

@ -43,6 +43,7 @@
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIServiceManager.h"
#include "nsArray.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
@ -103,23 +104,24 @@ NS_IMETHODIMP nsXULSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint8
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
if (xulSelect) {
nsresult rv = NS_OK;
PRInt32 selIndex;
xulSelect->GetSelectedIndex(&selIndex);
if (selIndex == aIndex)
*aSelState = PR_TRUE;
if (eSelection_Add == aMethod && !(*aSelState))
xulSelect->SetSelectedIndex(aIndex);
rv = xulSelect->SetSelectedIndex(aIndex);
else if (eSelection_Remove == aMethod && (*aSelState)) {
xulSelect->SetSelectedIndex(-1);
rv = xulSelect->SetSelectedIndex(-1);
}
return NS_OK;
return rv;
}
return NS_ERROR_FAILURE;
}
// Interface methods
NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsISupportsArray **_retval)
NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsIArray **_retval)
{
*_retval = nsnull;
@ -127,8 +129,8 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsISupportsArray **
if (!accService)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupportsArray> selectedAccessibles;
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
nsCOMPtr<nsIMutableArray> selectedAccessibles;
NS_NewArray(getter_AddRefs(selectedAccessibles));
if (!selectedAccessibles)
return NS_ERROR_OUT_OF_MEMORY;
@ -144,13 +146,13 @@ NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsISupportsArray **
nsCOMPtr<nsIDOMNode> tempDOMNode (do_QueryInterface(tempNode));
accService->GetAccessibleInWeakShell(tempDOMNode, mWeakShell, getter_AddRefs(tempAccessible));
if (tempAccessible)
selectedAccessibles->AppendElement(tempAccessible);
selectedAccessibles->AppendElement(tempAccessible, PR_FALSE);
}
}
PRUint32 uLength = 0;
selectedAccessibles->Count(&uLength);
if (uLength != 0) { // length of nsISupportsArray containing selected options
selectedAccessibles->GetLength(&uLength);
if (uLength != 0) { // length of nsIArray containing selected options
*_retval = selectedAccessibles;
NS_ADDREF(*_retval);
}

View File

@ -41,6 +41,7 @@
#include "nsIDOMXULElement.h"
#include "nsITreeSelection.h"
#include "nsXULTreeAccessible.h"
#include "nsArray.h"
#ifdef MOZ_ACCESSIBILITY_ATK
#include "nsIAccessibleTable.h"
@ -197,7 +198,7 @@ NS_IMETHODIMP nsXULTreeAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
}
// Ask treeselection to get all selected children
NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsISupportsArray **_retval)
NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsIArray **_retval)
{
*_retval = nsnull;
@ -207,8 +208,8 @@ NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsISupportsArray **_retva
mTree->GetSelection(getter_AddRefs(selection));
if (!selection)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupportsArray> selectedAccessibles;
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
nsCOMPtr<nsIMutableArray> selectedAccessibles;
NS_NewArray(getter_AddRefs(selectedAccessibles));
if (!selectedAccessibles)
return NS_ERROR_OUT_OF_MEMORY;
@ -222,12 +223,12 @@ NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsISupportsArray **_retva
tempAccess = new nsXULTreeitemAccessible(this, mDOMNode, mWeakShell, rowIndex);
if (!tempAccess)
return NS_ERROR_OUT_OF_MEMORY;
selectedAccessibles->AppendElement(tempAccess);
selectedAccessibles->AppendElement(tempAccess, PR_FALSE);
}
}
PRUint32 length;
selectedAccessibles->Count(&length);
selectedAccessibles->GetLength(&length);
if (length != 0) {
*_retval = selectedAccessibles;
NS_IF_ADDREF(*_retval);
@ -260,7 +261,7 @@ NS_IMETHODIMP nsXULTreeAccessible::ChangeSelection(PRInt32 aIndex, PRUint8 aMeth
selection->IsSelected(aIndex, aSelState);
if ((!(*aSelState) && eSelection_Add == aMethod) ||
((*aSelState) && eSelection_Remove == aMethod))
selection->ToggleSelect(aIndex);
return selection->ToggleSelect(aIndex);
}
return NS_OK;

View File

@ -86,7 +86,6 @@
#include "winable.h"
#include "nsIAccessible.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleCaret.h"
#include "nsIAccessNode.h"
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x03d
@ -4388,11 +4387,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
else if (lParam == OBJID_CARET) { // each root accessible owns a caret accessible
nsCOMPtr<nsIAccessibleDocument> accDoc(do_QueryInterface(mRootAccessible));
if (accDoc) {
nsCOMPtr<nsIAccessibleCaret> accessibleCaret;
nsCOMPtr<nsIAccessible> accessibleCaret;
accDoc->GetCaretAccessible(getter_AddRefs(accessibleCaret));
nsCOMPtr<nsIAccessible> xpAccessible(do_QueryInterface(accessibleCaret));
if (xpAccessible) {
xpAccessible->GetNativeInterface((void**)&msaaAccessible);
if (accessibleCaret) {
accessibleCaret->GetNativeInterface((void**)&msaaAccessible);
}
}
}