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

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

Issue 1014163002: [RenderText] Added append text (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed UpdateStyleLengths comment Created 5 years, 9 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 <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
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
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 // Adjust ranged styles to accommodate a new text length.
608 void UpdateStyleLengths();
609
606 // A convenience function to check whether the glyph attached to the caret 610 // A convenience function to check whether the glyph attached to the caret
607 // is within the given range. 611 // is within the given range.
608 static bool RangeContainsCaret(const Range& range, 612 static bool RangeContainsCaret(const Range& range,
609 size_t caret_pos, 613 size_t caret_pos,
610 LogicalCursorDirection caret_affinity); 614 LogicalCursorDirection caret_affinity);
611 615
612 private: 616 private:
613 friend class RenderTextTest; 617 friend class RenderTextTest;
614 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyles); 618 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyles);
615 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetStyles); 619 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetStyles);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // Lines computed by EnsureLayout. These should be invalidated upon 799 // Lines computed by EnsureLayout. These should be invalidated upon
796 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 800 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
797 std::vector<internal::Line> lines_; 801 std::vector<internal::Line> lines_;
798 802
799 DISALLOW_COPY_AND_ASSIGN(RenderText); 803 DISALLOW_COPY_AND_ASSIGN(RenderText);
800 }; 804 };
801 805
802 } // namespace gfx 806 } // namespace gfx
803 807
804 #endif // UI_GFX_RENDER_TEXT_H_ 808 #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