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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // the text bounds. Returns -1 if |text_y| is above the text and | 673 // the text bounds. Returns -1 if |text_y| is above the text and |
674 // lines().size() if |text_y| is below it. | 674 // lines().size() if |text_y| is below it. |
675 int GetLineContainingYCoord(float text_y); | 675 int GetLineContainingYCoord(float text_y); |
676 | 676 |
677 // A convenience function to check whether the glyph attached to the caret | 677 // A convenience function to check whether the glyph attached to the caret |
678 // is within the given range. | 678 // is within the given range. |
679 static bool RangeContainsCaret(const Range& range, | 679 static bool RangeContainsCaret(const Range& range, |
680 size_t caret_pos, | 680 size_t caret_pos, |
681 LogicalCursorDirection caret_affinity); | 681 LogicalCursorDirection caret_affinity); |
682 | 682 |
| 683 // Returns the baseline, with which the text best appears vertically centered. |
| 684 static int DetermineBaselineCenteringText(const int display_height, |
| 685 const FontList& font_list); |
| 686 |
683 private: | 687 private: |
684 friend class test::RenderTextTestApi; | 688 friend class test::RenderTextTestApi; |
685 | 689 |
686 // Set the cursor to |position|, with the caret trailing the previous | 690 // Set the cursor to |position|, with the caret trailing the previous |
687 // grapheme, or if there is no previous grapheme, leading the cursor position. | 691 // grapheme, or if there is no previous grapheme, leading the cursor position. |
688 // If |select| is false, the selection start is moved to the same position. | 692 // If |select| is false, the selection start is moved to the same position. |
689 // If the |position| is not a cursorable position (not on grapheme boundary), | 693 // If the |position| is not a cursorable position (not on grapheme boundary), |
690 // it is a NO-OP. | 694 // it is a NO-OP. |
691 void MoveCursorTo(size_t position, bool select); | 695 void MoveCursorTo(size_t position, bool select); |
692 | 696 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 // Lines computed by EnsureLayout. These should be invalidated upon | 857 // Lines computed by EnsureLayout. These should be invalidated upon |
854 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 858 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
855 std::vector<internal::Line> lines_; | 859 std::vector<internal::Line> lines_; |
856 | 860 |
857 DISALLOW_COPY_AND_ASSIGN(RenderText); | 861 DISALLOW_COPY_AND_ASSIGN(RenderText); |
858 }; | 862 }; |
859 | 863 |
860 } // namespace gfx | 864 } // namespace gfx |
861 | 865 |
862 #endif // UI_GFX_RENDER_TEXT_H_ | 866 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |