OLD | NEW |
---|---|
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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 // Border renders differently when focused. | 733 // Border renders differently when focused. |
734 SchedulePaint(); | 734 SchedulePaint(); |
735 if (UseMd()) | 735 if (UseMd()) |
736 FocusRing::Uninstall(this); | 736 FocusRing::Uninstall(this); |
737 } | 737 } |
738 | 738 |
739 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 739 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
740 node_data->role = ui::AX_ROLE_COMBO_BOX; | 740 node_data->role = ui::AX_ROLE_COMBO_BOX; |
741 node_data->SetName(accessible_name_); | 741 node_data->SetName(accessible_name_); |
742 node_data->SetValue(model_->GetItemAt(selected_index_)); | 742 node_data->SetValue(model_->GetItemAt(selected_index_)); |
743 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, ui::AX_SUPPORTED_ACTION_OPEN); | |
sky
2016/11/28 22:32:00
Similar comment about enabled.
| |
743 node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); | 744 node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); |
744 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); | 745 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); |
745 } | 746 } |
746 | 747 |
747 void Combobox::ButtonPressed(Button* sender, const ui::Event& event) { | 748 void Combobox::ButtonPressed(Button* sender, const ui::Event& event) { |
748 if (!enabled()) | 749 if (!enabled()) |
749 return; | 750 return; |
750 | 751 |
751 if (!UseMd()) | 752 if (!UseMd()) |
752 RequestFocus(); | 753 RequestFocus(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
992 const int kMdPaddingWidth = 8; | 993 const int kMdPaddingWidth = 8; |
993 int arrow_pad = UseMd() ? kMdPaddingWidth | 994 int arrow_pad = UseMd() ? kMdPaddingWidth |
994 : PlatformStyle::kComboboxNormalArrowPadding; | 995 : PlatformStyle::kComboboxNormalArrowPadding; |
995 int padding = style_ == STYLE_NORMAL | 996 int padding = style_ == STYLE_NORMAL |
996 ? arrow_pad * 2 | 997 ? arrow_pad * 2 |
997 : kActionLeftPadding + kActionRightPadding; | 998 : kActionLeftPadding + kActionRightPadding; |
998 return ArrowSize().width() + padding; | 999 return ArrowSize().width() + padding; |
999 } | 1000 } |
1000 | 1001 |
1001 } // namespace views | 1002 } // namespace views |
OLD | NEW |