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

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

Issue 2622893003: Reland f5157480667e99269e0062e9df1df3875db with fix for compile failure. (Closed)
Patch Set: fix in two BUILD.gns Created 3 years, 11 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/image_button.h ('k') | no next file » | 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 e875612c10ea5dbceaac42ce1796fb633983b731..fd2151e2a1aab73c6ad529ec5a909ffd9ea309ab 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -48,10 +48,14 @@ const gfx::ImageSkia& ImageButton::GetImage(ButtonState state) const {
}
void ImageButton::SetImage(ButtonState for_state, const gfx::ImageSkia* image) {
+ SetImage(for_state, image ? *image : gfx::ImageSkia());
+}
+
+void ImageButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) {
if (for_state == STATE_HOVERED)
- set_animate_on_state_change(image != nullptr);
+ set_animate_on_state_change(!image.isNull());
const gfx::Size old_preferred_size = GetPreferredSize();
- images_[for_state] = image ? *image : gfx::ImageSkia();
+ images_[for_state] = image;
if (old_preferred_size != GetPreferredSize())
PreferredSizeChanged();
@@ -250,11 +254,11 @@ const gfx::ImageSkia& ToggleImageButton::GetImage(
}
void ToggleImageButton::SetImage(ButtonState image_state,
- const gfx::ImageSkia* image) {
+ const gfx::ImageSkia& image) {
if (toggled_) {
- alternate_images_[image_state] = image ? *image : gfx::ImageSkia();
+ alternate_images_[image_state] = image;
} else {
- images_[image_state] = image ? *image : gfx::ImageSkia();
+ images_[image_state] = image;
if (state() == image_state)
SchedulePaint();
}
« no previous file with comments | « ui/views/controls/button/image_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698