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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 2327673003: combobox: don't animate state changes in TransparentButton (Closed)
Patch Set: conditional SetAnimationDuration Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index bb8623a26f631e183c6b62289581e95a1336fc19..8d63f440617cfddf265c1aad140f368ecb8ca542 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -114,9 +114,11 @@ gfx::Rect PositionArrowWithinContainer(const gfx::Rect& container_bounds,
// The transparent button which holds a button state but is not rendered.
class TransparentButton : public CustomButton {
public:
- TransparentButton(ButtonListener* listener)
+ TransparentButton(ButtonListener* listener, bool animate_state_change)
: CustomButton(listener) {
- SetAnimationDuration(LabelButton::kHoverAnimationDurationMs);
+ set_animate_on_state_change(animate_state_change);
+ if (animate_state_change)
+ SetAnimationDuration(LabelButton::kHoverAnimationDurationMs);
SetFocusBehavior(FocusBehavior::NEVER);
set_notify_action(PlatformStyle::kMenuNotifyActivationAction);
@@ -394,8 +396,8 @@ Combobox::Combobox(ui::ComboboxModel* model, Style style)
selected_index_(style == STYLE_ACTION ? 0 : model_->GetDefaultIndex()),
invalid_(false),
menu_model_(new ComboboxMenuModel(this, model)),
- text_button_(new TransparentButton(this)),
- arrow_button_(new TransparentButton(this)),
+ text_button_(new TransparentButton(this, style_ == STYLE_ACTION)),
+ arrow_button_(new TransparentButton(this, style_ == STYLE_ACTION)),
size_to_largest_label_(style_ == STYLE_NORMAL),
weak_ptr_factory_(this) {
ModelChanged();
« 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