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

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

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index f192e1282b258644d0a913accb63245831b2b5e4..825b3cc1f70db3d66279bc3a3aa1197429854d66 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -45,10 +45,9 @@ const gfx::FontList& GetDefaultNormalFontList() {
const gfx::FontList& GetDefaultBoldFontList() {
static base::LazyInstance<gfx::FontList>::Leaky font_list =
LAZY_INSTANCE_INITIALIZER;
- if ((font_list.Get().GetFontStyle() & gfx::Font::BOLD) == 0) {
- font_list.Get() = font_list.Get().
- DeriveWithStyle(font_list.Get().GetFontStyle() | gfx::Font::BOLD);
- DCHECK_NE(font_list.Get().GetFontStyle() & gfx::Font::BOLD, 0);
+ if (font_list.Get().GetFontWeight() != gfx::Font::WEIGHT_BOLD) {
msw 2016/03/22 01:53:44 Hmm, I wonder if this should be < (or something sm
Mikus 2016/03/22 14:19:51 Done.
+ font_list.Get() = font_list.Get().DeriveWithWeight(gfx::Font::WEIGHT_BOLD);
+ DCHECK_EQ(font_list.Get().GetFontWeight(), gfx::Font::WEIGHT_BOLD);
}
return font_list.Get();
}
@@ -164,8 +163,7 @@ const gfx::FontList& LabelButton::GetFontList() const {
void LabelButton::SetFontList(const gfx::FontList& font_list) {
cached_normal_font_list_ = font_list;
- cached_bold_font_list_ = font_list.DeriveWithStyle(
- font_list.GetFontStyle() | gfx::Font::BOLD);
+ cached_bold_font_list_ = font_list.DeriveWithWeight(gfx::Font::WEIGHT_BOLD);
// STYLE_BUTTON uses bold text to indicate default buttons.
label_->SetFontList(

Powered by Google App Engine
This is Rietveld 408576698