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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 void UpdateStyleLengths(); | 643 void UpdateStyleLengths(); |
644 | 644 |
645 // A convenience function to check whether the glyph attached to the caret | 645 // A convenience function to check whether the glyph attached to the caret |
646 // is within the given range. | 646 // is within the given range. |
647 static bool RangeContainsCaret(const Range& range, | 647 static bool RangeContainsCaret(const Range& range, |
648 size_t caret_pos, | 648 size_t caret_pos, |
649 LogicalCursorDirection caret_affinity); | 649 LogicalCursorDirection caret_affinity); |
650 | 650 |
651 private: | 651 private: |
652 friend class test::RenderTextTestApi; | 652 friend class test::RenderTextTestApi; |
653 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyles); | 653 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, DefaultStyles); |
msw
2016/08/25 03:02:19
This isn't a blocker for this CL, but removing fri
karandeepb
2016/08/25 08:13:10
Will look to do this in a future CL.
| |
654 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetStyles); | 654 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, SetStyles); |
655 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ApplyStyles); | 655 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, ApplyStyles); |
656 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, AppendTextKeepsStyles); | 656 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, AppendTextKeepsStyles); |
657 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ObscuredText); | 657 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, ObscuredText); |
658 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, RevealObscuredText); | 658 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, RevealObscuredText); |
659 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedText); | 659 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, ElidedText); |
660 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedObscuredText); | 660 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, ElidedObscuredText); |
661 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedText); | 661 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, TruncatedText); |
662 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText); | 662 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, TruncatedObscuredText); |
663 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions); | 663 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, GraphemePositions); |
664 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, MinLineHeight); | 664 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, MinLineHeight); |
665 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, EdgeSelectionModels); | 665 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, EdgeSelectionModels); |
666 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffset); | 666 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, GetTextOffset); |
667 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffsetHorizontalDefaultInRTL); | 667 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, |
668 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth); | 668 GetTextOffsetHorizontalDefaultInRTL); |
669 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); | 669 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_MinWidth); |
670 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_SufficientWidth); | 670 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_NormalWidth); |
671 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_Newline); | 671 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_SufficientWidth); |
672 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_WordWrapBehavior); | 672 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_Newline); |
673 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_LineBreakerBehavior); | 673 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_WordWrapBehavior); |
674 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, | 674 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
675 Multiline_LineBreakerBehavior); | |
676 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
675 Multiline_SurrogatePairsOrCombiningChars); | 677 Multiline_SurrogatePairsOrCombiningChars); |
676 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_ZeroWidthChars); | 678 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_ZeroWidthChars); |
677 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, NewlineWithoutMultilineFlag); | 679 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, NewlineWithoutMultilineFlag); |
678 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GlyphBounds); | 680 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, GlyphBounds); |
679 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_GlyphBounds); | 681 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, |
680 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, | |
681 MoveCursorLeftRight_MeiryoUILigatures); | 682 MoveCursorLeftRight_MeiryoUILigatures); |
682 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); | 683 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, Win_LogicalClusters); |
683 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SameFontForParentheses); | 684 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, SameFontForParentheses); |
684 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks); | 685 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, BreakRunsByUnicodeBlocks); |
685 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); | 686 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, PangoAttributes); |
686 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); | 687 FRIEND_TEST_ALL_PREFIXES(RenderTextTestAll, StringFitsOwnWidth); |
687 | 688 |
688 // Set the cursor to |position|, with the caret trailing the previous | 689 // Set the cursor to |position|, with the caret trailing the previous |
689 // grapheme, or if there is no previous grapheme, leading the cursor position. | 690 // grapheme, or if there is no previous grapheme, leading the cursor position. |
690 // If |select| is false, the selection start is moved to the same position. | 691 // If |select| is false, the selection start is moved to the same position. |
691 // If the |position| is not a cursorable position (not on grapheme boundary), | 692 // If the |position| is not a cursorable position (not on grapheme boundary), |
692 // it is a NO-OP. | 693 // it is a NO-OP. |
693 void MoveCursorTo(size_t position, bool select); | 694 void MoveCursorTo(size_t position, bool select); |
694 | 695 |
695 // Updates |layout_text_| and |display_text_| as needed (or marks them dirty). | 696 // Updates |layout_text_| and |display_text_| as needed (or marks them dirty). |
696 void OnTextAttributeChanged(); | 697 void OnTextAttributeChanged(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 // Lines computed by EnsureLayout. These should be invalidated upon | 851 // Lines computed by EnsureLayout. These should be invalidated upon |
851 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 852 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
852 std::vector<internal::Line> lines_; | 853 std::vector<internal::Line> lines_; |
853 | 854 |
854 DISALLOW_COPY_AND_ASSIGN(RenderText); | 855 DISALLOW_COPY_AND_ASSIGN(RenderText); |
855 }; | 856 }; |
856 | 857 |
857 } // namespace gfx | 858 } // namespace gfx |
858 | 859 |
859 #endif // UI_GFX_RENDER_TEXT_H_ | 860 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |