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

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

Issue 2889623002: Apply View::set_preferred_size in some more places. (Closed)
Patch Set: fix SystemMenuButton Created 3 years, 7 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 c8cc3f41ae614a61c4d5f5a74ef9e45761e9eba2..abd2fab17ab6a8d1949cfcc2e48aa5418e44fa14 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -98,20 +98,6 @@ void ImageButton::SetMinimumImageSize(const gfx::Size& size) {
////////////////////////////////////////////////////////////////////////////////
// ImageButton, View overrides:
-gfx::Size ImageButton::GetPreferredSize() const {
- gfx::Size size(kDefaultWidth, kDefaultHeight);
- if (!images_[STATE_NORMAL].isNull()) {
- size = gfx::Size(images_[STATE_NORMAL].width(),
- images_[STATE_NORMAL].height());
- }
-
- size.SetToMax(minimum_image_size_);
-
- gfx::Insets insets = GetInsets();
- size.Enlarge(insets.width(), insets.height());
- return size;
-}
-
const char* ImageButton::GetClassName() const {
return kViewClassName;
}
@@ -142,6 +128,20 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) {
Painter::PaintFocusPainter(this, canvas, focus_painter());
}
+gfx::Size ImageButton::CalculatePreferredSize() const {
+ gfx::Size size(kDefaultWidth, kDefaultHeight);
+ if (!images_[STATE_NORMAL].isNull()) {
+ size = gfx::Size(images_[STATE_NORMAL].width(),
+ images_[STATE_NORMAL].height());
+ }
+
+ size.SetToMax(minimum_image_size_);
+
+ gfx::Insets insets = GetInsets();
+ size.Enlarge(insets.width(), insets.height());
+ return size;
+}
+
////////////////////////////////////////////////////////////////////////////////
// ImageButton, protected:
« 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