OLD | NEW |
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_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // The following attributes are appropriate to use with this method: | 280 // The following attributes are appropriate to use with this method: |
281 // aria-selected (selectable) | 281 // aria-selected (selectable) |
282 // aria-grabbed (grabbable) | 282 // aria-grabbed (grabbable) |
283 // aria-expanded (expandable) | 283 // aria-expanded (expandable) |
284 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state | 284 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state |
285 // aria-checked (checkable) -- supports 4th "mixed state" | 285 // aria-checked (checkable) -- supports 4th "mixed state" |
286 bool GetAriaTristate(const char* attr_name, | 286 bool GetAriaTristate(const char* attr_name, |
287 bool* is_defined, | 287 bool* is_defined, |
288 bool* is_mixed) const; | 288 bool* is_mixed) const; |
289 | 289 |
| 290 virtual base::string16 GetText() const; |
| 291 |
290 // Returns true if the bit corresponding to the given state enum is 1. | 292 // Returns true if the bit corresponding to the given state enum is 1. |
291 bool HasState(ui::AXState state_enum) const; | 293 bool HasState(ui::AXState state_enum) const; |
292 | 294 |
293 // Returns true if this node is an cell or an table header. | 295 // Returns true if this node is an cell or an table header. |
294 bool IsCellOrTableHeaderRole() const; | 296 bool IsCellOrTableHeaderRole() const; |
295 | 297 |
296 // Returns true if the caret is active on this object. | 298 // Returns true if the caret is active on this object. |
297 bool HasCaret() const; | 299 bool HasCaret() const; |
298 | 300 |
299 // Returns true if this node is an editable text field of any kind. | |
300 bool IsEditableText() const; | |
301 | |
302 // True if this is a web area, and its grandparent is a presentational iframe. | 301 // True if this is a web area, and its grandparent is a presentational iframe. |
303 bool IsWebAreaForPresentationalIframe() const; | 302 bool IsWebAreaForPresentationalIframe() const; |
304 | 303 |
305 bool IsControl() const; | 304 bool IsControl() const; |
306 bool IsSimpleTextControl() const; | 305 bool IsSimpleTextControl() const; |
307 // Indicates if this object is at the root of a rich edit text control. | 306 // Indicates if this object is at the root of a rich edit text control. |
308 bool IsRichTextControl() const; | 307 bool IsRichTextControl() const; |
309 | 308 |
310 // If an object is focusable but has no accessible name, use this | 309 // If an object is focusable but has no accessible name, use this |
311 // to compute a name from its descendants. | 310 // to compute a name from its descendants. |
312 std::string ComputeAccessibleNameFromDescendants(); | 311 std::string ComputeAccessibleNameFromDescendants(); |
313 | 312 |
314 protected: | 313 protected: |
315 BrowserAccessibility(); | 314 BrowserAccessibility(); |
316 | 315 |
317 // The manager of this tree of accessibility objects. | 316 // The manager of this tree of accessibility objects. |
318 BrowserAccessibilityManager* manager_; | 317 BrowserAccessibilityManager* manager_; |
319 | 318 |
320 // The underlying node. | 319 // The underlying node. |
321 ui::AXNode* node_; | 320 ui::AXNode* node_; |
322 | 321 |
323 private: | 322 private: |
| 323 // |GetInnerText| recursively includes all the text from descendants such as |
| 324 // text found in any embedded object. In contrast, |GetText| might include a |
| 325 // special character in the place of every embedded object instead of its |
| 326 // text, depending on the platform. |
324 base::string16 GetInnerText() const; | 327 base::string16 GetInnerText() const; |
325 int GetInnerTextLength() const; | |
326 | 328 |
327 // If a bounding rectangle is empty, compute it based on the union of its | 329 // If a bounding rectangle is empty, compute it based on the union of its |
328 // children, since most accessibility APIs don't like elements with no | 330 // children, since most accessibility APIs don't like elements with no |
329 // bounds, but "virtual" elements in the accessibility tree that don't | 331 // bounds, but "virtual" elements in the accessibility tree that don't |
330 // correspond to a layed-out element sometimes don't have bounds. | 332 // correspond to a layed-out element sometimes don't have bounds. |
331 void FixEmptyBounds(gfx::Rect* bounds) const; | 333 void FixEmptyBounds(gfx::Rect* bounds) const; |
332 | 334 |
333 // Convert the bounding rectangle of an element (which is relative to | 335 // Convert the bounding rectangle of an element (which is relative to |
334 // its nearest scrollable ancestor) to local bounds (which are relative | 336 // its nearest scrollable ancestor) to local bounds (which are relative |
335 // to the top of the web accessibility tree). | 337 // to the top of the web accessibility tree). |
336 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; | 338 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; |
337 | 339 |
338 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 340 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
339 }; | 341 }; |
340 | 342 |
341 } // namespace content | 343 } // namespace content |
342 | 344 |
343 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 345 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |