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/label.cc

Issue 2765883004: Implement Harmony typography spec. (Closed)
Patch Set: test, nit comment 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
« ui/views/controls/label.h ('K') | « ui/views/controls/label.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index f2d891d4e17ea5c329b77ce0e71d087107ccd48e..e88573fc3d585aa33778c62f7e0715c3fc6b1276 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -48,12 +48,15 @@ Label::Label(const base::string16& text)
Label::Label(const base::string16& text, int text_context, int text_style)
: context_menu_contents_(this) {
- Init(text, style::GetFont(text_context, text_style));
+ Init(text);
+ render_text_->SetFontList(style::GetFont(text_context, text_style));
+ SetLineHeight(style::GetLineHeight(text_context, text_style));
}
Label::Label(const base::string16& text, const CustomFont& font)
: context_menu_contents_(this) {
- Init(text, font.font_list);
+ Init(text);
+ render_text_->SetFontList(font.font_list);
}
Label::~Label() {
@@ -794,14 +797,13 @@ const gfx::RenderText* Label::GetRenderTextForSelectionController() const {
return lines_[0].get();
}
-void Label::Init(const base::string16& text, const gfx::FontList& font_list) {
+void Label::Init(const base::string16& text) {
render_text_.reset(gfx::RenderText::CreateInstance());
render_text_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
render_text_->SetDirectionalityMode(gfx::DIRECTIONALITY_FROM_TEXT);
// NOTE: |render_text_| should not be elided at all. This is used to keep some
// properties and to compute the size of the string.
render_text_->SetElideBehavior(gfx::NO_ELIDE);
- render_text_->SetFontList(font_list);
render_text_->SetCursorEnabled(false);
render_text_->SetWordWrapBehavior(gfx::TRUNCATE_LONG_WORDS);
« ui/views/controls/label.h ('K') | « ui/views/controls/label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698