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

Side by Side Diff: ui/gfx/text_elider.h

Issue 614103007: Error in popup on Link (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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_GFX_TEXT_ELIDER_H_ 7 #ifndef UI_GFX_TEXT_ELIDER_H_
8 #define UI_GFX_TEXT_ELIDER_H_ 8 #define UI_GFX_TEXT_ELIDER_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // too long are broken into pieces. For words that are too wide to fit on a 143 // too long are broken into pieces. For words that are too wide to fit on a
144 // single line, the wrapping behavior can be specified with the |wrap_behavior| 144 // single line, the wrapping behavior can be specified with the |wrap_behavior|
145 // param. Returns a combination of |ReformattingResultFlags| that indicate 145 // param. Returns a combination of |ReformattingResultFlags| that indicate
146 // whether the given rectangle had insufficient space to accommodate |text|, 146 // whether the given rectangle had insufficient space to accommodate |text|,
147 // leading to elision or truncation (and not just reformatting). 147 // leading to elision or truncation (and not just reformatting).
148 GFX_EXPORT int ElideRectangleText(const base::string16& text, 148 GFX_EXPORT int ElideRectangleText(const base::string16& text,
149 const gfx::FontList& font_list, 149 const gfx::FontList& font_list,
150 float available_pixel_width, 150 float available_pixel_width,
151 int available_pixel_height, 151 int available_pixel_height,
152 WordWrapBehavior wrap_behavior, 152 WordWrapBehavior wrap_behavior,
153 std::vector<base::string16>* lines); 153 std::vector<base::string16>* lines,
154 float* max_width);
154 155
155 // Truncates |string| to |length| characters. This breaks the string according 156 // Truncates |string| to |length| characters. This breaks the string according
156 // to the specified |break_type|, which must be either WORD_BREAK or 157 // to the specified |break_type|, which must be either WORD_BREAK or
157 // CHARACTER_BREAK, and adds the horizontal ellipsis character (unicode 158 // CHARACTER_BREAK, and adds the horizontal ellipsis character (unicode
158 // character 0x2026) to render "...". The supplied string is returned if the 159 // character 0x2026) to render "...". The supplied string is returned if the
159 // string has |length| characters or less. 160 // string has |length| characters or less.
160 GFX_EXPORT base::string16 TruncateString(const base::string16& string, 161 GFX_EXPORT base::string16 TruncateString(const base::string16& string,
161 size_t length, 162 size_t length,
162 BreakType break_type); 163 BreakType break_type);
163 164
164 } // namespace gfx 165 } // namespace gfx
165 166
166 #endif // UI_GFX_TEXT_ELIDER_H_ 167 #endif // UI_GFX_TEXT_ELIDER_H_
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/text_elider.cc » ('j') | ui/gfx/text_elider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698