Commit 9469d572 authored by ellyjones's avatar ellyjones Committed by Commit bot

combobox: don't animate state changes in TransparentButton

TransparentButton has state-change animations enabled despite being invisible,
which causes a bunch of spurious repaints of the combobox on mouse enter/exit.

BUG=645266

Review-Url: https://codereview.chromium.org/2327673003
Cr-Commit-Position: refs/heads/master@{#418824}
parent 44049308
......@@ -114,8 +114,10 @@ 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) {
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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment