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 <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 // Applies fade effects to |renderer|. | 574 // Applies fade effects to |renderer|. |
575 void ApplyFadeEffects(internal::SkiaTextRenderer* renderer); | 575 void ApplyFadeEffects(internal::SkiaTextRenderer* renderer); |
576 | 576 |
577 // Applies text shadows to |renderer|. | 577 // Applies text shadows to |renderer|. |
578 void ApplyTextShadows(internal::SkiaTextRenderer* renderer); | 578 void ApplyTextShadows(internal::SkiaTextRenderer* renderer); |
579 | 579 |
580 // Get the text direction for the current directionality mode and given | 580 // Get the text direction for the current directionality mode and given |
581 // |text|. | 581 // |text|. |
582 base::i18n::TextDirection GetTextDirection(const base::string16& text); | 582 base::i18n::TextDirection GetTextDirection(const base::string16& text); |
583 | 583 |
| 584 // Convert an index in |text_| to the index in |given_text|. The |
| 585 // |given_text| should be either |display_text_| or |layout_text_| |
| 586 // depending on the elide state. |
| 587 size_t TextIndexToGivenTextIndex(const base::string16& given_text, |
| 588 size_t index); |
| 589 |
584 // A convenience function to check whether the glyph attached to the caret | 590 // A convenience function to check whether the glyph attached to the caret |
585 // is within the given range. | 591 // is within the given range. |
586 static bool RangeContainsCaret(const Range& range, | 592 static bool RangeContainsCaret(const Range& range, |
587 size_t caret_pos, | 593 size_t caret_pos, |
588 LogicalCursorDirection caret_affinity); | 594 LogicalCursorDirection caret_affinity); |
589 | 595 |
590 private: | 596 private: |
591 friend class RenderTextTest; | 597 friend class RenderTextTest; |
592 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle); | 598 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle); |
593 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetColorAndStyle); | 599 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetColorAndStyle); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Lines computed by EnsureLayout. These should be invalidated upon | 775 // Lines computed by EnsureLayout. These should be invalidated upon |
770 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 776 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
771 std::vector<internal::Line> lines_; | 777 std::vector<internal::Line> lines_; |
772 | 778 |
773 DISALLOW_COPY_AND_ASSIGN(RenderText); | 779 DISALLOW_COPY_AND_ASSIGN(RenderText); |
774 }; | 780 }; |
775 | 781 |
776 } // namespace gfx | 782 } // namespace gfx |
777 | 783 |
778 #endif // UI_GFX_RENDER_TEXT_H_ | 784 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |