Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index a6265b06feae687d13eb1f361e8eb956216548ea..b36b0ce78b1f7145c9a87cb5b7aed4da1e1be6e1 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -95,18 +95,26 @@ typedef std::vector<StyleRange> StyleRanges; |
| // WORD_BREAK cursor movements should stop at the nearest word boundaries. |
| // LINE_BREAK cursor movements should stop at the text ends as shown on screen. |
| enum BreakType { |
| - CHARACTER_BREAK, |
| + CHARACTER_BREAK = 0, |
|
Alexei Svitkine (slow)
2012/07/27 11:40:36
Does our style guide require this?
msw
2012/07/28 01:17:11
Not explicitly, but the Google C++ style guide sho
|
| WORD_BREAK, |
| LINE_BREAK, |
| }; |
| // Horizontal text alignment styles. |
| enum HorizontalAlignment { |
| - ALIGN_LEFT, |
| + ALIGN_LEFT = 0, |
| ALIGN_CENTER, |
| ALIGN_RIGHT, |
| }; |
| +// The directionality modes used to determine the base text direction. |
| +enum DirectionalityMode { |
| + DERIVE_FROM_TEXT = 0, // Use the first strong character's direction. |
|
Alexei Svitkine (slow)
2012/07/27 11:40:36
This is not a good name for an enum entry in the g
msw
2012/07/28 01:17:11
Done (ui/gfx/text_constants.h and "DIRECTIONALITY_
|
| + DERIVE_FROM_UI, // Use the UI's language/locale direction. |
| + FORCE_LTR, // Use LTR regardless of the text content or UI locale. |
| + FORCE_RTL, // Use RTL regardless of the text content or UI locale. |
| +}; |
| + |
| // RenderText represents an abstract model of styled text and its corresponding |
| // visual layout. Support is built in for a cursor, a selection, simple styling, |
| // complex scripts, and bi-directional text. Implementations provide mechanisms |
| @@ -246,8 +254,9 @@ class UI_EXPORT RenderText { |
| // Apply |default_style_| over the entire text range. |
| void ApplyDefaultStyle(); |
| - // Returns the dominant direction of the current text. |
| - virtual base::i18n::TextDirection GetTextDirection() = 0; |
| + // Set the text directionality mode and get the text direction yielded. |
| + void SetDirectionalityMode(DirectionalityMode mode); |
| + base::i18n::TextDirection GetTextDirection(); |
| // Returns the visual movement direction corresponding to the logical end |
| // of the text, considering only the dominant direction returned by |
| @@ -439,6 +448,12 @@ class UI_EXPORT RenderText { |
| // Horizontal alignment of the text with respect to |display_rect_|. |
| HorizontalAlignment horizontal_alignment_; |
| + // The text directionality mode, defaults to DERIVE_FROM_TEXT. |
| + DirectionalityMode directionality_mode_; |
| + |
| + // The cached text direction, potentially computed from the text or UI locale. |
| + base::i18n::TextDirection text_direction_; |
| + |
| // A list of fonts used to render |text_|. |
| FontList font_list_; |