| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 200 | 200 | 
| 201   // Creates a platform-specific or cross-platform RenderText instance. | 201   // Creates a platform-specific or cross-platform RenderText instance. | 
| 202   static RenderText* CreateInstance(); | 202   static RenderText* CreateInstance(); | 
| 203   static RenderText* CreateInstanceForEditing(); | 203   static RenderText* CreateInstanceForEditing(); | 
| 204 | 204 | 
| 205   // Creates another instance of the same concrete class. | 205   // Creates another instance of the same concrete class. | 
| 206   virtual scoped_ptr<RenderText> CreateInstanceOfSameType() const = 0; | 206   virtual scoped_ptr<RenderText> CreateInstanceOfSameType() const = 0; | 
| 207 | 207 | 
| 208   const base::string16& text() const { return text_; } | 208   const base::string16& text() const { return text_; } | 
| 209   void SetText(const base::string16& text); | 209   void SetText(const base::string16& text); | 
|  | 210   void AppendText(const base::string16& text); | 
| 210 | 211 | 
| 211   HorizontalAlignment horizontal_alignment() const { | 212   HorizontalAlignment horizontal_alignment() const { | 
| 212     return horizontal_alignment_; | 213     return horizontal_alignment_; | 
| 213   } | 214   } | 
| 214   void SetHorizontalAlignment(HorizontalAlignment alignment); | 215   void SetHorizontalAlignment(HorizontalAlignment alignment); | 
| 215 | 216 | 
| 216   const FontList& font_list() const { return font_list_; } | 217   const FontList& font_list() const { return font_list_; } | 
| 217   void SetFontList(const FontList& font_list); | 218   void SetFontList(const FontList& font_list); | 
| 218 | 219 | 
| 219   bool cursor_enabled() const { return cursor_enabled_; } | 220   bool cursor_enabled() const { return cursor_enabled_; } | 
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 596   // Get the text direction for the current directionality mode and given | 597   // Get the text direction for the current directionality mode and given | 
| 597   // |text|. | 598   // |text|. | 
| 598   base::i18n::TextDirection GetTextDirection(const base::string16& text); | 599   base::i18n::TextDirection GetTextDirection(const base::string16& text); | 
| 599 | 600 | 
| 600   // Convert an index in |text_| to the index in |given_text|. The | 601   // Convert an index in |text_| to the index in |given_text|. The | 
| 601   // |given_text| should be either |display_text_| or |layout_text_| | 602   // |given_text| should be either |display_text_| or |layout_text_| | 
| 602   // depending on the elide state. | 603   // depending on the elide state. | 
| 603   size_t TextIndexToGivenTextIndex(const base::string16& given_text, | 604   size_t TextIndexToGivenTextIndex(const base::string16& given_text, | 
| 604                                    size_t index); | 605                                    size_t index); | 
| 605 | 606 | 
|  | 607   void DoAppendText(const base::string16& text); | 
|  | 608 | 
| 606   // A convenience function to check whether the glyph attached to the caret | 609   // A convenience function to check whether the glyph attached to the caret | 
| 607   // is within the given range. | 610   // is within the given range. | 
| 608   static bool RangeContainsCaret(const Range& range, | 611   static bool RangeContainsCaret(const Range& range, | 
| 609                                  size_t caret_pos, | 612                                  size_t caret_pos, | 
| 610                                  LogicalCursorDirection caret_affinity); | 613                                  LogicalCursorDirection caret_affinity); | 
| 611 | 614 | 
| 612  private: | 615  private: | 
| 613   friend class RenderTextTest; | 616   friend class RenderTextTest; | 
| 614   FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyles); | 617   FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyles); | 
| 615   FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetStyles); | 618   FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetStyles); | 
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 795   // Lines computed by EnsureLayout. These should be invalidated upon | 798   // Lines computed by EnsureLayout. These should be invalidated upon | 
| 796   // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 799   // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 
| 797   std::vector<internal::Line> lines_; | 800   std::vector<internal::Line> lines_; | 
| 798 | 801 | 
| 799   DISALLOW_COPY_AND_ASSIGN(RenderText); | 802   DISALLOW_COPY_AND_ASSIGN(RenderText); | 
| 800 }; | 803 }; | 
| 801 | 804 | 
| 802 }  // namespace gfx | 805 }  // namespace gfx | 
| 803 | 806 | 
| 804 #endif  // UI_GFX_RENDER_TEXT_H_ | 807 #endif  // UI_GFX_RENDER_TEXT_H_ | 
| OLD | NEW | 
|---|