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

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

Issue 1036233005: Allow views::Label subclasses create RenderText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move implementation to match Created 5 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
« no previous file with comments | « 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 e627c7afc8ae30b3b8e52625da230b09103c0669..7b918eb74afd477797bc6b84b03146edd58a5eee 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -327,6 +327,25 @@ void Label::OnEnabledChanged() {
RecalculateColors();
}
+scoped_ptr<gfx::RenderText> Label::CreateRenderText(
+ const base::string16& text,
+ gfx::HorizontalAlignment alignment,
+ gfx::DirectionalityMode directionality,
+ gfx::ElideBehavior elide_behavior) {
+ scoped_ptr<gfx::RenderText> render_text(
+ render_text_->CreateInstanceOfSameType());
+ render_text->SetHorizontalAlignment(alignment);
+ render_text->SetDirectionalityMode(directionality);
+ render_text->SetElideBehavior(elide_behavior);
+ render_text->SetObscured(obscured());
+ render_text->SetMinLineHeight(line_height());
+ render_text->SetFontList(font_list());
+ render_text->set_shadows(shadows());
+ render_text->SetCursorEnabled(false);
+ render_text->SetText(text);
+ return render_text.Pass();
+}
+
void Label::PaintText(gfx::Canvas* canvas) {
MaybeBuildRenderTextLines();
for (size_t i = 0; i < lines_.size(); ++i)
@@ -406,25 +425,6 @@ void Label::ResetLayout() {
lines_.clear();
}
-scoped_ptr<gfx::RenderText> Label::CreateRenderText(
- const base::string16& text,
- gfx::HorizontalAlignment alignment,
- gfx::DirectionalityMode directionality,
- gfx::ElideBehavior elide_behavior) {
- scoped_ptr<gfx::RenderText> render_text(
- render_text_->CreateInstanceOfSameType());
- render_text->SetHorizontalAlignment(alignment);
- render_text->SetDirectionalityMode(directionality);
- render_text->SetElideBehavior(elide_behavior);
- render_text->SetObscured(obscured());
- render_text->SetMinLineHeight(line_height());
- render_text->SetFontList(font_list());
- render_text->set_shadows(shadows());
- render_text->SetCursorEnabled(false);
- render_text->SetText(text);
- return render_text.Pass();
-}
-
void Label::MaybeBuildRenderTextLines() {
if (!lines_.empty())
return;
« no previous file with comments | « ui/views/controls/label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698