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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 754 } |
755 | 755 |
756 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 756 void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
757 node_data->role = ui::AX_ROLE_COMBO_BOX; | 757 node_data->role = ui::AX_ROLE_COMBO_BOX; |
758 node_data->SetName(accessible_name_); | 758 node_data->SetName(accessible_name_); |
759 node_data->SetValue(model_->GetItemAt(selected_index_)); | 759 node_data->SetValue(model_->GetItemAt(selected_index_)); |
760 if (enabled()) { | 760 if (enabled()) { |
761 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, | 761 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, |
762 ui::AX_SUPPORTED_ACTION_OPEN); | 762 ui::AX_SUPPORTED_ACTION_OPEN); |
763 } | 763 } |
764 node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); | 764 node_data->AddValidatedIntAttribute(ui::AX_ATTR_INDEX_IN_SET, |
| 765 selected_index_); |
765 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); | 766 node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount()); |
766 } | 767 } |
767 | 768 |
768 void Combobox::ButtonPressed(Button* sender, const ui::Event& event) { | 769 void Combobox::ButtonPressed(Button* sender, const ui::Event& event) { |
769 if (!enabled()) | 770 if (!enabled()) |
770 return; | 771 return; |
771 | 772 |
772 if (!UseMd()) | 773 if (!UseMd()) |
773 RequestFocus(); | 774 RequestFocus(); |
774 | 775 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 const int kMdPaddingWidth = 8; | 1014 const int kMdPaddingWidth = 8; |
1014 int arrow_pad = UseMd() ? kMdPaddingWidth | 1015 int arrow_pad = UseMd() ? kMdPaddingWidth |
1015 : PlatformStyle::kComboboxNormalArrowPadding; | 1016 : PlatformStyle::kComboboxNormalArrowPadding; |
1016 int padding = style_ == STYLE_NORMAL | 1017 int padding = style_ == STYLE_NORMAL |
1017 ? arrow_pad * 2 | 1018 ? arrow_pad * 2 |
1018 : kActionLeftPadding + kActionRightPadding; | 1019 : kActionLeftPadding + kActionRightPadding; |
1019 return ArrowSize().width() + padding; | 1020 return ArrowSize().width() + padding; |
1020 } | 1021 } |
1021 | 1022 |
1022 } // namespace views | 1023 } // namespace views |
OLD | NEW |