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
|
// 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 <code>AutomationTree</code>.
[nocompile] dictionary AutomationNode {
// 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 automation tree for a single page.
[nocompile] dictionary AutomationTree {
AutomationNode root;
static void addEventListener(
DOMString eventType, AutomationListener listener, bool capture);
static void removeEventListener(
DOMString eventType, AutomationListener listener, bool capture);
};
// Called when the <code>AutomationTree</code> for the page is available.
callback RootCallback = void(AutomationTree tree);
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);
};
};
|