Chromium Code Reviews| Index: ui/views/controls/label.h |
| diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h |
| index 3881e8fa613073f0ff9253bc76612649e6ce7ae6..8e00d868b2d1323fa55485d71511e8dd7ec62fb4 100644 |
| --- a/ui/views/controls/label.h |
| +++ b/ui/views/controls/label.h |
| @@ -12,6 +12,7 @@ |
| #include "base/string16.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/gfx/font.h" |
| +#include "ui/gfx/text_constants.h" |
| #include "ui/views/view.h" |
| namespace views { |
| @@ -25,25 +26,11 @@ namespace views { |
| ///////////////////////////////////////////////////////////////////////////// |
| class VIEWS_EXPORT Label : public View { |
| public: |
| + // TODO(msw): Use gfx::HorizontalAlignment instead. |
| enum Alignment { ALIGN_LEFT = 0, |
| ALIGN_CENTER, |
| ALIGN_RIGHT }; |
| - // The following enum is used to indicate whether using the Chrome UI's |
| - // directionality as the label's directionality, or auto-detecting the label's |
| - // directionality. |
| - // |
| - // If the label text originates from the Chrome UI, we should use the Chrome |
| - // UI's directionality as the label's directionality. |
| - // |
| - // If the text originates from a web page, its directionality is determined |
| - // based on its first character with strong directionality, disregarding what |
| - // directionality the Chrome UI is. |
| - enum DirectionalityMode { |
| - USE_UI_DIRECTIONALITY = 0, |
| - AUTO_DETECT_DIRECTIONALITY |
| - }; |
| - |
| // The view class name. |
| static const char kViewClassName[]; |
| @@ -97,25 +84,25 @@ class VIEWS_EXPORT Label : public View { |
| void ClearEmbellishing(); |
| // Sets horizontal alignment. If the locale is RTL, and the directionality |
| - // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. |
| + // mode is gfx::DIRECTIONALITY_FROM_UI, the alignment is flipped around. |
| // |
| // Caveat: for labels originating from a web page, the directionality mode |
| - // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal |
| + // should be reset to gfx::DIRECTIONALITY_FROM_TEXT before the horizontal |
| // alignment is set. Otherwise, the label's alignment specified as a parameter |
| // will be flipped in RTL locales. |
| void SetHorizontalAlignment(Alignment alignment); |
| Alignment horizontal_alignment() const { return horiz_alignment_; } |
| - // Sets the directionality mode. The directionality mode is initialized to |
| - // USE_UI_DIRECTIONALITY when the label is constructed. USE_UI_DIRECTIONALITY |
| - // applies to every label that originates from the Chrome UI. However, if the |
| - // label originates from a web page, its directionality is auto-detected. |
| - void set_directionality_mode(DirectionalityMode mode) { |
| + // Sets the directionality mode; initialized to gfx::DIRECTIONALITY_FROM_UI |
| + // when the label is constructed. gfx::DIRECTIONALITY_FROM_UI applies to every |
| + // label that originates from the Chrome UI. However, if the label originates |
| + // from a web page, its directionality is auto-detected. |
| + void set_directionality_mode(gfx::DirectionalityMode mode) { |
| directionality_mode_ = mode; |
| } |
| - DirectionalityMode directionality_mode() const { |
| + gfx::DirectionalityMode directionality_mode() const { |
| return directionality_mode_; |
| } |
| @@ -274,10 +261,9 @@ class VIEWS_EXPORT Label : public View { |
| scoped_ptr<Background> mouse_over_background_; |
| // Whether to collapse the label when it's not visible. |
| bool collapse_when_hidden_; |
| - // The following member variable is used to control whether the |
| - // directionality is auto-detected based on first strong directionality |
| - // character or is determined by chrome UI's locale. |
| - DirectionalityMode directionality_mode_; |
| + // Controls whether the base text directionality is inherited from the text's |
| + // first strong directionality character or from the UI's locale. |
|
Alexei Svitkine (slow)
2012/07/30 22:29:16
Could also be forced right? Perhaps the comment do
msw
2012/07/31 03:03:06
Reverted this portion of the CL; will address in a
|
| + gfx::DirectionalityMode directionality_mode_; |
| // When embedded in a larger control that is focusable, setting this flag |
| // allows this view to be painted as focused even when it is itself not. |
| bool paint_as_focused_; |