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

Side by Side Diff: ui/views/controls/menu/menu_item_view.cc

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Revert comment. Created 3 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/controls/menu/menu_item_view.h" 5 #include "ui/views/controls/menu/menu_item_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void MenuItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 156 void MenuItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
157 node_data->role = ui::AX_ROLE_MENU_ITEM; 157 node_data->role = ui::AX_ROLE_MENU_ITEM;
158 158
159 base::string16 item_text; 159 base::string16 item_text;
160 if (IsContainer()) { 160 if (IsContainer()) {
161 // The first child is taking over, just use its accessible name instead of 161 // The first child is taking over, just use its accessible name instead of
162 // |title_|. 162 // |title_|.
163 View* child = child_at(0); 163 View* child = child_at(0);
164 ui::AXNodeData node_data; 164 ui::AXNodeData node_data;
165 node_data.ClearBitfields();
165 child->GetAccessibleNodeData(&node_data); 166 child->GetAccessibleNodeData(&node_data);
166 item_text = node_data.GetString16Attribute(ui::AX_ATTR_NAME); 167 item_text = node_data.GetString16Attribute(ui::AX_ATTR_NAME);
167 } else { 168 } else {
168 item_text = title_; 169 item_text = title_;
169 } 170 }
170 node_data->SetName(GetAccessibleNameForMenuItem(item_text, GetMinorText())); 171 node_data->SetName(GetAccessibleNameForMenuItem(item_text, GetMinorText()));
171 172
172 switch (GetType()) { 173 switch (GetType()) {
173 case SUBMENU: 174 case SUBMENU:
174 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP); 175 node_data->AddState(ui::AX_STATE_HASPOPUP);
175 break; 176 break;
176 case CHECKBOX: 177 case CHECKBOX:
177 case RADIO: { 178 case RADIO: {
178 const bool is_checked = GetDelegate()->IsItemChecked(GetCommand()); 179 const bool is_checked = GetDelegate()->IsItemChecked(GetCommand());
179 const ui::AXCheckedState checked_state = 180 const ui::AXCheckedState checked_state =
180 is_checked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE; 181 is_checked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE;
181 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); 182 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state);
182 } break; 183 } break;
183 case NORMAL: 184 case NORMAL:
184 case SEPARATOR: 185 case SEPARATOR:
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 } else { 1069 } else {
1069 const Type& type = menu_item->GetType(); 1070 const Type& type = menu_item->GetType();
1070 if (type == CHECKBOX || type == RADIO) 1071 if (type == CHECKBOX || type == RADIO)
1071 return true; 1072 return true;
1072 } 1073 }
1073 } 1074 }
1074 return false; 1075 return false;
1075 } 1076 }
1076 1077
1077 } // namespace views 1078 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698