OLD | NEW |
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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 namespace WebKit { | 15 namespace WebKit { |
16 class WebAccessibilityCache; | |
17 class WebAccessibilityObject; | 16 class WebAccessibilityObject; |
18 } | 17 } |
19 | 18 |
20 namespace webkit_glue { | 19 namespace webkit_glue { |
21 | 20 |
22 // A compact representation of the accessibility information for a | 21 // A compact representation of the accessibility information for a |
23 // single web object, in a form that can be serialized and sent from | 22 // single web object, in a form that can be serialized and sent from |
24 // the renderer process to the browser process. | 23 // the renderer process to the browser process. |
25 struct WebAccessibility { | 24 struct WebAccessibility { |
26 public: | 25 public: |
27 // An alphabetical enumeration of accessibility roles. | 26 // An enumeration of accessibility roles. |
28 enum Role { | 27 enum Role { |
29 ROLE_NONE = 0, | 28 ROLE_UNKNOWN = 0, |
30 | 29 |
31 ROLE_UNKNOWN, | 30 // Used by Chromium to distinguish between the root of the tree |
| 31 // for this page, and a web area for a frame within this page. |
| 32 ROLE_ROOT_WEB_AREA, |
32 | 33 |
| 34 // These roles all directly correspond to WebKit accessibility roles, |
| 35 // keep these alphabetical. |
33 ROLE_ALERT, | 36 ROLE_ALERT, |
34 ROLE_ALERT_DIALOG, | 37 ROLE_ALERT_DIALOG, |
35 ROLE_ANNOTATION, | 38 ROLE_ANNOTATION, |
36 ROLE_APPLICATION, | 39 ROLE_APPLICATION, |
37 ROLE_ARTICLE, | 40 ROLE_ARTICLE, |
38 ROLE_BROWSER, | 41 ROLE_BROWSER, |
39 ROLE_BUSY_INDICATOR, | 42 ROLE_BUSY_INDICATOR, |
40 ROLE_BUTTON, | 43 ROLE_BUTTON, |
41 ROLE_CELL, | 44 ROLE_CELL, |
42 ROLE_CHECKBOX, | 45 ROLE_CHECKBOX, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 ATTR_LIVE_BUSY, | 235 ATTR_LIVE_BUSY, |
233 | 236 |
234 // ARIA readonly flag. | 237 // ARIA readonly flag. |
235 ATTR_ARIA_READONLY, | 238 ATTR_ARIA_READONLY, |
236 }; | 239 }; |
237 | 240 |
238 // Empty constructor, for serialization. | 241 // Empty constructor, for serialization. |
239 WebAccessibility(); | 242 WebAccessibility(); |
240 | 243 |
241 // Construct from a WebAccessibilityObject. Recursively creates child | 244 // Construct from a WebAccessibilityObject. Recursively creates child |
242 // nodes as needed to complete the tree. Adds |src| to |cache| and | 245 // nodes as needed to complete the tree. |
243 // stores its cache ID. | |
244 WebAccessibility(const WebKit::WebAccessibilityObject& src, | 246 WebAccessibility(const WebKit::WebAccessibilityObject& src, |
245 WebKit::WebAccessibilityCache* cache, | |
246 bool include_children); | 247 bool include_children); |
247 | 248 |
248 ~WebAccessibility(); | 249 ~WebAccessibility(); |
249 | 250 |
250 #ifndef NDEBUG | 251 #ifndef NDEBUG |
251 std::string DebugString(bool recursive, | 252 std::string DebugString(bool recursive, |
252 int render_routing_id, | 253 int render_routing_id, |
253 int notification_type); | 254 int notification_type); |
254 #endif | 255 #endif |
255 | 256 |
256 private: | 257 private: |
257 // Initialize an already-created struct, same as the constructor above. | 258 // Initialize an already-created struct, same as the constructor above. |
258 void Init(const WebKit::WebAccessibilityObject& src, | 259 void Init(const WebKit::WebAccessibilityObject& src, |
259 WebKit::WebAccessibilityCache* cache, | |
260 bool include_children); | 260 bool include_children); |
261 | 261 |
262 // Returns true if |ancestor| is the first unignored parent of |child|, | 262 // Returns true if |ancestor| is the first unignored parent of |child|, |
263 // which means that when walking up the parent chain from |child|, | 263 // which means that when walking up the parent chain from |child|, |
264 // |ancestor| is the *first* ancestor that isn't marked as | 264 // |ancestor| is the *first* ancestor that isn't marked as |
265 // accessibilityIsIgnored(). | 265 // accessibilityIsIgnored(). |
266 bool IsParentUnignoredOf(const WebKit::WebAccessibilityObject& ancestor, | 266 bool IsParentUnignoredOf(const WebKit::WebAccessibilityObject& ancestor, |
267 const WebKit::WebAccessibilityObject& child); | 267 const WebKit::WebAccessibilityObject& child); |
268 | 268 |
269 public: | 269 public: |
(...skipping 20 matching lines...) Expand all Loading... |
290 std::vector<int32> cell_ids; | 290 std::vector<int32> cell_ids; |
291 | 291 |
292 // For a table, the unique cell ids in row-major order of their first | 292 // For a table, the unique cell ids in row-major order of their first |
293 // occurrence. | 293 // occurrence. |
294 std::vector<int32> unique_cell_ids; | 294 std::vector<int32> unique_cell_ids; |
295 }; | 295 }; |
296 | 296 |
297 } // namespace webkit_glue | 297 } // namespace webkit_glue |
298 | 298 |
299 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_ | 299 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_ |
OLD | NEW |