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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_
6 #define CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_
12 #include "base/string16.h"
13 #include "content/common/content_export.h"
14 #include "ui/gfx/rect.h"
18 // A compact representation of the accessibility information for a
19 // single web object, in a form that can be serialized and sent from
20 // the renderer process to the browser process.
21 struct CONTENT_EXPORT AccessibilityNodeData
{
22 // An enumeration of accessibility roles.
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.
30 // These roles all directly correspond to WebKit accessibility roles,
31 // keep these alphabetical.
41 ROLE_CANVAS_WITH_FALLBACK_CONTENT
,
48 ROLE_DEFINITION_LIST_DEFINITION
,
49 ROLE_DEFINITION_LIST_TERM
,
52 ROLE_DISCLOSURE_TRIANGLE
,
71 ROLE_LANDMARK_APPLICATION
,
73 ROLE_LANDMARK_COMPLEMENTARY
,
74 ROLE_LANDMARK_CONTENTINFO
,
76 ROLE_LANDMARK_NAVIGATION
,
92 ROLE_MENU_LIST_OPTION
,
99 ROLE_PROGRESS_INDICATOR
,
113 ROLE_SPIN_BUTTON_PART
,
121 ROLE_TABLE_HEADER_CONTAINER
,
122 ROLE_TAB_GROUP_UNUSED
, // WebKit doesn't use (uses ROLE_TAB_LIST)
134 ROLE_VALUE_INDICATOR
,
141 // An alphabetical enumeration of accessibility states.
142 // A state bitmask is formed by shifting 1 to the left by each state,
144 // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED);
157 STATE_MULTISELECTABLE
,
172 COMPILE_ASSERT(NUM_STATES
<= 31, state_enum_not_too_large
);
174 // Additional optional attributes that can be optionally attached to
176 enum StringAttribute
{
177 // Document attributes.
183 // Attributes that could apply to any node.
186 ATTR_CONTAINER_LIVE_RELEVANT
,
187 ATTR_CONTAINER_LIVE_STATUS
,
200 // Scrollable container attributes.
208 // Editable text attributes.
213 ATTR_TABLE_ROW_COUNT
,
214 ATTR_TABLE_COLUMN_COUNT
,
216 // Table cell attributes.
217 ATTR_TABLE_CELL_COLUMN_INDEX
,
218 ATTR_TABLE_CELL_COLUMN_SPAN
,
219 ATTR_TABLE_CELL_ROW_INDEX
,
220 ATTR_TABLE_CELL_ROW_SPAN
,
222 // Tree control attributes.
223 ATTR_HIERARCHICAL_LEVEL
,
225 // Relationships between this element and other elements.
226 ATTR_TITLE_UI_ELEMENT
,
229 enum FloatAttribute
{
230 // Document attributes.
231 ATTR_DOC_LOADING_PROGRESS
,
234 ATTR_VALUE_FOR_RANGE
,
235 ATTR_MIN_VALUE_FOR_RANGE
,
236 ATTR_MAX_VALUE_FOR_RANGE
,
240 // Document attributes.
243 // True if a checkbox or radio button is in the "mixed" state.
246 // Live region attributes.
247 ATTR_CONTAINER_LIVE_ATOMIC
,
248 ATTR_CONTAINER_LIVE_BUSY
,
252 // ARIA readonly flag.
255 // Writeable attributes
259 AccessibilityNodeData();
260 ~AccessibilityNodeData();
263 std::string
DebugString(bool recursive
) const;
266 // This is a simple serializable struct. All member variables should be
267 // public and copyable.
274 std::map
<StringAttribute
, string16
> string_attributes
;
275 std::map
<IntAttribute
, int32
> int_attributes
;
276 std::map
<FloatAttribute
, float> float_attributes
;
277 std::map
<BoolAttribute
, bool> bool_attributes
;
278 std::vector
<AccessibilityNodeData
> children
;
279 std::vector
<int32
> indirect_child_ids
;
280 std::vector
<std::pair
<string16
, string16
> > html_attributes
;
281 std::vector
<int32
> line_breaks
;
283 // For a table, the cell ids in row-major order, with duplicate entries
284 // when there's a rowspan or colspan, and with -1 for missing cells.
285 // There are always exactly rows * columns entries.
286 std::vector
<int32
> cell_ids
;
288 // For a table, the unique cell ids in row-major order of their first
290 std::vector
<int32
> unique_cell_ids
;
293 } // namespace content
295 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_