Introduction
To use MSAA with Gecko, you'll need the tools and docs that come with the Active Accessibility 2.0 SDK Tools. The method AccessibleObjectFromWindow()
will get you the root IAccessible corresponding to the top level window. Hold on to this root IAccessible, and use it to walk through the entire tree of IAccessible's.
IAccessible Overview
Refer to original specification to get more information about IAccessible
interface.
MSAA | Description | Gecko |
---|---|---|
accDoDefaultAction | Performs the specified object's default action | nsIAccessible.doAction() |
accHitTest | Retrieves the child element or child object at a given point on the screen | nsIAccessible.getChildAtPoint() |
accLocation | Retrieves the specified object's current screen location | nsIAccessible.getBounds() |
accNavigate | Traverses to another user interface (UI) element within a container and retrieves the object | complex mapping |
accSelect | Modifies the selection or moves the keyboard focus of the specified object | complex mapping |
get_accChild | Retrieves an IDispatch interface pointer for the specified child, if one exists | nsIAccessible.getChildAt() |
get_accChildCount | Retrieves the number of children that belong to this object. All objects must support this property | nsIAccessible.childCount |
get_accDefaultAction | Retrieves a string that describes the object's default action. | nsIAccessible.getActionName() |
get_accDescription | retrieves a string that describes the visual appearance of the specified object. | nsIAccessible.description |
get_accFocus | Returns the localized extended role | nsIAccessible.focusedChild |
get_accHelp | Retrieves an object's Help property string. | not supported |
get_accHelpTopic | Retrieves the full path of the WinHelp file associated with the specified object and the identifier of the appropriate topic within that file. | not supported |
get_accKeyboardShortcut | Retrieves the specified object's shortcut key or access key, also known as the mnemonic. | nsIAccessible.keyboardShortcut |
get_accName | Retrieves the name of the specified object. All objects support this property. | nsIAccessible.name |
get_accParent | Retrieves the IDispatch interface of the object's parent. | nsIAccessible.parent |
get_accRole | Retrieves information that describes the role of the specified object. | nsIAccessible.role |
get_accSelection | Retrieves the selected children of this object. | nsIAccessibleSelectable.getSelectedChildren() |
get_accState | Retrieves the current state of the specified object. | nsIAccessible.getStates() |
get_accValue | Retrieves the value of the specified object. | nsIAccessible.value |
IAccessible Details
accNavigate
Summary
Traverses to another user interface (UI) element within a container and retrieves the object (see MSDN: IAccessible::accNavigate).
HRESULT accNavigate( long navDir, VARIANT varStart, VARIANT* pvarEnd );
The traversed object depends on the given constant navDir
. Refer to the supported constants.
accSelect
Summary
Modifies the selection or moves the keyboard focus of the specified object (see MSDN: IAccessible::accSelect).
HRESULT accSelect( long flagsSelect, VARIANT varID );
Implementation
Depending on flagsSelect
argument (see MSDN: SELFLAG) the method is mapped to Gecko methods by the following way:
flagsSelect | Description | Gecko |
---|---|---|
SELFLAG_TAKEFOCUS | Sets the focus to the object | nsIAccessible.takeFocus() |
SELFLAG_TAKESELECTION | Selects the object and removes the selection from all other objects in the container. | nsIAccessible.takeSelection() |
SELFLAG_ADDSELECTION | Adds the object to the current selection | nsIAccessible.setSelected() |
SELFLAG_REMOVESELECTION | Removes the object from the current selection | nsIAccessible.setSelected() |
SELFLAG_EXTENDSELECTION | Alters the selection so that all objects between the selection anchor and this object take on the anchor object's selection state. | nsIAccessible.extendSelection() |
get_accName
Summary
Retrieves the name of the specified object (see MSDN: IAccessible::get_accName).
HRESULT get_accName( VARIANT varID, BSTR* pszName );
Return values
- If there is not name
S_OK
and*pszName == NULL
- For example, when
alt
attribute isn't presented andtitle
or ARIA attributes aren't specified or empty onhtml:img
element.
- If there is a name (possibly empty)
S_OK
and*pszName != NULL
- The empty name means we allocate the string by
SysAllocStringLen("", 0)
method. You can get empty name, when, for example,html:img
has onlyalt
attribute with empty value (<img alt = "" >
).
- If error occured
E_FAIL