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

Unified Diff: ui/views/controls/button/image_button.cc

Issue 2406323002: CustomButton: restrict animation repaints to buttons that actually animate (Closed)
Patch Set: don't use bool(T*) Created 4 years, 2 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 | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/image_button.cc
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc
index 483d971bbea836c6fceacbee82433f7dcf3704a6..d9426bea1f3daecc2faa985e6e4f9741a79645be 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -48,6 +48,8 @@ const gfx::ImageSkia& ImageButton::GetImage(ButtonState state) const {
}
void ImageButton::SetImage(ButtonState for_state, const gfx::ImageSkia* image) {
+ if (for_state == STATE_HOVERED)
+ set_animate_on_state_change(image != nullptr);
images_[for_state] = image ? *image : gfx::ImageSkia();
PreferredSizeChanged();
if (state() == for_state)
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698