Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: content/common/accessibility_node_data.h

Issue 23651003: Use Blink accessibility enums in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile errors Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ 5 #ifndef CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_
6 #define CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ 6 #define CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/web/WebAXEnums.h"
14 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 // A compact representation of the accessibility information for a 19 // A compact representation of the accessibility information for a
19 // single web object, in a form that can be serialized and sent from 20 // single web object, in a form that can be serialized and sent from
20 // the renderer process to the browser process. 21 // the renderer process to the browser process.
21 struct CONTENT_EXPORT AccessibilityNodeData { 22 struct CONTENT_EXPORT AccessibilityNodeData {
22 // An enumeration of accessibility roles.
23 enum Role {
24 ROLE_UNKNOWN = 0,
25
26 // Used by Chromium to distinguish between the root of the tree
27 // for this page, and a web area for a frame within this page.
28 ROLE_ROOT_WEB_AREA,
29
30 // These roles all directly correspond to WebKit accessibility roles,
31 // keep these alphabetical.
32 ROLE_ALERT,
33 ROLE_ALERT_DIALOG,
34 ROLE_ANNOTATION,
35 ROLE_APPLICATION,
36 ROLE_ARTICLE,
37 ROLE_BROWSER,
38 ROLE_BUSY_INDICATOR,
39 ROLE_BUTTON,
40 ROLE_CANVAS,
41 ROLE_CANVAS_WITH_FALLBACK_CONTENT,
42 ROLE_CELL,
43 ROLE_CHECKBOX,
44 ROLE_COLOR_WELL,
45 ROLE_COLUMN,
46 ROLE_COLUMN_HEADER,
47 ROLE_COMBO_BOX,
48 ROLE_DEFINITION,
49 ROLE_DESCRIPTION_LIST_DETAIL,
50 ROLE_DESCRIPTION_LIST_TERM,
51 ROLE_DIALOG,
52 ROLE_DIRECTORY,
53 ROLE_DISCLOSURE_TRIANGLE,
54 ROLE_DIV,
55 ROLE_DOCUMENT,
56 ROLE_DRAWER,
57 ROLE_EDITABLE_TEXT,
58 ROLE_FOOTER,
59 ROLE_FORM,
60 ROLE_GRID,
61 ROLE_GROUP,
62 ROLE_GROW_AREA,
63 ROLE_HEADING,
64 ROLE_HELP_TAG,
65 ROLE_HORIZONTAL_RULE,
66 ROLE_IGNORED,
67 ROLE_IMAGE,
68 ROLE_IMAGE_MAP,
69 ROLE_IMAGE_MAP_LINK,
70 ROLE_INCREMENTOR,
71 ROLE_LABEL,
72 ROLE_LANDMARK_APPLICATION,
73 ROLE_LANDMARK_BANNER,
74 ROLE_LANDMARK_COMPLEMENTARY,
75 ROLE_LANDMARK_CONTENTINFO,
76 ROLE_LANDMARK_MAIN,
77 ROLE_LANDMARK_NAVIGATION,
78 ROLE_LANDMARK_SEARCH,
79 ROLE_LINK,
80 ROLE_LIST,
81 ROLE_LISTBOX,
82 ROLE_LISTBOX_OPTION,
83 ROLE_LIST_ITEM,
84 ROLE_LIST_MARKER,
85 ROLE_LOG,
86 ROLE_MARQUEE,
87 ROLE_MATH,
88 ROLE_MATTE,
89 ROLE_MENU,
90 ROLE_MENU_BAR,
91 ROLE_MENU_ITEM,
92 ROLE_MENU_BUTTON,
93 ROLE_MENU_LIST_OPTION,
94 ROLE_MENU_LIST_POPUP,
95 ROLE_NOTE,
96 ROLE_OUTLINE,
97 ROLE_PARAGRAPH,
98 ROLE_POPUP_BUTTON,
99 ROLE_PRESENTATIONAL,
100 ROLE_PROGRESS_INDICATOR,
101 ROLE_RADIO_BUTTON,
102 ROLE_RADIO_GROUP,
103 ROLE_REGION,
104 ROLE_ROW,
105 ROLE_ROW_HEADER,
106 ROLE_RULER,
107 ROLE_RULER_MARKER,
108 ROLE_SCROLLAREA,
109 ROLE_SCROLLBAR,
110 ROLE_SHEET,
111 ROLE_SLIDER,
112 ROLE_SLIDER_THUMB,
113 ROLE_SPIN_BUTTON,
114 ROLE_SPIN_BUTTON_PART,
115 ROLE_SPLITTER,
116 ROLE_SPLIT_GROUP,
117 ROLE_STATIC_TEXT,
118 ROLE_STATUS,
119 ROLE_SVG_ROOT,
120 ROLE_SYSTEM_WIDE,
121 ROLE_TAB,
122 ROLE_TABLE,
123 ROLE_TABLE_HEADER_CONTAINER,
124 ROLE_TAB_GROUP_UNUSED, // WebKit doesn't use (uses ROLE_TAB_LIST)
125 ROLE_TAB_LIST,
126 ROLE_TAB_PANEL,
127 ROLE_TEXTAREA,
128 ROLE_TEXT_FIELD,
129 ROLE_TIMER,
130 ROLE_TOGGLE_BUTTON,
131 ROLE_TOOLBAR,
132 ROLE_TOOLTIP,
133 ROLE_TREE,
134 ROLE_TREE_GRID,
135 ROLE_TREE_ITEM,
136 ROLE_VALUE_INDICATOR,
137 ROLE_WEBCORE_LINK,
138 ROLE_WEB_AREA,
139 ROLE_WINDOW,
140 NUM_ROLES
141 };
142
143 // An alphabetical enumeration of accessibility states.
144 // A state bitmask is formed by shifting 1 to the left by each state,
145 // for example:
146 // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED);
147 enum State {
148 STATE_BUSY,
149 STATE_CHECKED,
150 STATE_COLLAPSED,
151 STATE_EXPANDED,
152 STATE_FOCUSABLE,
153 STATE_FOCUSED,
154 STATE_HASPOPUP,
155 STATE_HOTTRACKED,
156 STATE_INDETERMINATE,
157 STATE_INVISIBLE,
158 STATE_LINKED,
159 STATE_MULTISELECTABLE,
160 STATE_OFFSCREEN,
161 STATE_PRESSED,
162 STATE_PROTECTED,
163 STATE_READONLY,
164 STATE_REQUIRED,
165 STATE_SELECTABLE,
166 STATE_SELECTED,
167 STATE_TRAVERSED,
168 STATE_UNAVAILABLE,
169 STATE_VERTICAL,
170 STATE_VISITED,
171 NUM_STATES
172 };
173
174 COMPILE_ASSERT(NUM_STATES <= 31, state_enum_not_too_large);
175
176 // Additional optional attributes that can be optionally attached to 23 // Additional optional attributes that can be optionally attached to
177 // a node. 24 // a node.
178 enum StringAttribute { 25 enum StringAttribute {
179 // Document attributes. 26 // Document attributes.
180 ATTR_DOC_URL, 27 ATTR_DOC_URL,
181 ATTR_DOC_TITLE, 28 ATTR_DOC_TITLE,
182 ATTR_DOC_MIMETYPE, 29 ATTR_DOC_MIMETYPE,
183 ATTR_DOC_DOCTYPE, 30 ATTR_DOC_DOCTYPE,
184 31
185 // Attributes that could apply to any node. 32 // Attributes that could apply to any node.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 ATTR_TABLE_CELL_COLUMN_SPAN, 78 ATTR_TABLE_CELL_COLUMN_SPAN,
232 ATTR_TABLE_CELL_ROW_INDEX, 79 ATTR_TABLE_CELL_ROW_INDEX,
233 ATTR_TABLE_CELL_ROW_SPAN, 80 ATTR_TABLE_CELL_ROW_SPAN,
234 81
235 // Tree control attributes. 82 // Tree control attributes.
236 ATTR_HIERARCHICAL_LEVEL, 83 ATTR_HIERARCHICAL_LEVEL,
237 84
238 // Relationships between this element and other elements. 85 // Relationships between this element and other elements.
239 ATTR_TITLE_UI_ELEMENT, 86 ATTR_TITLE_UI_ELEMENT,
240 87
241 // Color value for ROLE_COLOR_WELL, each component is 0..255 88 // Color value for WebKit::WebAXRoleColorWell, each component is 0..255
242 ATTR_COLOR_VALUE_RED, 89 ATTR_COLOR_VALUE_RED,
243 ATTR_COLOR_VALUE_GREEN, 90 ATTR_COLOR_VALUE_GREEN,
244 ATTR_COLOR_VALUE_BLUE 91 ATTR_COLOR_VALUE_BLUE
245 }; 92 };
246 93
247 enum FloatAttribute { 94 enum FloatAttribute {
248 // Document attributes. 95 // Document attributes.
249 ATTR_DOC_LOADING_PROGRESS, 96 ATTR_DOC_LOADING_PROGRESS,
250 97
251 // Range attributes. 98 // Range attributes.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // Equivalent to AddStringAttribute(ATTR_NAME, name). 160 // Equivalent to AddStringAttribute(ATTR_NAME, name).
314 void SetName(std::string name); 161 void SetName(std::string name);
315 162
316 #ifndef NDEBUG 163 #ifndef NDEBUG
317 virtual std::string DebugString(bool recursive) const; 164 virtual std::string DebugString(bool recursive) const;
318 #endif 165 #endif
319 166
320 // This is a simple serializable struct. All member variables should be 167 // This is a simple serializable struct. All member variables should be
321 // public and copyable. 168 // public and copyable.
322 int32 id; 169 int32 id;
323 Role role; 170 WebKit::WebAXRole role;
324 uint32 state; 171 uint32 state;
325 gfx::Rect location; 172 gfx::Rect location;
326 std::vector<std::pair<StringAttribute, std::string> > string_attributes; 173 std::vector<std::pair<StringAttribute, std::string> > string_attributes;
327 std::vector<std::pair<IntAttribute, int32> > int_attributes; 174 std::vector<std::pair<IntAttribute, int32> > int_attributes;
328 std::vector<std::pair<FloatAttribute, float> > float_attributes; 175 std::vector<std::pair<FloatAttribute, float> > float_attributes;
329 std::vector<std::pair<BoolAttribute, bool> > bool_attributes; 176 std::vector<std::pair<BoolAttribute, bool> > bool_attributes;
330 std::vector<std::pair<IntListAttribute, std::vector<int32> > > 177 std::vector<std::pair<IntListAttribute, std::vector<int32> > >
331 intlist_attributes; 178 intlist_attributes;
332 std::vector<std::pair<std::string, std::string> > html_attributes; 179 std::vector<std::pair<std::string, std::string> > html_attributes;
333 std::vector<int32> child_ids; 180 std::vector<int32> child_ids;
(...skipping 22 matching lines...) Expand all
356 // build a tree of AccessibilityNodeDataTreeNode objects for easier 203 // build a tree of AccessibilityNodeDataTreeNode objects for easier
357 // testing and debugging, where each node contains its children. 204 // testing and debugging, where each node contains its children.
358 // The |dst| argument will become the root of the new tree. 205 // The |dst| argument will become the root of the new tree.
359 void MakeAccessibilityNodeDataTree( 206 void MakeAccessibilityNodeDataTree(
360 const std::vector<AccessibilityNodeData>& src, 207 const std::vector<AccessibilityNodeData>& src,
361 AccessibilityNodeDataTreeNode* dst); 208 AccessibilityNodeDataTreeNode* dst);
362 209
363 } // namespace content 210 } // namespace content
364 211
365 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ 212 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698