1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The <code>chrome.automation</code> API allows developers to access the
// automation (accessibility) tree for the browser. This is a tree
// representation, analogous to the DOM tree, which represents the
// <em>semantic</em> structure of a page, and can be used to programmatically
// interact with a page.
[nocompile] namespace automation {
dictionary Rect {
long left;
long top;
long width;
long height;
};
// An event in the Automation tree.
[nocompile] dictionary AutomationEvent {
// The $(ref:automation.AutomationNode) to which the event was targeted.
AutomationNode target;
// The type of the event.
DOMString type;
// Prevents all other event listeners from being triggered for this event
// dispatch.
static void stopPropagation();
};
// A listener for events on an <code>AutomationNode</code>.
callback AutomationListener = void(AutomationEvent event);
// A single node in an Automation tree.
[nocompile] dictionary AutomationNode {
// The root node of the tree containing this AutomationNode.
AutomationRootNode root;
// Whether this AutomationNode is an AutomationRootNode.
bool isRootNode;
// Unique ID to identify this node.
long id;
// The role of this node, e.g. button, static text etc.
DOMString role;
// The state of this node, e.g. {pressed": true, "inactive": true} etc.
object state;
// The rendered location (as a bounding box) of this node within the frame.
Rect location;
// A collection of this node's other attributes.
// TODO(aboxhall): Create and use combined list of attributes from
// AXStringAttribute, AXIntAttribute etc.
object? attributes;
// The index of this node in its parent node's list of children. If this is
// the root node, this will be undefined.
long? indexInParent;
// Traversal.
static object[] children();
static object parent();
static object firstChild();
static object lastChild();
static object previousSibling();
static object nextSibling();
// Actions.
static void doDefault();
static void focus();
static void makeVisible();
static void setSelection(long startIndex, long endIndex);
// Events.
static void addEventListener(
DOMString eventType, AutomationListener listener, bool capture);
static void removeEventListener(
DOMString eventType, AutomationListener listener, bool capture);
};
// The root node of the automation tree for a single frame or desktop.
// This may be:
// <ul>
// <li> The desktop
// <li> The top frame of a page
// <li> A frame or iframe within a page
// </ul>
// Thus, an <code>AutomationRootNode</code> may be a descendant of one or
// more <code>AutomationRootNode</code>s, and in turn have one or more
// <code>AutomationRootNode</code>s in its descendants. Thus, the
// <code>root</code> property of the <code>AutomationRootNode</code> will be
// the immediate parent <code>AutomationRootNode</code>, or <code>null</code>
// if this is the top-level <code>AutomationRootNode</code>.
//
// Extends $(ref:automation.AutomationNode).
[nocompile] dictionary AutomationRootNode {
// Whether this AutomationRootNode is loaded or not. If false, call load()
// to get the contents.
// TODO(aboxhall/dtseng): implement.
bool loaded;
// Load the accessibility tree for this AutomationRootNode.
// TODO(aboxhall/dtseng): implement.
static void load(RootCallback callback);
};
// Called when the <code>AutomationRootNode</code> for the page is available.
callback RootCallback = void(AutomationRootNode rootNode);
interface Functions {
// Get the automation tree for the tab with the given tabId, or the current
// tab if no tabID is given, enabling automation if necessary. Returns a
// tree with a placeholder root node; listen for the "loadComplete" event to
// get a notification that the tree has fully loaded (the previous root node
// reference will stop working at or before this point).
[nocompile] static void getTree(optional long tabId, RootCallback callback);
// Get the automation tree for the desktop.
[nocompile] static void getDesktop(RootCallback callback);
};
};
|