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

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

Issue 1953133002: [WIP: not for review] Reduce re-layout Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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') | ui/gfx/render_text_harfbuzz.cc » ('J')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 public: 204 public:
205 virtual ~RenderText(); 205 virtual ~RenderText();
206 206
207 // Creates a platform-specific or cross-platform RenderText instance. 207 // Creates a platform-specific or cross-platform RenderText instance.
208 static RenderText* CreateInstance(); 208 static RenderText* CreateInstance();
209 static RenderText* CreateInstanceForEditing(); 209 static RenderText* CreateInstanceForEditing();
210 210
211 // Creates another instance of the same concrete class. 211 // Creates another instance of the same concrete class.
212 virtual std::unique_ptr<RenderText> CreateInstanceOfSameType() const = 0; 212 virtual std::unique_ptr<RenderText> CreateInstanceOfSameType() const = 0;
213 213
214 // Like above but copies all style settings too.
215 std::unique_ptr<RenderText> CreateInstanceOfSameStyle(
216 const base::string16& text) const;
217
214 const base::string16& text() const { return text_; } 218 const base::string16& text() const { return text_; }
215 void SetText(const base::string16& text); 219 void SetText(const base::string16& text);
216 void AppendText(const base::string16& text); 220 void AppendText(const base::string16& text);
217 221
218 HorizontalAlignment horizontal_alignment() const { 222 HorizontalAlignment horizontal_alignment() const {
219 return horizontal_alignment_; 223 return horizontal_alignment_;
220 } 224 }
221 void SetHorizontalAlignment(HorizontalAlignment alignment); 225 void SetHorizontalAlignment(HorizontalAlignment alignment);
222 226
223 const FontList& font_list() const { return font_list_; } 227 const FontList& font_list() const { return font_list_; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // a UTF16 text index. If there is a previous revealed index, the previous one 263 // a UTF16 text index. If there is a previous revealed index, the previous one
260 // is cleared and only the last set index will be revealed. If |index| is -1 264 // is cleared and only the last set index will be revealed. If |index| is -1
261 // or out of range, no char will be revealed. The revealed index is also 265 // or out of range, no char will be revealed. The revealed index is also
262 // cleared when SetText or SetObscured is called. 266 // cleared when SetText or SetObscured is called.
263 void SetObscuredRevealIndex(int index); 267 void SetObscuredRevealIndex(int index);
264 268
265 // TODO(ckocagil): Multiline text rendering is not supported on Mac. 269 // TODO(ckocagil): Multiline text rendering is not supported on Mac.
266 bool multiline() const { return multiline_; } 270 bool multiline() const { return multiline_; }
267 void SetMultiline(bool multiline); 271 void SetMultiline(bool multiline);
268 272
273 // If multiline, a non-zero value will cap the number of lines rendered,
274 // and elide the rest (currently only ELIDE_TAIL supported.)
275 void SetMaxLines(size_t max_lines);
276 size_t max_lines() const { return max_lines_; }
277 size_t GetNumLines();
278
269 // TODO(mukai): ELIDE_LONG_WORDS is not supported. 279 // TODO(mukai): ELIDE_LONG_WORDS is not supported.
270 WordWrapBehavior word_wrap_behavior() const { return word_wrap_behavior_; } 280 WordWrapBehavior word_wrap_behavior() const { return word_wrap_behavior_; }
271 void SetWordWrapBehavior(WordWrapBehavior behavior); 281 void SetWordWrapBehavior(WordWrapBehavior behavior);
272 282
273 // Set whether newline characters should be replaced with newline symbols. 283 // Set whether newline characters should be replaced with newline symbols.
274 void SetReplaceNewlineCharsWithSymbols(bool replace); 284 void SetReplaceNewlineCharsWithSymbols(bool replace);
275 285
276 // Returns true if this instance supports multiline rendering. 286 // Returns true if this instance supports multiline rendering.
277 virtual bool MultilineSupported() const = 0; 287 virtual bool MultilineSupported() const = 0;
278 288
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // True if the text is elided given the current behavior and display area. 781 // True if the text is elided given the current behavior and display area.
772 bool text_elided_; 782 bool text_elided_;
773 783
774 // The minimum height a line should have. 784 // The minimum height a line should have.
775 int min_line_height_; 785 int min_line_height_;
776 786
777 // Whether the text should be broken into multiple lines. Uses the width of 787 // Whether the text should be broken into multiple lines. Uses the width of
778 // |display_rect_| as the width cap. 788 // |display_rect_| as the width cap.
779 bool multiline_; 789 bool multiline_;
780 790
791 // If multiple lines, the maximum number of lines to render, or 0.
792 size_t max_lines_;
793
781 // The wrap behavior when the text is broken into lines. Do nothing unless 794 // The wrap behavior when the text is broken into lines. Do nothing unless
782 // |multiline_| is set. The default value is IGNORE_LONG_WORDS. 795 // |multiline_| is set. The default value is IGNORE_LONG_WORDS.
783 WordWrapBehavior word_wrap_behavior_; 796 WordWrapBehavior word_wrap_behavior_;
784 797
785 // Whether newline characters should be replaced with newline symbols. 798 // Whether newline characters should be replaced with newline symbols.
786 bool replace_newline_chars_with_symbols_; 799 bool replace_newline_chars_with_symbols_;
787 800
788 // Set to true to suppress subpixel rendering due to non-font reasons (eg. 801 // Set to true to suppress subpixel rendering due to non-font reasons (eg.
789 // if the background is transparent). The default value is false. 802 // if the background is transparent). The default value is false.
790 bool subpixel_rendering_suppressed_; 803 bool subpixel_rendering_suppressed_;
(...skipping 29 matching lines...) Expand all
820 // Lines computed by EnsureLayout. These should be invalidated upon 833 // Lines computed by EnsureLayout. These should be invalidated upon
821 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 834 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
822 std::vector<internal::Line> lines_; 835 std::vector<internal::Line> lines_;
823 836
824 DISALLOW_COPY_AND_ASSIGN(RenderText); 837 DISALLOW_COPY_AND_ASSIGN(RenderText);
825 }; 838 };
826 839
827 } // namespace gfx 840 } // namespace gfx
828 841
829 #endif // UI_GFX_RENDER_TEXT_H_ 842 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text_harfbuzz.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698