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

Unified Diff: app/text_elider.h

Issue 5964007: Last part of change for bug 49747.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | app/text_elider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/text_elider.h
===================================================================
--- app/text_elider.h (revision 69878)
+++ app/text_elider.h (working copy)
@@ -88,9 +88,11 @@
string16 display_url_;
};
-// Function to elide strings when the font information is unknown. As
-// opposed to the above functions, the ElideString() function operates
-// in terms of character units, not pixels.
+// Functions to elide strings when the font information is unknown. As
+// opposed to the above functions, the ElideString() and
+// ElideRectangleString() functions operate in terms of character units,
+// not pixels.
+
// If the size of |input| is more than |max_len|, this function returns
// true and |input| is shortened into |output| by removing chars in the
// middle (they are replaced with up to 3 dots, as size permits).
@@ -101,6 +103,17 @@
// TODO(tsepez): Doesn't handle bidi properly
bool ElideString(const std::wstring& input, int max_len, std::wstring* output);
+// Reformat |input| into |output| so that it fits into a |max_rows| by
+// |max_cols| rectangle of characters. Input newlines are respected, but
+// lines that are too long are broken into pieces, first at naturally
+// occuring whitespace boundaries, and then intra-word (respecting UTF-16
+// surrogate pairs) as necssary. Truncation (indicated by an added 3 dots)
+// occurs if the result is still too long. Returns true if the input had
+// to be truncated (and not just reformatted).
+bool ElideRectangleString(const string16& input, size_t max_rows,
+ size_t max_cols, string16* output);
+
+
} // namespace gfx.
#endif // APP_TEXT_ELIDER_H_
« no previous file with comments | « no previous file | app/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698