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

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

Issue 2539523002: Fix LabelButton size calculation for non-default fonts. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 9c471671bb0452c9f16b31b2d1404e5f41a84b11..e33b7b07585aad0811480eda2d1844dd234035a3 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -249,7 +249,7 @@ gfx::Size LabelButton::GetPreferredSize() const {
return cached_preferred_size_;
// Use a temporary label copy for sizing to avoid calculation side-effects.
- Label label(GetText(), cached_normal_font_list_);
+ Label label(GetText(), label_->font_list());
label.SetShadows(label_->shadows());
if (style_ == STYLE_BUTTON && PlatformStyle::kDefaultLabelButtonHasBoldFont) {
@@ -258,7 +258,7 @@ gfx::Size LabelButton::GetPreferredSize() const {
const int current_width = label.GetPreferredSize().width();
label.SetFontList(cached_bold_font_list_);
if (label.GetPreferredSize().width() < current_width)
- label.SetFontList(cached_normal_font_list_);
+ label.SetFontList(label_->font_list());
}
// Calculate the required size.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698