OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_RENDER_TEXT_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 const base::string16& text() const { return text_; } | 208 const base::string16& text() const { return text_; } |
209 void SetText(const base::string16& text); | 209 void SetText(const base::string16& text); |
210 void AppendText(const base::string16& text); | 210 void AppendText(const base::string16& text); |
211 | 211 |
212 HorizontalAlignment horizontal_alignment() const { | 212 HorizontalAlignment horizontal_alignment() const { |
213 return horizontal_alignment_; | 213 return horizontal_alignment_; |
214 } | 214 } |
215 void SetHorizontalAlignment(HorizontalAlignment alignment); | 215 void SetHorizontalAlignment(HorizontalAlignment alignment); |
216 | 216 |
| 217 VerticalAlignment vertical_alignment() const { return vertical_alignment_; } |
| 218 void SetVerticalAlignment(VerticalAlignment alignment); |
| 219 |
217 const FontList& font_list() const { return font_list_; } | 220 const FontList& font_list() const { return font_list_; } |
218 void SetFontList(const FontList& font_list); | 221 void SetFontList(const FontList& font_list); |
219 | 222 |
220 bool cursor_enabled() const { return cursor_enabled_; } | 223 bool cursor_enabled() const { return cursor_enabled_; } |
221 void SetCursorEnabled(bool cursor_enabled); | 224 void SetCursorEnabled(bool cursor_enabled); |
222 | 225 |
223 bool cursor_visible() const { return cursor_visible_; } | 226 bool cursor_visible() const { return cursor_visible_; } |
224 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } | 227 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } |
225 | 228 |
226 bool insert_mode() const { return insert_mode_; } | 229 bool insert_mode() const { return insert_mode_; } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, NewlineWithoutMultilineFlag); | 640 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, NewlineWithoutMultilineFlag); |
638 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GlyphBounds); | 641 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GlyphBounds); |
639 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_GlyphBounds); | 642 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_GlyphBounds); |
640 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, | 643 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, |
641 MoveCursorLeftRight_MeiryoUILigatures); | 644 MoveCursorLeftRight_MeiryoUILigatures); |
642 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); | 645 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); |
643 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SameFontForParentheses); | 646 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SameFontForParentheses); |
644 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks); | 647 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks); |
645 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); | 648 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); |
646 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); | 649 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); |
| 650 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, VerticalAlignment); |
647 | 651 |
648 // Set the cursor to |position|, with the caret trailing the previous | 652 // Set the cursor to |position|, with the caret trailing the previous |
649 // grapheme, or if there is no previous grapheme, leading the cursor position. | 653 // grapheme, or if there is no previous grapheme, leading the cursor position. |
650 // If |select| is false, the selection start is moved to the same position. | 654 // If |select| is false, the selection start is moved to the same position. |
651 // If the |position| is not a cursorable position (not on grapheme boundary), | 655 // If the |position| is not a cursorable position (not on grapheme boundary), |
652 // it is a NO-OP. | 656 // it is a NO-OP. |
653 void MoveCursorTo(size_t position, bool select); | 657 void MoveCursorTo(size_t position, bool select); |
654 | 658 |
655 // Updates |layout_text_| and |display_text_| as needed (or marks them dirty). | 659 // Updates |layout_text_| and |display_text_| as needed (or marks them dirty). |
656 void OnTextAttributeChanged(); | 660 void OnTextAttributeChanged(); |
(...skipping 16 matching lines...) Expand all Loading... |
673 // Draw the selection. | 677 // Draw the selection. |
674 void DrawSelection(Canvas* canvas); | 678 void DrawSelection(Canvas* canvas); |
675 | 679 |
676 // Logical UTF-16 string data to be drawn. | 680 // Logical UTF-16 string data to be drawn. |
677 base::string16 text_; | 681 base::string16 text_; |
678 | 682 |
679 // Horizontal alignment of the text with respect to |display_rect_|. The | 683 // Horizontal alignment of the text with respect to |display_rect_|. The |
680 // default is to align left if the application UI is LTR and right if RTL. | 684 // default is to align left if the application UI is LTR and right if RTL. |
681 HorizontalAlignment horizontal_alignment_; | 685 HorizontalAlignment horizontal_alignment_; |
682 | 686 |
| 687 // Vertical alignment of the text with respect to |display_rect_|. The |
| 688 // default is to vertically align middle. |
| 689 VerticalAlignment vertical_alignment_; |
| 690 |
683 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. | 691 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. |
684 DirectionalityMode directionality_mode_; | 692 DirectionalityMode directionality_mode_; |
685 | 693 |
686 // The cached text direction, potentially computed from the text or UI locale. | 694 // The cached text direction, potentially computed from the text or UI locale. |
687 // Use GetTextDirection(), do not use this potentially invalid value directly! | 695 // Use GetTextDirection(), do not use this potentially invalid value directly! |
688 base::i18n::TextDirection text_direction_; | 696 base::i18n::TextDirection text_direction_; |
689 | 697 |
690 // A list of fonts used to render |text_|. | 698 // A list of fonts used to render |text_|. |
691 FontList font_list_; | 699 FontList font_list_; |
692 | 700 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 // Lines computed by EnsureLayout. These should be invalidated upon | 808 // Lines computed by EnsureLayout. These should be invalidated upon |
801 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 809 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
802 std::vector<internal::Line> lines_; | 810 std::vector<internal::Line> lines_; |
803 | 811 |
804 DISALLOW_COPY_AND_ASSIGN(RenderText); | 812 DISALLOW_COPY_AND_ASSIGN(RenderText); |
805 }; | 813 }; |
806 | 814 |
807 } // namespace gfx | 815 } // namespace gfx |
808 | 816 |
809 #endif // UI_GFX_RENDER_TEXT_H_ | 817 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |