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

Side by Side Diff: ui/views/controls/button/menu_button.cc

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. 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/button/menu_button.h" 5 #include "ui/views/controls/button/menu_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/base/dragdrop/drag_drop_types.h" 9 #include "ui/base/dragdrop/drag_drop_types.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 bool MenuButton::OnKeyReleased(const ui::KeyEvent& event) { 292 bool MenuButton::OnKeyReleased(const ui::KeyEvent& event) {
293 // Override CustomButton's implementation, which presses the button when 293 // Override CustomButton's implementation, which presses the button when
294 // you press space and clicks it when you release space. For a MenuButton 294 // you press space and clicks it when you release space. For a MenuButton
295 // we always activate the menu on key press. 295 // we always activate the menu on key press.
296 return false; 296 return false;
297 } 297 }
298 298
299 void MenuButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { 299 void MenuButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
300 CustomButton::GetAccessibleNodeData(node_data); 300 CustomButton::GetAccessibleNodeData(node_data);
301 node_data->role = ui::AX_ROLE_POP_UP_BUTTON; 301 node_data->role = ui::AX_ROLE_POP_UP_BUTTON;
302 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP); 302 node_data->AddState(ui::AX_STATE_HASPOPUP);
303 if (enabled()) { 303 if (enabled()) {
304 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, 304 node_data->AddIntAttribute(ui::AX_ATTR_ACTION,
305 ui::AX_SUPPORTED_ACTION_OPEN); 305 ui::AX_SUPPORTED_ACTION_OPEN);
306 } 306 }
307 } 307 }
308 308
309 void MenuButton::PaintMenuMarker(gfx::Canvas* canvas) { 309 void MenuButton::PaintMenuMarker(gfx::Canvas* canvas) {
310 gfx::Insets insets = GetInsets(); 310 gfx::Insets insets = GetInsets();
311 311
312 // Using the Views mirroring infrastructure incorrectly flips icon content. 312 // Using the Views mirroring infrastructure incorrectly flips icon content.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (!GetWidget()) { 408 if (!GetWidget()) {
409 NOTREACHED(); 409 NOTREACHED();
410 return 0; 410 return 0;
411 } 411 }
412 412
413 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 413 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
414 return monitor_bounds.right() - 1; 414 return monitor_bounds.right() - 1;
415 } 415 }
416 416
417 } // namespace views 417 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698