Commit 8071ca72 authored by Collin Baker's avatar Collin Baker Committed by Commit Bot

Repaint ImageButton whenever SetImage is called

Currently, ImageButton::SetImage() only schedules a paint when
|for_state| matches the current state. However, this is wrong: any
state that doesn't have an image falls back to the STATE_NORMAL image.

Instead, this CL makes SetImage() always call SchedulePaint().

Bug: 920576
Change-Id: I8119a44b63754a11426db804394593e0e0c0d495
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1644014
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666533}
parent f43ec1d7
...@@ -55,8 +55,9 @@ void ImageButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) { ...@@ -55,8 +55,9 @@ void ImageButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) {
if (old_preferred_size != GetPreferredSize()) if (old_preferred_size != GetPreferredSize())
PreferredSizeChanged(); PreferredSizeChanged();
if (state() == for_state) // Even if |for_state| isn't the current state this image could be painted;
SchedulePaint(); // see |GetImageToPaint()|. So, always repaint.
SchedulePaint();
} }
void ImageButton::SetBackgroundImage(SkColor color, void ImageButton::SetBackgroundImage(SkColor color,
......
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