diff options
author | jschuh@google.com <jschuh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 17:24:59 +0000 |
---|---|---|
committer | jschuh@google.com <jschuh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 17:24:59 +0000 |
commit | 173293170c18302eae5d2cf77d995daad74d4db1 (patch) | |
tree | 07b1516c8dc0e42859ae538e4a217d68f6bea958 /app/text_elider.h | |
parent | 1f2d03b835c575406136a347cbbee6074b284793 (diff) | |
download | chromium_src-173293170c18302eae5d2cf77d995daad74d4db1.zip chromium_src-173293170c18302eae5d2cf77d995daad74d4db1.tar.gz chromium_src-173293170c18302eae5d2cf77d995daad74d4db1.tar.bz2 |
Move ElideString() from base/string_util.cc to app/text_elider.cc to
reduce size of widely-included base libraries.
Committing for tsepez.
BUG=49747
TEST=TextEliderTest.*
Review URL: http://codereview.chromium.org/6017001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/text_elider.h')
-rw-r--r-- | app/text_elider.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/text_elider.h b/app/text_elider.h index 36d12ae..c0d6c33 100644 --- a/app/text_elider.h +++ b/app/text_elider.h @@ -88,6 +88,19 @@ class SortedDisplayURL { 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_ |