| 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 744 |
| 745 if (selector_) | 745 if (selector_) |
| 746 selector_->OnViewBlur(); | 746 selector_->OnViewBlur(); |
| 747 // Border renders differently when focused. | 747 // Border renders differently when focused. |
| 748 SchedulePaint(); | 748 SchedulePaint(); |
| 749 if (UseMd()) | 749 if (UseMd()) |
| 750 FocusRing::Uninstall(this); | 750 FocusRing::Uninstall(this); |
| 751 } | 751 } |
| 752 | 752 |
| 753 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 753 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 754 node_data->role = ui::AX_ROLE_COMBO_BOX; | 754 // AX_ROLE_COMBO_BOX is for UI elements with a dropdown and an editable text |
| 755 // field, which views::Combobox does not have. Use AX_ROLE_POP_UP_BUTTON to |
| 756 // match an HTML <select> element. |
| 757 node_data->role = ui::AX_ROLE_POP_UP_BUTTON; |
| 758 |
| 755 node_data->SetName(accessible_name_); | 759 node_data->SetName(accessible_name_); |
| 756 node_data->SetValue(model_->GetItemAt(selected_index_)); | 760 node_data->SetValue(model_->GetItemAt(selected_index_)); |
| 757 if (enabled()) { | 761 if (enabled()) { |
| 758 node_data->AddIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB, | 762 node_data->AddIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB, |
| 759 ui::AX_DEFAULT_ACTION_VERB_OPEN); | 763 ui::AX_DEFAULT_ACTION_VERB_OPEN); |
| 760 } | 764 } |
| 761 node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); | 765 node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); |
| 762 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); | 766 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); |
| 763 } | 767 } |
| 764 | 768 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 constexpr int kMdPaddingWidth = 8; | 1014 constexpr int kMdPaddingWidth = 8; |
| 1011 constexpr int kNormalPaddingWidth = 7; | 1015 constexpr int kNormalPaddingWidth = 7; |
| 1012 int arrow_pad = UseMd() ? kMdPaddingWidth : kNormalPaddingWidth; | 1016 int arrow_pad = UseMd() ? kMdPaddingWidth : kNormalPaddingWidth; |
| 1013 int padding = style_ == STYLE_NORMAL | 1017 int padding = style_ == STYLE_NORMAL |
| 1014 ? arrow_pad * 2 | 1018 ? arrow_pad * 2 |
| 1015 : kActionLeftPadding + kActionRightPadding; | 1019 : kActionLeftPadding + kActionRightPadding; |
| 1016 return ArrowSize().width() + padding; | 1020 return ArrowSize().width() + padding; |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1019 } // namespace views | 1023 } // namespace views |
| OLD | NEW |