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

Side by Side Diff: ui/views/controls/styled_label.cc

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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "ui/views/controls/styled_label.h" 5 #include "ui/views/controls/styled_label.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // should be used when eliding text. 234 // should be used when eliding text.
235 if (position >= range.start()) { 235 if (position >= range.start()) {
236 text_font_list = text_font_list.DeriveWithStyle( 236 text_font_list = text_font_list.DeriveWithStyle(
237 current_range->style_info.font_style); 237 current_range->style_info.font_style);
238 } 238 }
239 gfx::ElideRectangleText(remaining_string, 239 gfx::ElideRectangleText(remaining_string,
240 text_font_list, 240 text_font_list,
241 chunk_bounds.width(), 241 chunk_bounds.width(),
242 chunk_bounds.height(), 242 chunk_bounds.height(),
243 gfx::IGNORE_LONG_WORDS, 243 gfx::IGNORE_LONG_WORDS,
244 &substrings); 244 &substrings,
245 nullptr);
245 246
246 DCHECK(!substrings.empty()); 247 DCHECK(!substrings.empty());
247 base::string16 chunk = substrings[0]; 248 base::string16 chunk = substrings[0];
248 if (chunk.empty()) { 249 if (chunk.empty()) {
249 // Nothing fits on this line. Start a new line. 250 // Nothing fits on this line. Start a new line.
250 // If x is 0, first line may have leading whitespace that doesn't fit in a 251 // If x is 0, first line may have leading whitespace that doesn't fit in a
251 // single line, so try trimming those. Otherwise there is no room for 252 // single line, so try trimming those. Otherwise there is no room for
252 // anything; abort. 253 // anything; abort.
253 if (x == 0) { 254 if (x == 0) {
254 if (line == 0) { 255 if (line == 0) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 317 }
317 318
318 // The user-specified line height only applies to interline spacing, so the 319 // The user-specified line height only applies to interline spacing, so the
319 // final line's height is unaffected. 320 // final line's height is unaffected.
320 int total_height = line * line_height + 321 int total_height = line * line_height +
321 CalculateLineHeight(font_list_) + GetInsets().height(); 322 CalculateLineHeight(font_list_) + GetInsets().height();
322 return gfx::Size(width, total_height); 323 return gfx::Size(width, total_height);
323 } 324 }
324 325
325 } // namespace views 326 } // namespace views
OLDNEW
« ui/gfx/text_elider.cc ('K') | « ui/message_center/views/bounded_label.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698