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

Side by Side Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 2106953005: Mac: Add new accessibility attributes for textfields (and some for all views). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ax-attrs
Patch Set: Typo. Created 4 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/views/accessibility/native_view_accessibility.h" 5 #include "ui/views/accessibility/native_view_accessibility.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/accessibility/ax_view_state.h" 9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 data_ = ui::AXNodeData(); 56 data_ = ui::AXNodeData();
57 data_.role = state.role; 57 data_.role = state.role;
58 data_.state = state.state(); 58 data_.state = state.state();
59 data_.location = view_->GetBoundsInScreen(); 59 data_.location = view_->GetBoundsInScreen();
60 data_.AddStringAttribute(ui::AX_ATTR_NAME, base::UTF16ToUTF8(state.name)); 60 data_.AddStringAttribute(ui::AX_ATTR_NAME, base::UTF16ToUTF8(state.name));
61 data_.AddStringAttribute(ui::AX_ATTR_VALUE, base::UTF16ToUTF8(state.value)); 61 data_.AddStringAttribute(ui::AX_ATTR_VALUE, base::UTF16ToUTF8(state.value));
62 data_.AddStringAttribute(ui::AX_ATTR_ACTION, 62 data_.AddStringAttribute(ui::AX_ATTR_ACTION,
63 base::UTF16ToUTF8(state.default_action)); 63 base::UTF16ToUTF8(state.default_action));
64 data_.AddStringAttribute(ui::AX_ATTR_SHORTCUT, 64 data_.AddStringAttribute(ui::AX_ATTR_SHORTCUT,
65 base::UTF16ToUTF8(state.keyboard_shortcut)); 65 base::UTF16ToUTF8(state.keyboard_shortcut));
66 data_.AddStringAttribute(ui::AX_ATTR_PLACEHOLDER,
67 base::UTF16ToUTF8(state.placeholder));
66 data_.AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, state.selection_start); 68 data_.AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, state.selection_start);
67 data_.AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, state.selection_end); 69 data_.AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, state.selection_end);
68 70
69 data_.state |= (1 << ui::AX_STATE_FOCUSABLE); 71 data_.state |= (1 << ui::AX_STATE_FOCUSABLE);
72 if (view_->HasFocus())
dmazzoni 2016/06/29 16:24:11 You shouldn't need this. Use NativeViewAccessibili
Patti Lor 2016/06/30 05:29:54 Done.
73 data_.state |= (1 << ui::AX_STATE_FOCUSED);
70 74
71 if (!view_->enabled()) 75 if (!view_->enabled())
72 data_.state |= (1 << ui::AX_STATE_DISABLED); 76 data_.state |= (1 << ui::AX_STATE_DISABLED);
73 77
74 if (!view_->visible()) 78 if (!view_->visible())
75 data_.state |= (1 << ui::AX_STATE_INVISIBLE); 79 data_.state |= (1 << ui::AX_STATE_INVISIBLE);
76 80
77 return data_; 81 return data_;
78 } 82 }
79 83
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 child_widget_platform_node->GetDelegate()); 247 child_widget_platform_node->GetDelegate());
244 if (child_widget_view_accessibility->parent_widget() != widget) 248 if (child_widget_view_accessibility->parent_widget() != widget)
245 child_widget_view_accessibility->SetParentWidget(widget); 249 child_widget_view_accessibility->SetParentWidget(widget);
246 } 250 }
247 251
248 result_child_widgets->push_back(child_widget); 252 result_child_widgets->push_back(child_widget);
249 } 253 }
250 } 254 }
251 255
252 } // namespace views 256 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698