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

Side by Side Diff: chrome/browser/accessibility/browser_accessibility_win.cc

Issue 6469037: Implement support for special offset constants in IAccessibleText methods.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698