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

Side by Side Diff: webkit/glue/webaccessibility.h

Issue 7745035: Add a big grab bag of missing web accessibility functionality... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_GLUE_WEBACCESSIBILITY_H_ 5 #ifndef WEBKIT_GLUE_WEBACCESSIBILITY_H_
6 #define WEBKIT_GLUE_WEBACCESSIBILITY_H_ 6 #define WEBKIT_GLUE_WEBACCESSIBILITY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ROLE_WEB_AREA, 124 ROLE_WEB_AREA,
125 ROLE_WINDOW, 125 ROLE_WINDOW,
126 NUM_ROLES 126 NUM_ROLES
127 }; 127 };
128 128
129 // An alphabetical enumeration of accessibility states. 129 // An alphabetical enumeration of accessibility states.
130 // A state bitmask is formed by shifting 1 to the left by each state, 130 // A state bitmask is formed by shifting 1 to the left by each state,
131 // for example: 131 // for example:
132 // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED); 132 // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED);
133 enum State { 133 enum State {
134 STATE_BUSY,
134 STATE_CHECKED, 135 STATE_CHECKED,
135 STATE_COLLAPSED, 136 STATE_COLLAPSED,
136 STATE_EXPANDED, 137 STATE_EXPANDED,
137 STATE_FOCUSABLE, 138 STATE_FOCUSABLE,
138 STATE_FOCUSED, 139 STATE_FOCUSED,
139 STATE_HASPOPUP, 140 STATE_HASPOPUP,
140 STATE_HOTTRACKED, 141 STATE_HOTTRACKED,
141 STATE_INDETERMINATE, 142 STATE_INDETERMINATE,
142 STATE_INVISIBLE, 143 STATE_INVISIBLE,
143 STATE_LINKED, 144 STATE_LINKED,
144 STATE_MULTISELECTABLE, 145 STATE_MULTISELECTABLE,
145 STATE_OFFSCREEN, 146 STATE_OFFSCREEN,
146 STATE_PRESSED, 147 STATE_PRESSED,
147 STATE_PROTECTED, 148 STATE_PROTECTED,
148 STATE_READONLY, 149 STATE_READONLY,
150 STATE_REQUIRED,
149 STATE_SELECTABLE, 151 STATE_SELECTABLE,
150 STATE_SELECTED, 152 STATE_SELECTED,
151 STATE_TRAVERSED, 153 STATE_TRAVERSED,
152 STATE_BUSY, 154 STATE_UNAVAILABLE,
153 STATE_UNAVAILABLE 155 STATE_VERTICAL,
156 STATE_VISITED
tony 2011/08/27 00:05:47 Nit: Is it possible to have a compile assert that
dmazzoni 2011/08/29 18:08:51 Done.
154 }; 157 };
155 158
156 // Additional optional attributes that can be optionally attached to 159 // Additional optional attributes that can be optionally attached to
157 // a node. 160 // a node.
158 enum StringAttribute { 161 enum StringAttribute {
159 // Document attributes. 162 // Document attributes.
160 ATTR_DOC_URL, 163 ATTR_DOC_URL,
161 ATTR_DOC_TITLE, 164 ATTR_DOC_TITLE,
162 ATTR_DOC_MIMETYPE, 165 ATTR_DOC_MIMETYPE,
163 ATTR_DOC_DOCTYPE, 166 ATTR_DOC_DOCTYPE,
164 167
165 // Attributes that could apply to any node. 168 // Attributes that could apply to any node.
169 ATTR_ACCESS_KEY,
166 ATTR_ACTION, 170 ATTR_ACTION,
171 ATTR_CONTAINER_LIVE_RELEVANT,
172 ATTR_CONTAINER_LIVE_STATUS,
167 ATTR_DESCRIPTION, 173 ATTR_DESCRIPTION,
168 ATTR_DISPLAY, 174 ATTR_DISPLAY,
169 ATTR_HELP, 175 ATTR_HELP,
170 ATTR_HTML_TAG, 176 ATTR_HTML_TAG,
177 ATTR_LIVE_RELEVANT,
178 ATTR_LIVE_STATUS,
179 ATTR_ROLE,
171 ATTR_SHORTCUT, 180 ATTR_SHORTCUT,
172 ATTR_URL, 181 ATTR_URL,
173 NUM_STRING_ATTRIBUTES 182 NUM_STRING_ATTRIBUTES
174 }; 183 };
175 184
176 enum IntAttribute { 185 enum IntAttribute {
177 // Document attributes. 186 // Document attributes.
178 ATTR_DOC_SCROLLX, 187 ATTR_DOC_SCROLLX,
179 ATTR_DOC_SCROLLY, 188 ATTR_DOC_SCROLLY,
180 189
181 // Editable text attributes. 190 // Editable text attributes.
182 ATTR_TEXT_SEL_START, 191 ATTR_TEXT_SEL_START,
183 ATTR_TEXT_SEL_END, 192 ATTR_TEXT_SEL_END,
184 193
185 // Table attributes. 194 // Table attributes.
186 ATTR_TABLE_ROW_COUNT, 195 ATTR_TABLE_ROW_COUNT,
187 ATTR_TABLE_COLUMN_COUNT, 196 ATTR_TABLE_COLUMN_COUNT,
188 197
189 // Table cell attributes. 198 // Table cell attributes.
190 ATTR_TABLE_CELL_COLUMN_INDEX, 199 ATTR_TABLE_CELL_COLUMN_INDEX,
191 ATTR_TABLE_CELL_COLUMN_SPAN, 200 ATTR_TABLE_CELL_COLUMN_SPAN,
192 ATTR_TABLE_CELL_ROW_INDEX, 201 ATTR_TABLE_CELL_ROW_INDEX,
193 ATTR_TABLE_CELL_ROW_SPAN, 202 ATTR_TABLE_CELL_ROW_SPAN,
194 203
204 // Tree control attributes.
205 ATTR_HIERARCHICAL_LEVEL,
206
195 NUM_INT_ATTRIBUTES 207 NUM_INT_ATTRIBUTES
196 }; 208 };
197 209
210 enum FloatAttribute {
211 // Document attributes.
212 ATTR_DOC_LOADING_PROGRESS,
213
214 // Range attributes.
215 ATTR_VALUE_FOR_RANGE,
216 ATTR_MIN_VALUE_FOR_RANGE,
217 ATTR_MAX_VALUE_FOR_RANGE,
218
219 NUM_FLOAT_ATTRIBUTES
220 };
221
222 enum BoolAttribute {
223 // Document attributes.
224 ATTR_DOC_LOADED,
225
226 // True if a checkbox or radio button is in the "mixed" state.
227 ATTR_BUTTON_MIXED,
228
229 // Live region attributes.
230 ATTR_CONTAINER_LIVE_ATOMIC,
231 ATTR_CONTAINER_LIVE_BUSY,
232 ATTR_LIVE_ATOMIC,
233 ATTR_LIVE_BUSY,
234
235 NUM_BOOL_ATTRIBUTES
236 };
237
198 // Empty constructor, for serialization. 238 // Empty constructor, for serialization.
199 WebAccessibility(); 239 WebAccessibility();
200 240
201 // Construct from a WebAccessibilityObject. Recursively creates child 241 // Construct from a WebAccessibilityObject. Recursively creates child
202 // nodes as needed to complete the tree. Adds |src| to |cache| and 242 // nodes as needed to complete the tree. Adds |src| to |cache| and
203 // stores its cache ID. 243 // stores its cache ID.
204 WebAccessibility(const WebKit::WebAccessibilityObject& src, 244 WebAccessibility(const WebKit::WebAccessibilityObject& src,
205 WebKit::WebAccessibilityCache* cache, 245 WebKit::WebAccessibilityCache* cache,
206 bool include_children); 246 bool include_children);
207 247
208 ~WebAccessibility(); 248 ~WebAccessibility();
209 249
250 std::string DebugString(bool recursive);
251
210 private: 252 private:
211 // Initialize an already-created struct, same as the constructor above. 253 // Initialize an already-created struct, same as the constructor above.
212 void Init(const WebKit::WebAccessibilityObject& src, 254 void Init(const WebKit::WebAccessibilityObject& src,
213 WebKit::WebAccessibilityCache* cache, 255 WebKit::WebAccessibilityCache* cache,
214 bool include_children); 256 bool include_children);
215 257
216 // Returns true if |ancestor| is the first unignored parent of |child|, 258 // Returns true if |ancestor| is the first unignored parent of |child|,
217 // which means that when walking up the parent chain from |child|, 259 // which means that when walking up the parent chain from |child|,
218 // |ancestor| is the *first* ancestor that isn't marked as 260 // |ancestor| is the *first* ancestor that isn't marked as
219 // accessibilityIsIgnored(). 261 // accessibilityIsIgnored().
220 bool IsParentUnignoredOf(const WebKit::WebAccessibilityObject& ancestor, 262 bool IsParentUnignoredOf(const WebKit::WebAccessibilityObject& ancestor,
221 const WebKit::WebAccessibilityObject& child); 263 const WebKit::WebAccessibilityObject& child);
222 264
223 public: 265 public:
224 // This is a simple serializable struct. All member variables should be 266 // This is a simple serializable struct. All member variables should be
225 // copyable. 267 // copyable.
226 int32 id; 268 int32 id;
227 string16 name; 269 string16 name;
228 string16 value; 270 string16 value;
229 Role role; 271 Role role;
230 uint32 state; 272 uint32 state;
231 gfx::Rect location; 273 gfx::Rect location;
232 std::map<StringAttribute, string16> string_attributes; 274 std::map<StringAttribute, string16> string_attributes;
233 std::map<IntAttribute, int32> int_attributes; 275 std::map<IntAttribute, int32> int_attributes;
276 std::map<FloatAttribute, float> float_attributes;
277 std::map<BoolAttribute, bool> bool_attributes;
234 std::vector<WebAccessibility> children; 278 std::vector<WebAccessibility> children;
235 std::vector<int32> indirect_child_ids; 279 std::vector<int32> indirect_child_ids;
236 std::vector<std::pair<string16, string16> > html_attributes; 280 std::vector<std::pair<string16, string16> > html_attributes;
237 std::vector<int32> line_breaks; 281 std::vector<int32> line_breaks;
238 std::vector<int32> cell_ids; // For a table, the cell ids in row-major order. 282 std::vector<int32> cell_ids; // For a table, the cell ids in row-major order
283 std::vector<int32> unique_cell_ids;
tony 2011/08/27 00:05:47 Can we just make this a set?
dmazzoni 2011/08/29 18:08:51 No, the order matters and the uniqueness only need
239 }; 284 };
240 285
241 } // namespace webkit_glue 286 } // namespace webkit_glue
242 287
243 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_ 288 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698