| 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 UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ |
| 6 #define UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ | 6 #define UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ui/accessibility/ax_enums.h" |
| 13 #include "ui/accessibility/ax_export.h" | 14 #include "ui/accessibility/ax_export.h" |
| 14 | 15 |
| 15 namespace ui { | 16 namespace ui { |
| 16 | 17 |
| 17 // Boundaries that can be passed to FindAccessibleTextBoundary, | 18 // Boundaries that can be passed to FindAccessibleTextBoundary, |
| 18 // representing various visual boundaries in (potentially multi-line) | 19 // representing various visual boundaries in (potentially multi-line) |
| 19 // text. This is used by assistive technology in order to, for example, | 20 // text. This is used by assistive technology in order to, for example, |
| 20 // retrieve the nearest word to the cursor, or retrieve all of the | 21 // retrieve the nearest word to the cursor, or retrieve all of the |
| 21 // text from the current cursor position to the end of the line. | 22 // text from the current cursor position to the end of the line. |
| 22 // These should be self-explanatory; "line" here refers to the visual | 23 // These should be self-explanatory; "line" here refers to the visual |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 // Convenience method needed to implement platform-specific text | 42 // Convenience method needed to implement platform-specific text |
| 42 // accessibility APIs like IAccessible2. Search forwards or backwards | 43 // accessibility APIs like IAccessible2. Search forwards or backwards |
| 43 // (depending on |direction|) from the given |start_offset| until the | 44 // (depending on |direction|) from the given |start_offset| until the |
| 44 // given boundary is found, and return the offset of that boundary, | 45 // given boundary is found, and return the offset of that boundary, |
| 45 // using the vector of line break character offsets in |line_breaks|. | 46 // using the vector of line break character offsets in |line_breaks|. |
| 46 size_t AX_EXPORT | 47 size_t AX_EXPORT |
| 47 FindAccessibleTextBoundary(const base::string16& text, | 48 FindAccessibleTextBoundary(const base::string16& text, |
| 48 const std::vector<int>& line_breaks, | 49 const std::vector<int>& line_breaks, |
| 49 TextBoundaryType boundary, | 50 TextBoundaryType boundary, |
| 50 size_t start_offset, | 51 size_t start_offset, |
| 51 TextBoundaryDirection direction); | 52 TextBoundaryDirection direction, |
| 53 AXTextAffinity affinity); |
| 52 | 54 |
| 53 } // namespace ui | 55 } // namespace ui |
| 54 | 56 |
| 55 #endif // UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ | 57 #endif // UI_ACCESSIBILITY_AX_TEXT_UTILS_H_ |
| OLD | NEW |