| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 // Convert an index in |text_| to the index in |given_text|. The | 676 // Convert an index in |text_| to the index in |given_text|. The |
| 677 // |given_text| should be either |display_text_| or |layout_text_| | 677 // |given_text| should be either |display_text_| or |layout_text_| |
| 678 // depending on the elide state. | 678 // depending on the elide state. |
| 679 size_t TextIndexToGivenTextIndex(const base::string16& given_text, | 679 size_t TextIndexToGivenTextIndex(const base::string16& given_text, |
| 680 size_t index) const; | 680 size_t index) const; |
| 681 | 681 |
| 682 // Adjust ranged styles to accommodate a new text length. | 682 // Adjust ranged styles to accommodate a new text length. |
| 683 void UpdateStyleLengths(); | 683 void UpdateStyleLengths(); |
| 684 | 684 |
| 685 // Returns the line index for the given argument. |text_y| is relative to |
| 686 // the text bounds. Returns -1 if |text_y| is above the text and |
| 687 // lines().size() if |text_y| is below it. |
| 688 int GetLineContainingYCoord(float text_y); |
| 689 |
| 690 // Returns the line segment index for the |line|, |text_x| pair. |text_x| is |
| 691 // relative to text in the given line. Returns -1 if |text_x| is to the left |
| 692 // of text in the line and |line|.segments.size() if it's to the right. |
| 693 // |offset_relative_segment| will contain the offset of |text_x| relative to |
| 694 // the start of the segment it is contained in. |
| 695 int GetLineSegmentContainingXCoord(const internal::Line& line, |
| 696 float text_x, |
| 697 float* offset_relative_segment); |
| 698 |
| 685 // A convenience function to check whether the glyph attached to the caret | 699 // A convenience function to check whether the glyph attached to the caret |
| 686 // is within the given range. | 700 // is within the given range. |
| 687 static bool RangeContainsCaret(const Range& range, | 701 static bool RangeContainsCaret(const Range& range, |
| 688 size_t caret_pos, | 702 size_t caret_pos, |
| 689 LogicalCursorDirection caret_affinity); | 703 LogicalCursorDirection caret_affinity); |
| 690 | 704 |
| 691 private: | 705 private: |
| 692 friend class test::RenderTextTestApi; | 706 friend class test::RenderTextTestApi; |
| 693 | 707 |
| 694 // Set the cursor to |position|, with the caret trailing the previous | 708 // Set the cursor to |position|, with the caret trailing the previous |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 // Lines computed by EnsureLayout. These should be invalidated upon | 884 // Lines computed by EnsureLayout. These should be invalidated upon |
| 871 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 885 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 872 std::vector<internal::Line> lines_; | 886 std::vector<internal::Line> lines_; |
| 873 | 887 |
| 874 DISALLOW_COPY_AND_ASSIGN(RenderText); | 888 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 875 }; | 889 }; |
| 876 | 890 |
| 877 } // namespace gfx | 891 } // namespace gfx |
| 878 | 892 |
| 879 #endif // UI_GFX_RENDER_TEXT_H_ | 893 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |