Chromium Code Reviews| Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| index 884ab3339ad7d9c523d5c869b6a761fe2e16f75a..2a5470083490bfe1e276a9531db2b23331d936f8 100644 |
| --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| @@ -598,6 +598,7 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { |
| // static |
| const char BookmarkBarView::kViewClassName[] = "BookmarkBarView"; |
| +int BookmarkBarView::extra_font_padding_ = -1; |
| BookmarkBarView::BookmarkBarView(Browser* browser, BrowserView* browser_view) |
| : page_navigator_(NULL), |
| @@ -843,17 +844,31 @@ int BookmarkBarView::GetToolbarOverlap() const { |
| size_animation_.GetCurrentValue()); |
| } |
| +int BookmarkBarView::GetExtraFontPadding() const { |
| + if (extra_font_padding_ == -1) { |
| + int height = 0; |
| + for (int i = 0; i < child_count(); ++i) { |
| + const views::View* view = child_at(i); |
| + gfx::Size pref = view->GetPreferredSize(); |
| + height = std::max(pref.height(), height); |
| + } |
| + extra_font_padding_ = std::max(0, height - chrome::kBookmarkBarHeight); |
| + } |
| + return extra_font_padding_; |
| +} |
| + |
| gfx::Size BookmarkBarView::GetPreferredSize() const { |
| gfx::Size prefsize; |
| if (IsDetached()) { |
| + int padded_height = chrome::kBookmarkBarHeight + GetExtraFontPadding(); |
| prefsize.set_height( |
| - chrome::kBookmarkBarHeight + |
| - static_cast<int>( |
| - (chrome::kNTPBookmarkBarHeight - chrome::kBookmarkBarHeight) * |
| - (1 - size_animation_.GetCurrentValue()))); |
| + padded_height + |
| + static_cast<int>((chrome::kNTPBookmarkBarHeight - padded_height) * |
| + (1 - size_animation_.GetCurrentValue()))); |
| } else { |
| - prefsize.set_height(static_cast<int>(chrome::kBookmarkBarHeight * |
| - size_animation_.GetCurrentValue())); |
| + prefsize.set_height( |
| + static_cast<int>((chrome::kBookmarkBarHeight + GetExtraFontPadding()) * |
|
Evan Stade
2016/08/04 16:05:40
this should probably just take the max of its chil
kylix_rd
2016/08/04 16:42:10
One of the issues I noticed is if the calculation
|
| + size_animation_.GetCurrentValue())); |
| } |
| return prefsize; |
| } |