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(direction == 1 || direction == -1); | |
Chris Guillory
2011/02/18 01:37:11
Nit: Can we keep these DCHECKs next to each other.
dmazzoni
2011/02/18 17:52:37
Sure. I moved the start_offset DCHECK back up to t
| |
1227 | |
1228 if (start_offset == IA2_TEXT_OFFSET_LENGTH) { | |
1229 start_offset = text_size; | |
1230 } else if (start_offset == IA2_TEXT_OFFSET_CARET) { | |
1231 get_caretOffset(&start_offset); | |
1232 } | |
1226 DCHECK(start_offset >= 0 && start_offset <= text_size); | 1233 DCHECK(start_offset >= 0 && start_offset <= text_size); |
1227 DCHECK(direction == 1 || direction == -1); | |
1228 | 1234 |
1229 if (boundary == IA2_TEXT_BOUNDARY_CHAR) { | 1235 if (boundary == IA2_TEXT_BOUNDARY_CHAR) { |
1230 if (direction == 1 && start_offset < text_size) | 1236 if (direction == 1 && start_offset < text_size) |
1231 return start_offset + 1; | 1237 return start_offset + 1; |
1232 else | 1238 else |
1233 return start_offset; | 1239 return start_offset; |
1234 } | 1240 } |
1235 | 1241 |
1236 LONG result = start_offset; | 1242 LONG result = start_offset; |
1237 for (;;) { | 1243 for (;;) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1589 } | 1595 } |
1590 | 1596 |
1591 // The role should always be set. | 1597 // The role should always be set. |
1592 DCHECK(!role_name_.empty() || ia_role_); | 1598 DCHECK(!role_name_.empty() || ia_role_); |
1593 | 1599 |
1594 // If we didn't explicitly set the IAccessible2 role, make it the same | 1600 // If we didn't explicitly set the IAccessible2 role, make it the same |
1595 // as the MSAA role. | 1601 // as the MSAA role. |
1596 if (!ia2_role_) | 1602 if (!ia2_role_) |
1597 ia2_role_ = ia_role_; | 1603 ia2_role_ = ia_role_; |
1598 } | 1604 } |
OLD | NEW |