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

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 2739893003: views: make comboboxes request focus when clicked (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 if (UseMd()) { 125 if (UseMd()) {
126 SetInkDropMode(PlatformStyle::kUseRipples ? InkDropMode::ON 126 SetInkDropMode(PlatformStyle::kUseRipples ? InkDropMode::ON
127 : InkDropMode::OFF); 127 : InkDropMode::OFF);
128 set_has_ink_drop_action_on_click(true); 128 set_has_ink_drop_action_on_click(true);
129 } 129 }
130 } 130 }
131 ~TransparentButton() override {} 131 ~TransparentButton() override {}
132 132
133 bool OnMousePressed(const ui::MouseEvent& mouse_event) override { 133 bool OnMousePressed(const ui::MouseEvent& mouse_event) override {
134 if (!UseMd()) 134 #if !defined(OS_MACOSX)
135 parent()->RequestFocus(); 135 // On Mac, comboboxes do not take focus on mouse click, but on other
136 // platforms they do.
137 parent()->RequestFocus();
138 #endif
136 return CustomButton::OnMousePressed(mouse_event); 139 return CustomButton::OnMousePressed(mouse_event);
137 } 140 }
138 141
139 double GetAnimationValue() const { 142 double GetAnimationValue() const {
140 return hover_animation().GetCurrentValue(); 143 return hover_animation().GetCurrentValue();
141 } 144 }
142 145
143 // Overridden from InkDropHost: 146 // Overridden from InkDropHost:
144 std::unique_ptr<InkDrop> CreateInkDrop() override { 147 std::unique_ptr<InkDrop> CreateInkDrop() override {
145 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); 148 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl();
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 const int kMdPaddingWidth = 8; 1016 const int kMdPaddingWidth = 8;
1014 int arrow_pad = UseMd() ? kMdPaddingWidth 1017 int arrow_pad = UseMd() ? kMdPaddingWidth
1015 : PlatformStyle::kComboboxNormalArrowPadding; 1018 : PlatformStyle::kComboboxNormalArrowPadding;
1016 int padding = style_ == STYLE_NORMAL 1019 int padding = style_ == STYLE_NORMAL
1017 ? arrow_pad * 2 1020 ? arrow_pad * 2
1018 : kActionLeftPadding + kActionRightPadding; 1021 : kActionLeftPadding + kActionRightPadding;
1019 return ArrowSize().width() + padding; 1022 return ArrowSize().width() + padding;
1020 } 1023 }
1021 1024
1022 } // namespace views 1025 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698