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

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

Issue 2556833002: Make LabelButton::SetFontList protected. (Closed)
Patch Set: update test Created 4 years 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/label_button.h ('k') | ui/views/controls/button/label_button_unittest.cc » ('j') | 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 03738f883802bfe35e3d00636ae559ae0e8e2475..21891fca927332c33e9336ab28c08d6d08eabedd 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -159,25 +159,13 @@ void LabelButton::SetTextSubpixelRenderingEnabled(bool enabled) {
label_->SetSubpixelRenderingEnabled(enabled);
}
-const gfx::FontList& LabelButton::GetFontList() const {
- return label_->font_list();
-}
-
-void LabelButton::SetFontList(const gfx::FontList& font_list) {
- cached_normal_font_list_ = font_list;
- if (PlatformStyle::kDefaultLabelButtonHasBoldFont) {
- cached_bold_font_list_ = font_list.DeriveWithWeight(
- GetValueBolderThan(font_list.GetFontWeight()));
- if (is_default_) {
- label_->SetFontList(cached_bold_font_list_);
- return;
- }
- }
- label_->SetFontList(cached_normal_font_list_);
+void LabelButton::SetFontListDeprecated(const gfx::FontList& font_list) {
+ SetFontList(font_list);
}
void LabelButton::AdjustFontSize(int font_size_delta) {
- LabelButton::SetFontList(GetFontList().DeriveWithSizeDelta(font_size_delta));
+ LabelButton::SetFontList(
+ label()->font_list().DeriveWithSizeDelta(font_size_delta));
}
void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) {
@@ -393,6 +381,19 @@ gfx::Rect LabelButton::GetChildAreaBounds() {
return GetLocalBounds();
}
+void LabelButton::SetFontList(const gfx::FontList& font_list) {
+ cached_normal_font_list_ = font_list;
+ if (PlatformStyle::kDefaultLabelButtonHasBoldFont) {
+ cached_bold_font_list_ = font_list.DeriveWithWeight(
+ GetValueBolderThan(font_list.GetFontWeight()));
+ if (is_default_) {
+ label_->SetFontList(cached_bold_font_list_);
+ return;
+ }
+ }
+ label_->SetFontList(cached_normal_font_list_);
+}
+
void LabelButton::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
Painter::PaintFocusPainter(this, canvas, focus_painter_.get());
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/label_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698