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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text_harfbuzz.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 32ad44bf5ed3433f56f8a02282c9b1eec57155db..f27293b646177ef070dbe0b247bcf60dd56ac2e4 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -211,6 +211,10 @@ class GFX_EXPORT RenderText {
// Creates another instance of the same concrete class.
virtual std::unique_ptr<RenderText> CreateInstanceOfSameType() const = 0;
+ // Like above but copies all style settings too.
+ std::unique_ptr<RenderText> CreateInstanceOfSameStyle(
+ const base::string16& text) const;
+
const base::string16& text() const { return text_; }
void SetText(const base::string16& text);
void AppendText(const base::string16& text);
@@ -266,6 +270,12 @@ class GFX_EXPORT RenderText {
bool multiline() const { return multiline_; }
void SetMultiline(bool multiline);
+ // If multiline, a non-zero value will cap the number of lines rendered,
+ // and elide the rest (currently only ELIDE_TAIL supported.)
+ void SetMaxLines(size_t max_lines);
+ size_t max_lines() const { return max_lines_; }
+ size_t GetNumLines();
+
// TODO(mukai): ELIDE_LONG_WORDS is not supported.
WordWrapBehavior word_wrap_behavior() const { return word_wrap_behavior_; }
void SetWordWrapBehavior(WordWrapBehavior behavior);
@@ -778,6 +788,9 @@ class GFX_EXPORT RenderText {
// |display_rect_| as the width cap.
bool multiline_;
+ // If multiple lines, the maximum number of lines to render, or 0.
+ size_t max_lines_;
+
// The wrap behavior when the text is broken into lines. Do nothing unless
// |multiline_| is set. The default value is IGNORE_LONG_WORDS.
WordWrapBehavior word_wrap_behavior_;
« 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