| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |