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

Unified Diff: ui/message_center/views/bounded_label.cc

Issue 23228004: Prepare to use gfx::RenderText in views::Label. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert Label implementation changes. Created 6 years, 5 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/gfx/render_text.cc ('k') | ui/views/controls/button/blue_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/bounded_label.cc
diff --git a/ui/message_center/views/bounded_label.cc b/ui/message_center/views/bounded_label.cc
index 99c66f80b77c51d9594f815115f5f15e49b6fff8..abbdcf3c19bf86e02697bfdde32f28685c786d60 100644
--- a/ui/message_center/views/bounded_label.cc
+++ b/ui/message_center/views/bounded_label.cc
@@ -182,7 +182,8 @@ void InnerBoundedLabel::OnPaint(gfx::Canvas* canvas) {
wrapped_text_lines_ = lines;
}
bounds.set_x(GetMirroredXForRect(bounds));
- PaintText(canvas, wrapped_text_, bounds, GetTextFlags());
+ canvas->DrawStringRectWithFlags(
+ wrapped_text_, font_list(), enabled_color(), bounds, GetTextFlags());
}
}
@@ -198,20 +199,11 @@ int InnerBoundedLabel::GetTextFlags() {
if (SkColorGetA(background_color()) != 0xFF)
flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING;
- if (directionality_mode() == gfx::DIRECTIONALITY_FORCE_LTR) {
- flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
- } else if (directionality_mode() == gfx::DIRECTIONALITY_FORCE_RTL) {
- flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
- } else if (directionality_mode() == gfx::DIRECTIONALITY_FROM_TEXT) {
- base::i18n::TextDirection direction =
- base::i18n::GetFirstStrongCharacterDirection(text());
- if (direction == base::i18n::RIGHT_TO_LEFT)
- flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
- else
- flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
- }
-
- return flags;
+ const base::i18n::TextDirection direction =
+ base::i18n::GetFirstStrongCharacterDirection(text());
+ if (direction == base::i18n::RIGHT_TO_LEFT)
+ return flags | gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
+ return flags | gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
}
void InnerBoundedLabel::ClearCaches() {
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/controls/button/blue_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698