Index: ui/views/controls/label.cc |
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc |
index 9412a6ab792a2827454cdbd828ea5ca720eb9828..69375a4392726de1742f4fb60de13ef3c677f9ac 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/text_constants.h" |
#include "ui/views/background.h" |
namespace views { |
@@ -102,10 +103,10 @@ 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 |
- // settings take into account the text directionality. |
- if (base::i18n::IsRTL() && (directionality_mode_ == USE_UI_DIRECTIONALITY) && |
- (alignment != ALIGN_CENTER)) |
+ // gfx::DIRECTIONALITY_FROM_UI, we need to flip the alignment so that the |
+ // alignment settings take into account the text directionality. |
+ if (base::i18n::IsRTL() && (alignment != ALIGN_CENTER) && |
+ (directionality_mode_ == gfx::DIRECTIONALITY_FROM_UI)) |
xji
2012/07/30 18:32:16
I can see that you are trying to re-use gfx::Direc
msw
2012/07/31 03:03:06
You're right; Label doesn't currently support gfx:
|
alignment = (alignment == ALIGN_LEFT) ? ALIGN_RIGHT : ALIGN_LEFT; |
if (horiz_alignment_ != alignment) { |
horiz_alignment_ = alignment; |
@@ -362,7 +363,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::DIRECTIONALITY_FROM_UI; |
paint_as_focused_ = false; |
has_focus_border_ = false; |
enabled_shadow_color_ = 0; |
@@ -433,8 +434,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::DIRECTIONALITY_FROM_TEXT) { |
+ const base::i18n::TextDirection direction = |
xji
2012/07/30 19:00:04
if we introduce gfx::Canvas::DIRECTIONALITY_FROM_T
msw
2012/07/31 03:03:06
I've reverted these changes in this CL and I'll fo
|
base::i18n::GetFirstStrongCharacterDirection(text_); |
if (direction == base::i18n::RIGHT_TO_LEFT) |
flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; |