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

Side by Side Diff: chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc

Issue 8917011: Change signature of |ui::ElideText()|. Add a truncate mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <atlbase.h> // NOLINT 8 #include <atlbase.h> // NOLINT
9 #include <atlwin.h> // NOLINT 9 #include <atlwin.h> // NOLINT
10 #endif 10 #endif
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 // We also add this classification's width (sans ellipsis) back to the 434 // We also add this classification's width (sans ellipsis) back to the
435 // available width since we want to consider the available space we'll 435 // available width since we want to consider the available space we'll
436 // have when we draw this classification. 436 // have when we draw this classification.
437 remaining_width += j->pixel_width; 437 remaining_width += j->pixel_width;
438 } 438 }
439 first_classification = false; 439 first_classification = false;
440 440
441 // Can we fit at least an ellipsis? 441 // Can we fit at least an ellipsis?
442 string16 elided_text = 442 string16 elided_text =
443 ui::ElideText(j->text, *j->font, remaining_width, false); 443 ui::ElideText(j->text, *j->font, remaining_width, ui::ELIDE_AT_END);
444 Classifications::reverse_iterator prior_classification(j); 444 Classifications::reverse_iterator prior_classification(j);
445 ++prior_classification; 445 ++prior_classification;
446 const bool on_first_classification = 446 const bool on_first_classification =
447 (prior_classification == i->classifications.rend()); 447 (prior_classification == i->classifications.rend());
448 if (elided_text.empty() && (remaining_width >= ellipsis_width_) && 448 if (elided_text.empty() && (remaining_width >= ellipsis_width_) &&
449 on_first_classification) { 449 on_first_classification) {
450 // Edge case: This classification is bold, we can't fit a bold ellipsis 450 // Edge case: This classification is bold, we can't fit a bold ellipsis
451 // but we can fit a normal one, and this is the first classification in 451 // but we can fit a normal one, and this is the first classification in
452 // the run. We should display a lone normal ellipsis, because appending 452 // the run. We should display a lone normal ellipsis, because appending
453 // one to the end of the previous run might put it in the wrong visual 453 // one to the end of the previous run might put it in the wrong visual
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 // Paint the icon. 522 // Paint the icon.
523 canvas->DrawBitmapInt(*GetIcon(), GetMirroredXForRect(icon_bounds_), 523 canvas->DrawBitmapInt(*GetIcon(), GetMirroredXForRect(icon_bounds_),
524 icon_bounds_.y()); 524 icon_bounds_.y());
525 525
526 // Paint the text. 526 // Paint the text.
527 int x = GetMirroredXForRect(text_bounds_); 527 int x = GetMirroredXForRect(text_bounds_);
528 mirroring_context_->Initialize(x, text_bounds_.width()); 528 mirroring_context_->Initialize(x, text_bounds_.width());
529 PaintMatch(canvas, match_, x); 529 PaintMatch(canvas, match_, x);
530 } 530 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698