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

Side by Side Diff: ui/base/text/text_elider.h

Issue 17745005: Clamp RenderTextWin layout length to 10,000 code points. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve string formatting; you just can't please some compilers. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/text/text_elider.cc » ('j') | ui/base/text/text_elider.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 // This file defines utility functions for eliding and formatting UI text. 5 // This file defines utility functions for eliding and formatting UI text.
6 6
7 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ 7 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_
8 #define UI_BASE_TEXT_TEXT_ELIDER_H_ 8 #define UI_BASE_TEXT_TEXT_ELIDER_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "third_party/icu/public/common/unicode/uchar.h" 15 #include "third_party/icu/public/common/unicode/uchar.h"
16 #include "third_party/icu/public/i18n/unicode/coll.h" 16 #include "third_party/icu/public/i18n/unicode/coll.h"
17 #include "ui/base/ui_export.h" 17 #include "ui/base/ui_export.h"
18 #include "ui/gfx/font.h" 18 #include "ui/gfx/font.h"
19 19
20 class GURL; 20 class GURL;
21 21
22 namespace base { 22 namespace base {
23 class FilePath; 23 class FilePath;
24 } 24 }
25 25
26 namespace ui { 26 namespace ui {
27 27
28 UI_EXPORT extern const char kEllipsis[]; 28 UI_EXPORT extern const char kEllipsis[];
29 UI_EXPORT extern const char16 kEllipsisUTF16;
29 30
30 // Elides a well-formed email address (e.g. username@domain.com) to fit into 31 // Elides a well-formed email address (e.g. username@domain.com) to fit into
31 // |available_pixel_width| using the specified |font|. 32 // |available_pixel_width| using the specified |font|.
32 // This function guarantees that the string returned will contain at least one 33 // This function guarantees that the string returned will contain at least one
33 // character, other than the ellipses, on either side of the '@'. If it is 34 // character, other than the ellipses, on either side of the '@'. If it is
34 // impossible to achieve these requirements: only an ellipsis will be returned. 35 // impossible to achieve these requirements: only an ellipsis will be returned.
35 // If possible: this elides only the username portion of the |email|. Otherwise, 36 // If possible: this elides only the username portion of the |email|. Otherwise,
36 // the domain is elided in the middle so that it splits the available width 37 // the domain is elided in the middle so that it splits the available width
37 // equally with the elided username (should the username be short enough that it 38 // equally with the elided username (should the username be short enough that it
38 // doesn't need half the available width: the elided domain will occupy that 39 // doesn't need half the available width: the elided domain will occupy that
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // Truncates the string to length characters. This breaks the string at 197 // Truncates the string to length characters. This breaks the string at
197 // the first word break before length, adding the horizontal ellipsis 198 // the first word break before length, adding the horizontal ellipsis
198 // character (unicode character 0x2026) to render ... 199 // character (unicode character 0x2026) to render ...
199 // The supplied string is returned if the string has length characters or 200 // The supplied string is returned if the string has length characters or
200 // less. 201 // less.
201 UI_EXPORT string16 TruncateString(const string16& string, size_t length); 202 UI_EXPORT string16 TruncateString(const string16& string, size_t length);
202 203
203 } // namespace ui 204 } // namespace ui
204 205
205 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ 206 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/text/text_elider.cc » ('j') | ui/base/text/text_elider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698