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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_base.cc

Issue 2679313003: Implemented IA2::setSelection and related methods on text fields in Views. (Closed)
Patch Set: Made |SetTextSelection| return a value. Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/platform/ax_platform_node_base.h" 5 #include "ui/accessibility/platform/ax_platform_node_base.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_action_data.h"
8 #include "ui/accessibility/ax_node_data.h" 9 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/accessibility/platform/ax_platform_node_delegate.h" 10 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
10 #include "ui/gfx/geometry/rect_conversions.h" 11 #include "ui/gfx/geometry/rect_conversions.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) { 15 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) {
15 delegate_ = delegate; 16 delegate_ = delegate;
16 } 17 }
17 18
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 CHECK(!delegate_); 198 CHECK(!delegate_);
198 } 199 }
199 200
200 // static 201 // static
201 AXPlatformNodeBase* AXPlatformNodeBase::FromNativeViewAccessible( 202 AXPlatformNodeBase* AXPlatformNodeBase::FromNativeViewAccessible(
202 gfx::NativeViewAccessible accessible) { 203 gfx::NativeViewAccessible accessible) {
203 return static_cast<AXPlatformNodeBase*>( 204 return static_cast<AXPlatformNodeBase*>(
204 AXPlatformNode::FromNativeViewAccessible(accessible)); 205 AXPlatformNode::FromNativeViewAccessible(accessible));
205 } 206 }
206 207
208 bool AXPlatformNodeBase::SetTextSelection(int start_offset, int end_offset) {
209 ui::AXActionData action_data;
210 action_data.action = ui::AX_ACTION_SET_SELECTION;
211 action_data.anchor_node_id = action_data.focus_node_id = GetData().id;
212 action_data.anchor_offset = start_offset;
213 action_data.focus_offset = end_offset;
214 DCHECK(delegate_);
215 return delegate_->AccessibilityPerformAction(action_data);
216 }
217
207 } // namespace ui 218 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698