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

Unified Diff: app/text_elider.h

Issue 6017001: Move ElideString() from base/string_util.cc to app/text_elider.cc to ... (Closed) Base URL: svn://chrome-svn/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 69274)
+++ app/text_elider.h (working copy)
@@ -88,6 +88,19 @@
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.
+// 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).
+// Ex: ElideString(L"Hello", 10, &str) puts Hello in str and returns false.
+// ElideString(L"Hello my name is Tom", 10, &str) puts "Hell...Tom" in str
+// and returns true.
+// TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly.
+// TODO(tsepez): Doesn't handle bidi properly
+bool ElideString(const std::wstring& input, int max_len, std::wstring* 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