Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| index 53c7ccadc2bcf319ebc710c1494847990cb843a3..adff11f469a86010d63e30c31bf5f3a93796596d 100644 |
| --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc |
| @@ -51,12 +51,20 @@ gfx::Size SelectedKeywordView::GetPreferredSize() const { |
| gfx::Size SelectedKeywordView::GetMinimumSize() const { |
| // Height will be ignored by the LocationBarView. |
| - return GetSizeForLabelWidth(partial_label_.GetMinimumSize().width()); |
| + return GetSizeForLabelWidth(0); |
| } |
| void SelectedKeywordView::Layout() { |
| - SetLabel(((width() == GetPreferredSize().width()) ? |
| - full_label_ : partial_label_).text()); |
| + // Keep showing the full label as long as there's more than enough width for |
| + // the partial label. Otherwise there will be empty space displayed next to |
| + // the partial label. |
| + if (width() > |
| + GetSizeForLabelWidth(partial_label_.GetPreferredSize().width()).width()) { |
| + SetLabel(full_label_.text()); |
| + } else { |
| + SetLabel(partial_label_.text()); |
| + } |
| + |
| IconLabelBubbleView::Layout(); |
| } |
| @@ -79,14 +87,7 @@ void SelectedKeywordView::SetKeyword(const base::string16& keyword) { |
| : l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT_MD, short_name); |
| full_label_.SetText(full_name); |
| - const base::string16 min_string( |
| - location_bar_util::CalculateMinString(short_name)); |
|
Peter Kasting
2017/03/08 03:13:12
With the removal of this call, I think only the Ma
|
| - const base::string16 partial_name = |
| - is_extension_keyword |
| - ? min_string |
| - : l10n_util::GetStringFUTF16(IDS_OMNIBOX_KEYWORD_TEXT_MD, min_string); |
| - partial_label_.SetText(min_string.empty() ? |
| - full_label_.text() : partial_name); |
| + partial_label_.SetText(short_name); |
| // Update the label now so ShouldShowLabel() works correctly when the parent |
| // class is calculating the preferred size. It will be updated again in |