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

Unified Diff: ui/views/controls/label.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Shred Typography class, follow-up on some other things. fix compile. Created 3 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/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 05322303bb6f85fef8affab9e3170459c0fbaa93..da56344255588b390c929b0b6531076c291f8551 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -35,6 +35,7 @@
#include "ui/views/focus/focus_manager.h"
#include "ui/views/native_cursor.h"
#include "ui/views/selection_controller.h"
+#include "ui/views/style/typography_provider.h"
namespace views {
// static
@@ -44,12 +45,17 @@ const int Label::kFocusBorderPadding = 1;
Label::Label() : Label(base::string16()) {
}
-Label::Label(const base::string16& text) : Label(text, GetDefaultFontList()) {
+Label::Label(const base::string16& text)
+ : Label(text, TextContext::CONTROL_LABEL, TextStyle::PRIMARY) {}
+
+Label::Label(const base::string16& text, TextContext context, TextStyle style)
+ : context_menu_contents_(this) {
+ Init(text, TypographyProvider::Get().GetFont(context, style));
}
-Label::Label(const base::string16& text, const gfx::FontList& font_list)
+Label::Label(const base::string16& text, const CustomFont& font)
: context_menu_contents_(this) {
- Init(text, font_list);
+ Init(text, font.font_list);
}
Label::~Label() {
@@ -57,8 +63,8 @@ Label::~Label() {
// static
const gfx::FontList& Label::GetDefaultFontList() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- return rb.GetFontListWithDelta(ui::kLabelFontSizeDelta);
+ return TypographyProvider::Get().GetFont(TextContext::CONTROL_LABEL,
+ TextStyle::PRIMARY);
}
void Label::SetFontList(const gfx::FontList& font_list) {

Powered by Google App Engine
This is Rietveld 408576698