| Index: ui/views/controls/label.cc
|
| diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
|
| index f907f9f51ae1959ce9f051b9c277938bc8d9f45a..04d766d4210f907febf9991388cd2a80cc04161b 100644
|
| --- a/ui/views/controls/label.cc
|
| +++ b/ui/views/controls/label.cc
|
| @@ -22,6 +22,7 @@
|
| #include "ui/gfx/color_utils.h"
|
| #include "ui/gfx/font.h"
|
| #include "ui/gfx/insets.h"
|
| +#include "ui/gfx/render_text.h"
|
| #include "ui/views/background.h"
|
|
|
| namespace views {
|
| @@ -113,9 +114,9 @@ void Label::ClearEmbellishing() {
|
|
|
| void Label::SetHorizontalAlignment(Alignment alignment) {
|
| // If the View's UI layout is right-to-left and directionality_mode_ is
|
| - // USE_UI_DIRECTIONALITY, we need to flip the alignment so that the alignment
|
| + // gfx::DERIVE_FROM_UI, we need to flip the alignment so that the alignment
|
| // settings take into account the text directionality.
|
| - if (base::i18n::IsRTL() && (directionality_mode_ == USE_UI_DIRECTIONALITY) &&
|
| + if (base::i18n::IsRTL() && (directionality_mode_ == gfx::DERIVE_FROM_UI) &&
|
| (alignment != ALIGN_CENTER))
|
| alignment = (alignment == ALIGN_LEFT) ? ALIGN_RIGHT : ALIGN_LEFT;
|
| if (horiz_alignment_ != alignment) {
|
| @@ -373,7 +374,7 @@ void Label::Init(const string16& text, const gfx::Font& font) {
|
| elide_in_middle_ = false;
|
| is_email_ = false;
|
| collapse_when_hidden_ = false;
|
| - directionality_mode_ = USE_UI_DIRECTIONALITY;
|
| + directionality_mode_ = gfx::DERIVE_FROM_UI;
|
| paint_as_focused_ = false;
|
| has_focus_border_ = false;
|
| enabled_shadow_color_ = 0;
|
| @@ -444,8 +445,8 @@ int Label::ComputeDrawStringFlags() const {
|
| if (SkColorGetA(background_color_) != 0xFF)
|
| flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING;
|
|
|
| - if (directionality_mode_ == AUTO_DETECT_DIRECTIONALITY) {
|
| - base::i18n::TextDirection direction =
|
| + if (directionality_mode_ == gfx::DERIVE_FROM_TEXT) {
|
| + const base::i18n::TextDirection direction =
|
| base::i18n::GetFirstStrongCharacterDirection(text_);
|
| if (direction == base::i18n::RIGHT_TO_LEFT)
|
| flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
|
|
|