Bug 1681980 [wpt PR 26856] - Update wpt metadata, a=testonly
[gecko.git] / accessible / interfaces / nsIAccessible.idl
blobaadd0402dc0d44fed6616dcef9a6e93b93c9a3c3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
7 #include "nsIArray.idl"
9 interface nsIPersistentProperties;
10 interface nsIAccessibleDocument;
11 interface nsIAccessibleRelation;
13 webidl Node;
15 %{C++
16 namespace mozilla {
17 namespace a11y {
18 class Accessible;
23 /**
24 * A cross-platform interface that supports platform-specific
25 * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
26 * to support IAccessible as well as ATK's generic accessibility objects.
27 * Can also be used by in-process accessibility clients to get information
28 * about objects in the accessible tree. The accessible tree is a subset of
29 * nodes in the DOM tree -- such as documents, focusable elements and text.
30 * Mozilla creates the implementations of nsIAccessible on demand.
31 * See http://www.mozilla.org/projects/ui/accessibility for more information.
33 [scriptable, builtinclass, uuid(de2869d9-563c-4943-996b-31a4daa4d097)]
34 interface nsIAccessible : nsISupports
36 /**
37 * Parent node in accessible tree.
39 readonly attribute nsIAccessible parent;
41 /**
42 * Next sibling in accessible tree
44 readonly attribute nsIAccessible nextSibling;
46 /**
47 * Previous sibling in accessible tree
49 readonly attribute nsIAccessible previousSibling;
51 /**
52 * First child in accessible tree
54 readonly attribute nsIAccessible firstChild;
56 /**
57 * Last child in accessible tree
59 readonly attribute nsIAccessible lastChild;
61 /**
62 * Array of all this element's children.
64 readonly attribute nsIArray children;
66 /**
67 * Number of accessible children
69 readonly attribute long childCount;
71 /**
72 * The 0-based index of this accessible in its parent's list of children,
73 * or -1 if this accessible does not have a parent.
75 readonly attribute long indexInParent;
77 /**
78 * The unique identifier of the accessible. ID is only guaranteed to be unique
79 * per document (Windows IDs are unique even across documents, but that is
80 * Windows specific and not exposed to core).
82 readonly attribute long long uniqueID;
84 /**
85 * The DOM node this nsIAccessible is associated with.
87 readonly attribute Node DOMNode;
89 /**
90 * For remote accessibles the id of the related DOM node.
92 readonly attribute AString id;
94 /**
95 * The document accessible that this access node resides in.
97 readonly attribute nsIAccessibleDocument document;
99 /**
100 * The root document accessible that this access node resides in.
102 readonly attribute nsIAccessibleDocument rootDocument;
105 * The language for the current DOM node, e.g. en, de, etc.
107 readonly attribute AString language;
110 * Accessible name -- the main text equivalent for this node. The name is
111 * specified by ARIA or by native markup. Example of ARIA markup is
112 * aria-labelledby attribute placed on element of this accessible. Example
113 * of native markup is HTML label linked with HTML element of this accessible.
115 * Value can be string or null. A null value indicates that AT may attempt to
116 * compute the name. Any string value, including the empty string, should be
117 * considered author-intentional, and respected.
119 readonly attribute AString name;
122 * Accessible value -- a number or a secondary text equivalent for this node
123 * Widgets that use role attribute can force a value using the valuenow attribute
125 readonly attribute AString value;
128 * Accessible description -- long text associated with this node
130 readonly attribute AString description;
133 * Provides localized string of accesskey name, such as Alt+D.
134 * The modifier may be affected by user and platform preferences.
135 * Usually alt+letter, or just the letter alone for menu items.
137 readonly attribute AString accessKey;
140 * Provides localized string of global keyboard accelerator for default
141 * action, such as Ctrl+O for Open file
143 readonly attribute AString keyboardShortcut;
146 * Enumerated accessible role (see the constants defined in nsIAccessibleRole).
148 * @note The values might depend on platform because of variations. Widgets
149 * can use ARIA role attribute to force the final role.
151 readonly attribute unsigned long role;
154 * Accessible states -- bit fields which describe boolean properties of node.
155 * Many states are only valid given a certain role attribute that supports
156 * them.
158 * @param aState - the first bit field (see nsIAccessibleStates::STATE_*
159 * constants)
160 * @param aExtraState - the second bit field
161 * (see nsIAccessibleStates::EXT_STATE_* constants)
163 void getState(out unsigned long aState, out unsigned long aExtraState);
166 * Help text associated with node
168 * @note As of now, this just returns empty string.
170 readonly attribute AString help;
173 * Focused accessible child of node
175 readonly attribute nsIAccessible focusedChild;
178 * Attributes of accessible
180 readonly attribute nsIPersistentProperties attributes;
183 * Platform specific interface for accessible
185 readonly attribute nsISupports nativeInterface;
188 * Returns grouping information. Used for tree items, list items, tab panel
189 * labels, radio buttons, etc. Also used for collectons of non-text objects.
191 * @param groupLevel - 1-based, similar to ARIA 'level' property
192 * @param similarItemsInGroup - 1-based, similar to ARIA 'setsize' property,
193 * inclusive of the current item
194 * @param positionInGroup - 1-based, similar to ARIA 'posinset' property
196 void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
197 out long aPositionInGroup);
200 * Accessible child which contains the coordinate at (x, y) in screen pixels.
201 * If the point is in the current accessible but not in a child, the
202 * current accessible will be returned.
203 * If the point is in neither the current accessible or a child, then
204 * null will be returned.
206 * @param x screen's x coordinate
207 * @param y screen's y coordinate
208 * @return the direct accessible child containing the given point
210 nsIAccessible getChildAtPoint(in long x, in long y);
213 * Deepest accessible child which contains the coordinate at (x, y) in screen
214 * pixels. If the point is in the current accessible but not in a child, the
215 * current accessible will be returned. If the point is in neither the current
216 * accessible or a child, then null will be returned.
218 * @param x screen's x coordinate
219 * @param y screen's y coordinate
220 * @return the deepest accessible child containing the given point
222 nsIAccessible getDeepestChildAtPoint(in long x, in long y);
225 * Like GetDeepestChildAtPoint, but restricted to the current process.
226 * If the point is within a remote document, the accessible for the browser
227 * element containing that document will be returned; i.e. this will not
228 * descend into the document. If called on an accessible inside a remote
229 * document, this will fail.
231 * @param x screen's x coordinate
232 * @param y screen's y coordinate
233 * @return the deepest accessible child in this process containing the given
234 * point
236 nsIAccessible getDeepestChildAtPointInProcess(in long x, in long y);
239 * Nth accessible child using zero-based index or last child if index less than zero
241 nsIAccessible getChildAt(in long aChildIndex);
244 * Return accessible relation by the given relation type (see.
245 * constants defined in nsIAccessibleRelation).
247 nsIAccessibleRelation getRelationByType(in unsigned long aRelationType);
250 * Returns multiple accessible relations for this object.
252 nsIArray getRelations();
255 * Return accessible's x and y coordinates relative to the screen and
256 * accessible's width and height in Dev pixels.
258 void getBounds(out long x, out long y, out long width, out long height);
261 * Return accessible's x and y coordinates relative to the screen and
262 * accessible's width and height in CSS pixels.
264 void getBoundsInCSSPixels(out long aX, out long aY, out long aWidth, out long aHeight);
267 * Add or remove this accessible to the current selection
269 void setSelected(in boolean isSelected);
272 * Select this accessible node only
274 void takeSelection();
277 * Focus this accessible node,
278 * The state STATE_FOCUSABLE indicates whether this node is normally focusable.
279 * It is the callers responsibility to determine whether this node is focusable.
280 * accTakeFocus on a node that is not normally focusable (such as a table),
281 * will still set focus on that node, although normally that will not be visually
282 * indicated in most style sheets.
284 void takeFocus();
287 * The number of accessible actions associated with this accessible
289 readonly attribute uint8_t actionCount;
292 * The name of the accessible action at the given zero-based index
294 AString getActionName(in uint8_t index);
297 * The description of the accessible action at the given zero-based index
299 AString getActionDescription(in uint8_t aIndex);
302 * Perform the accessible action at the given zero-based index
303 * Action number 0 is the default action
305 void doAction(in uint8_t index);
308 * Makes an object visible on screen.
310 * @param scrollType - defines where the object should be placed on
311 * the screen (see nsIAccessibleScrollType for
312 * available constants).
314 [can_run_script]
315 void scrollTo(in unsigned long aScrollType);
318 * Moves the top left of an object to a specified location.
320 * @param coordinateType [in] - specifies whether the coordinates are relative to
321 * the screen or the parent object (for available
322 * constants refer to nsIAccessibleCoordinateType)
323 * @param x [in] - defines the x coordinate
324 * @param y [in] - defines the y coordinate
326 void scrollToPoint(in unsigned long coordinateType, in long x, in long y);
329 * Dispatches an ANNOUNCEMENT event with this accessible as target.
331 * @param announcement [in] - string to use in announcement.
332 * @param priority [in] - priority for announcement, could be
333 * nsIAccessibleAnnouncementEvent.POLITE or
334 * nsIAccessibleAnnouncementEvent.ASSERTIVE.
336 void announce(in AString announcement, in unsigned short priority);
338 %{C++
339 virtual mozilla::a11y::Accessible* ToInternalAccessible() const = 0;