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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 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
Index: ui/views/controls/button/text_button.cc
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc
index 99ac86b51dccfe1155ce09e8e82836a87b3081e9..56a2ceaa8482ed8d08b1551ef267819b1deef048 100644
--- a/ui/views/controls/button/text_button.cc
+++ b/ui/views/controls/button/text_button.cc
@@ -276,7 +276,7 @@ void TextButtonBase::SetMultiLine(bool multi_line) {
}
}
-gfx::Size TextButtonBase::GetPreferredSize() {
+gfx::Size TextButtonBase::GetPreferredSize() const {
gfx::Insets insets = GetInsets();
// Use the max size to set the button boundaries.
@@ -296,7 +296,7 @@ gfx::Size TextButtonBase::GetPreferredSize() {
return prefsize;
}
-int TextButtonBase::GetHeightForWidth(int w) {
+int TextButtonBase::GetHeightForWidth(int w) const {
if (!multi_line_)
return View::GetHeightForWidth(w);
@@ -347,7 +347,8 @@ void TextButtonBase::UpdateTextSize() {
}
}
-void TextButtonBase::CalculateTextSize(gfx::Size* text_size, int max_width) {
+void TextButtonBase::CalculateTextSize(gfx::Size* text_size,
+ int max_width) const {
int h = font_list_.GetHeight();
int w = multi_line_ ? max_width : 0;
int flags = ComputeCanvasStringFlags();
@@ -477,7 +478,7 @@ void TextButtonBase::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
}
}
-gfx::Size TextButtonBase::GetMinimumSize() {
+gfx::Size TextButtonBase::GetMinimumSize() const {
return max_text_size_;
}
@@ -593,7 +594,7 @@ void TextButton::SetPushedIcon(const gfx::ImageSkia& icon) {
SchedulePaint();
}
-gfx::Size TextButton::GetPreferredSize() {
+gfx::Size TextButton::GetPreferredSize() const {
gfx::Size prefsize(TextButtonBase::GetPreferredSize());
prefsize.Enlarge(icon_.width(), 0);
prefsize.set_height(std::max(prefsize.height(), icon_.height()));

Powered by Google App Engine
This is Rietveld 408576698