Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: ui/gfx/render_text.h

Issue 2639493002: MacViews: Enable word lookup for selectable views::Labels and multi-line text. (Closed)
Patch Set: Address nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
685 // A convenience function to check whether the glyph attached to the caret 690 // A convenience function to check whether the glyph attached to the caret
686 // is within the given range. 691 // is within the given range.
687 static bool RangeContainsCaret(const Range& range, 692 static bool RangeContainsCaret(const Range& range,
688 size_t caret_pos, 693 size_t caret_pos,
689 LogicalCursorDirection caret_affinity); 694 LogicalCursorDirection caret_affinity);
690 695
691 private: 696 private:
692 friend class test::RenderTextTestApi; 697 friend class test::RenderTextTestApi;
693 698
694 // Set the cursor to |position|, with the caret trailing the previous 699 // Set the cursor to |position|, with the caret trailing the previous
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 // Lines computed by EnsureLayout. These should be invalidated upon 875 // Lines computed by EnsureLayout. These should be invalidated upon
871 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 876 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
872 std::vector<internal::Line> lines_; 877 std::vector<internal::Line> lines_;
873 878
874 DISALLOW_COPY_AND_ASSIGN(RenderText); 879 DISALLOW_COPY_AND_ASSIGN(RenderText);
875 }; 880 };
876 881
877 } // namespace gfx 882 } // namespace gfx
878 883
879 #endif // UI_GFX_RENDER_TEXT_H_ 884 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698