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

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

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « tools/gn/tokenizer.cc ('k') | ui/app_list/search/term_break_iterator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/accessibility/ax_text_utils.h" 5 #include "ui/accessibility/ax_text_utils.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return 0; 55 return 0;
56 pos = result - 1; 56 pos = result - 1;
57 } 57 }
58 58
59 switch (boundary) { 59 switch (boundary) {
60 case CHAR_BOUNDARY: 60 case CHAR_BOUNDARY:
61 case LINE_BOUNDARY: 61 case LINE_BOUNDARY:
62 NOTREACHED(); // These are handled above. 62 NOTREACHED(); // These are handled above.
63 break; 63 break;
64 case WORD_BOUNDARY: 64 case WORD_BOUNDARY:
65 if (IsWhitespace(text[pos])) 65 if (base::IsUnicodeWhitespace(text[pos]))
66 return result; 66 return result;
67 break; 67 break;
68 case PARAGRAPH_BOUNDARY: 68 case PARAGRAPH_BOUNDARY:
69 if (text[pos] == '\n') 69 if (text[pos] == '\n')
70 return result; 70 return result;
71 break; 71 break;
72 case SENTENCE_BOUNDARY: 72 case SENTENCE_BOUNDARY:
73 if ((text[pos] == '.' || text[pos] == '!' || text[pos] == '?') && 73 if ((text[pos] == '.' || text[pos] == '!' || text[pos] == '?') &&
74 (pos == text_size - 1 || IsWhitespace(text[pos + 1]))) { 74 (pos == text_size - 1 ||
75 base::IsUnicodeWhitespace(text[pos + 1]))) {
75 return result; 76 return result;
76 } 77 }
77 break; 78 break;
78 case ALL_BOUNDARY: 79 case ALL_BOUNDARY:
79 default: 80 default:
80 break; 81 break;
81 } 82 }
82 83
83 if (direction == FORWARDS_DIRECTION) { 84 if (direction == FORWARDS_DIRECTION) {
84 result++; 85 result++;
85 } else { 86 } else {
86 result--; 87 result--;
87 } 88 }
88 } 89 }
89 } 90 }
90 91
91 } // Namespace ui 92 } // Namespace ui
OLDNEW
« no previous file with comments | « tools/gn/tokenizer.cc ('k') | ui/app_list/search/term_break_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698