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

Side by Side Diff: ui/accessibility/ax_text_utils.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
« no previous file with comments | « ui/accessibility/ax_serializable_tree.cc ('k') | ui/accessibility/ax_text_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_ACCESSIBILITY_AX_TEXT_UTILS_H_
6 #define UI_ACCESSIBILITY_AX_TEXT_UTILS_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "ui/accessibility/ax_export.h"
13
14 namespace ui {
15
16 // Boundaries that can be passed to FindAccessibleTextBoundary,
17 // representing various visual boundaries in (potentially multi-line)
18 // text. This is used by assistive technology in order to, for example,
19 // retrieve the nearest word to the cursor, or retrieve all of the
20 // text from the current cursor position to the end of the line.
21 // These should be self-explanatory; "line" here refers to the visual
22 // line as currently displayed (possibly affected by wrapping).
23 enum TextBoundaryType {
24 CHAR_BOUNDARY,
25 WORD_BOUNDARY,
26 LINE_BOUNDARY,
27 SENTENCE_BOUNDARY,
28 PARAGRAPH_BOUNDARY,
29 ALL_BOUNDARY
30 };
31
32 // A direction when searching for the next boundary.
33 enum TextBoundaryDirection {
34 // Search forwards for the next boundary past the starting position.
35 FORWARDS_DIRECTION,
36 // Search backwards for the previous boundary before the starting position.
37 BACKWARDS_DIRECTION
38 };
39
40 // Convenience method needed to implement platform-specific text
41 // accessibility APIs like IAccessible2. Search forwards or backwards
42 // (depending on |direction|) from the given |start_offset| until the
43 // given boundary is found, and return the offset of that boundary,
44 // using the vector of line break character offsets in |line_breaks|.
45 size_t AX_EXPORT
46 FindAccessibleTextBoundary(const base::string16& text,
47 const std::vector<int>& line_breaks,
48 TextBoundaryType boundary,
49 size_t start_offset,
50 TextBoundaryDirection direction);
51
52 } // namespace ui
53
54 #endif // UI_ACCESSIBILITY_AX_TEXT_UTILS_H_
OLDNEW
« no previous file with comments | « ui/accessibility/ax_serializable_tree.cc ('k') | ui/accessibility/ax_text_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698