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

Unified Diff: ui/views/controls/textfield/textfield.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 217bb57a1247b35ab9fe89594162a04427f8c6ba..05a200aee0f8efcc4a506e6dc27c33acf228ed9b 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -897,6 +897,15 @@ void Textfield::GetAccessibleNodeData(ui::AXNodeData* node_data) {
}
bool Textfield::HandleAccessibleAction(const ui::AXActionData& action_data) {
+ if (action_data.action == ui::AX_ACTION_SET_SELECTION) {
+ if (action_data.anchor_node_id != action_data.focus_node_id)
+ return false;
+ // TODO(nektar): Check that the focus_node_id matches the ID of this node.
msw 2017/02/08 22:11:40 q: can you address this now or file a bug and foll
+ const gfx::Range range(action_data.anchor_offset, action_data.focus_offset);
+ return SetSelectionRange(range);
+ }
+
+ // Remaining actions cannot be performed on readonly fields.
if (read_only())
return View::HandleAccessibleAction(action_data);
@@ -1880,11 +1889,7 @@ void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) {
StartBlinkingCursor();
else
StopBlinkingCursor();
- if (!text_changed) {
- // TEXT_CHANGED implies TEXT_SELECTION_CHANGED, so we only need to fire
- // this if only the selection changed.
- NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true);
- }
+ NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true);
}
if (text_changed || cursor_changed) {
OnCaretBoundsChanged();
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698