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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 | 518 |
519 // Retrieves the word displayed at the given |point| along with its styling | 519 // Retrieves the word displayed at the given |point| along with its styling |
520 // information. |point| is in the view's coordinates. If no word is displayed | 520 // information. |point| is in the view's coordinates. If no word is displayed |
521 // at the point, returns a nearby word. |baseline_point| should correspond to | 521 // at the point, returns a nearby word. |baseline_point| should correspond to |
522 // the baseline point of the leftmost glyph of the |word| in the view's | 522 // the baseline point of the leftmost glyph of the |word| in the view's |
523 // coordinates. Returns false, if no word can be retrieved. | 523 // coordinates. Returns false, if no word can be retrieved. |
524 bool GetDecoratedWordAtPoint(const Point& point, | 524 bool GetDecoratedWordAtPoint(const Point& point, |
525 DecoratedText* decorated_word, | 525 DecoratedText* decorated_word, |
526 Point* baseline_point); | 526 Point* baseline_point); |
527 | 527 |
528 // Retrieves the text at the given |range| along with its styling | |
529 // information. |baseline_point| should correspond to the baseline point of | |
530 // the leftmost glyph of the |word| in the view's coordinates. Returns | |
531 // false, if no word can be retrieved. | |
532 bool GetDecoratedTextForRange(const Range& range, | |
533 DecoratedText* decorated_text, | |
534 Point* baseline_point); | |
535 | |
528 // Retrieves the text in the given |range|. | 536 // Retrieves the text in the given |range|. |
529 base::string16 GetTextFromRange(const Range& range) const; | 537 base::string16 GetTextFromRange(const Range& range) const; |
530 | 538 |
531 protected: | 539 protected: |
532 RenderText(); | 540 RenderText(); |
533 | 541 |
534 // NOTE: The value of these accessors may be stale. Please make sure | 542 // NOTE: The value of these accessors may be stale. Please make sure |
535 // that these fields are up to date before accessing them. | 543 // that these fields are up to date before accessing them. |
536 const base::string16& layout_text() const { return layout_text_; } | 544 const base::string16& layout_text() const { return layout_text_; } |
537 const base::string16& display_text() const { return display_text_; } | 545 const base::string16& display_text() const { return display_text_; } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 // CURSOR_BACKWARD direction, then in the CURSOR_FORWARD direction. Returns | 722 // CURSOR_BACKWARD direction, then in the CURSOR_FORWARD direction. Returns |
715 // the text length if no valid boundary is found. | 723 // the text length if no valid boundary is found. |
716 size_t GetNearestWordStartBoundary(size_t index) const; | 724 size_t GetNearestWordStartBoundary(size_t index) const; |
717 | 725 |
718 // Expands |range| to its nearest word boundaries and returns the resulting | 726 // Expands |range| to its nearest word boundaries and returns the resulting |
719 // range. Maintains directionality of |range|. | 727 // range. Maintains directionality of |range|. |
720 Range ExpandRangeToWordBoundary(const Range& range) const; | 728 Range ExpandRangeToWordBoundary(const Range& range) const; |
721 | 729 |
722 // Returns the decorated text corresponding to |range|. Returns false if the | 730 // Returns the decorated text corresponding to |range|. Returns false if the |
723 // text cannot be retrieved, e.g. if the text is obscured. | 731 // text cannot be retrieved, e.g. if the text is obscured. |
724 virtual bool GetDecoratedTextForRange(const Range& range, | 732 virtual bool GetDecoratedTextForRange(const Range& range, |
tapted
2016/12/13 05:11:23
It's confusing to have a virtual and a non-virtual
spqchan
2016/12/15 23:29:01
How about GetDecoratedTextAndBasepointForRange? If
tapted
2016/12/16 07:01:19
With GetDecoratedTextAndBasepointForRange -> GetDe
| |
725 DecoratedText* decorated_text) = 0; | 733 DecoratedText* decorated_text) = 0; |
726 | 734 |
727 // Logical UTF-16 string data to be drawn. | 735 // Logical UTF-16 string data to be drawn. |
728 base::string16 text_; | 736 base::string16 text_; |
729 | 737 |
730 // Horizontal alignment of the text with respect to |display_rect_|. The | 738 // Horizontal alignment of the text with respect to |display_rect_|. The |
731 // default is to align left if the application UI is LTR and right if RTL. | 739 // default is to align left if the application UI is LTR and right if RTL. |
732 HorizontalAlignment horizontal_alignment_; | 740 HorizontalAlignment horizontal_alignment_; |
733 | 741 |
734 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. | 742 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 // Lines computed by EnsureLayout. These should be invalidated upon | 869 // Lines computed by EnsureLayout. These should be invalidated upon |
862 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 870 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
863 std::vector<internal::Line> lines_; | 871 std::vector<internal::Line> lines_; |
864 | 872 |
865 DISALLOW_COPY_AND_ASSIGN(RenderText); | 873 DISALLOW_COPY_AND_ASSIGN(RenderText); |
866 }; | 874 }; |
867 | 875 |
868 } // namespace gfx | 876 } // namespace gfx |
869 | 877 |
870 #endif // UI_GFX_RENDER_TEXT_H_ | 878 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |