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> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/browser/accessibility/ax_platform_position.h" |
18 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
19 #include "third_party/WebKit/public/web/WebAXEnums.h" | 20 #include "third_party/WebKit/public/web/WebAXEnums.h" |
20 #include "ui/accessibility/ax_node.h" | 21 #include "ui/accessibility/ax_node.h" |
21 #include "ui/accessibility/ax_node_data.h" | 22 #include "ui/accessibility/ax_node_data.h" |
| 23 #include "ui/accessibility/ax_range.h" |
22 #include "ui/accessibility/ax_text_utils.h" | 24 #include "ui/accessibility/ax_text_utils.h" |
23 | 25 |
24 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has | 26 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has |
25 // a platform-specific subclass of BrowserAccessibility and | 27 // a platform-specific subclass of BrowserAccessibility and |
26 // BrowserAccessibilityManager. | 28 // BrowserAccessibilityManager. |
27 #undef PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL | 29 #undef PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL |
28 | 30 |
29 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
30 #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 | 32 #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 |
31 #endif | 33 #endif |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 bool IsMenuRelated() const; | 348 bool IsMenuRelated() const; |
347 bool IsNativeTextControl() const; | 349 bool IsNativeTextControl() const; |
348 bool IsSimpleTextControl() const; | 350 bool IsSimpleTextControl() const; |
349 // Indicates if this object is at the root of a rich edit text control. | 351 // Indicates if this object is at the root of a rich edit text control. |
350 bool IsRichTextControl() const; | 352 bool IsRichTextControl() const; |
351 | 353 |
352 // If an object is focusable but has no accessible name, use this | 354 // If an object is focusable but has no accessible name, use this |
353 // to compute a name from its descendants. | 355 // to compute a name from its descendants. |
354 std::string ComputeAccessibleNameFromDescendants(); | 356 std::string ComputeAccessibleNameFromDescendants(); |
355 | 357 |
| 358 // Creates a position rooted at this object. |
| 359 // This is a text position on all platforms except IA2 and ATK, where tree |
| 360 // positions are created for non-text objects representing hypertext offsets. |
| 361 virtual AXPlatformPosition::AXPositionInstance CreatePositionAt( |
| 362 int offset) const; |
| 363 |
356 // Gets the text offsets where new lines start. | 364 // Gets the text offsets where new lines start. |
357 std::vector<int> GetLineStartOffsets() const; | 365 std::vector<int> GetLineStartOffsets() const; |
358 | 366 |
359 protected: | 367 protected: |
| 368 using AXPlatformPositionInstance = AXPlatformPosition::AXPositionInstance; |
| 369 using AXPlatformRange = ui::AXRange<AXPlatformPositionInstance::element_type>; |
| 370 |
360 BrowserAccessibility(); | 371 BrowserAccessibility(); |
361 | 372 |
362 // The manager of this tree of accessibility objects. | 373 // The manager of this tree of accessibility objects. |
363 BrowserAccessibilityManager* manager_; | 374 BrowserAccessibilityManager* manager_; |
364 | 375 |
365 // The underlying node. | 376 // The underlying node. |
366 ui::AXNode* node_; | 377 ui::AXNode* node_; |
367 | 378 |
368 // A unique ID, since node IDs are frame-local. | 379 // A unique ID, since node IDs are frame-local. |
369 int32_t unique_id_; | 380 int32_t unique_id_; |
(...skipping 10 matching lines...) Expand all Loading... |
380 // bounds, but "virtual" elements in the accessibility tree that don't | 391 // bounds, but "virtual" elements in the accessibility tree that don't |
381 // correspond to a layed-out element sometimes don't have bounds. | 392 // correspond to a layed-out element sometimes don't have bounds. |
382 void FixEmptyBounds(gfx::RectF* bounds) const; | 393 void FixEmptyBounds(gfx::RectF* bounds) const; |
383 | 394 |
384 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 395 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
385 }; | 396 }; |
386 | 397 |
387 } // namespace content | 398 } // namespace content |
388 | 399 |
389 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 400 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |