OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/accessibility/browser_accessibility_win.h" | 5 #include "chrome/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/accessibility/browser_accessibility_manager_win.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_manager_win.h" |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 return name_; | 1216 return name_; |
1217 } | 1217 } |
1218 } | 1218 } |
1219 | 1219 |
1220 LONG BrowserAccessibilityWin::FindBoundary( | 1220 LONG BrowserAccessibilityWin::FindBoundary( |
1221 const string16& text, | 1221 const string16& text, |
1222 IA2TextBoundaryType boundary, | 1222 IA2TextBoundaryType boundary, |
1223 LONG start_offset, | 1223 LONG start_offset, |
1224 LONG direction) { | 1224 LONG direction) { |
1225 LONG text_size = static_cast<LONG>(text.size()); | 1225 LONG text_size = static_cast<LONG>(text.size()); |
1226 DCHECK(start_offset >= 0 && start_offset <= text_size); | 1226 DCHECK((start_offset >= 0 && start_offset <= text_size) || |
| 1227 start_offset == IA2_TEXT_OFFSET_LENGTH || |
| 1228 start_offset == IA2_TEXT_OFFSET_CARET); |
1227 DCHECK(direction == 1 || direction == -1); | 1229 DCHECK(direction == 1 || direction == -1); |
1228 | 1230 |
| 1231 if (start_offset == IA2_TEXT_OFFSET_LENGTH) { |
| 1232 start_offset = text_size; |
| 1233 } else if (start_offset == IA2_TEXT_OFFSET_CARET) { |
| 1234 get_caretOffset(&start_offset); |
| 1235 } |
| 1236 |
1229 if (boundary == IA2_TEXT_BOUNDARY_CHAR) { | 1237 if (boundary == IA2_TEXT_BOUNDARY_CHAR) { |
1230 if (direction == 1 && start_offset < text_size) | 1238 if (direction == 1 && start_offset < text_size) |
1231 return start_offset + 1; | 1239 return start_offset + 1; |
1232 else | 1240 else |
1233 return start_offset; | 1241 return start_offset; |
1234 } | 1242 } |
1235 | 1243 |
1236 LONG result = start_offset; | 1244 LONG result = start_offset; |
1237 for (;;) { | 1245 for (;;) { |
1238 LONG pos; | 1246 LONG pos; |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 } | 1597 } |
1590 | 1598 |
1591 // The role should always be set. | 1599 // The role should always be set. |
1592 DCHECK(!role_name_.empty() || ia_role_); | 1600 DCHECK(!role_name_.empty() || ia_role_); |
1593 | 1601 |
1594 // If we didn't explicitly set the IAccessible2 role, make it the same | 1602 // If we didn't explicitly set the IAccessible2 role, make it the same |
1595 // as the MSAA role. | 1603 // as the MSAA role. |
1596 if (!ia2_role_) | 1604 if (!ia2_role_) |
1597 ia2_role_ = ia_role_; | 1605 ia2_role_ = ia_role_; |
1598 } | 1606 } |
OLD | NEW |