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..bed906015d966a71e5a77107025ee5e41aee717b 100644 |
| --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
| @@ -172,7 +172,7 @@ static const int kAppsShortcutButtonTag = 2; |
| // Preferred padding between text and edge. |
| static const int kButtonPaddingHorizontal = 6; |
| -static const int kButtonPaddingVertical = 4; |
| +static const int kButtonPaddingVertical = 5; |
|
kylix_rd
2016/08/05 18:32:09
This value is inconsistent with the other buttons'
|
| static const gfx::ElideBehavior kElideBehavior = gfx::FADE_TAIL; |
| @@ -843,16 +843,33 @@ int BookmarkBarView::GetToolbarOverlap() const { |
| size_animation_.GetCurrentValue()); |
| } |
| +int BookmarkBarView::GetPreferredHeight() const { |
| + int height = 0; |
| + for (int i = 0; i < child_count(); ++i) { |
| + const views::View* view = child_at(i); |
| + if (view->visible()) { |
| + gfx::Size pref = view->GetPreferredSize(); |
| + // If this is the instructions view, enlarge it's height by the same |
|
Peter Kasting
2016/08/05 21:23:00
Nit: its
kylix_rd
2016/08/08 15:33:21
Done.
|
| + // padding as the other buttons. This is necessary if the instructions |
| + // view is the only visible view. |
|
Peter Kasting
2016/08/05 21:23:00
This comment confuses me a bit. Are we basically
|
| + if (view == instructions_) |
| + pref.Enlarge(0, kButtonPaddingVertical * 2); |
|
Peter Kasting
2016/08/05 21:23:00
What if we just set this as an empty border on the
kylix_rd
2016/08/08 15:33:21
The instructions view doesn't respect the set bord
Peter Kasting
2016/08/08 19:10:01
It seems offhand like part of the problem there is
|
| + height = std::max(pref.height(), height); |
| + } |
| + } |
| + return std::max(height, chrome::kBookmarkBarHeight); |
| +} |
| + |
| gfx::Size BookmarkBarView::GetPreferredSize() const { |
| gfx::Size prefsize; |
| if (IsDetached()) { |
| + int padded_height = GetPreferredHeight(); |
| 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 * |
| + prefsize.set_height(static_cast<int>((GetPreferredHeight()) * |
|
Peter Kasting
2016/08/05 21:23:00
Nit: No need for extra parens
kylix_rd
2016/08/08 15:33:21
Done.
|
| size_animation_.GetCurrentValue())); |
| } |
| return prefsize; |
| @@ -879,7 +896,7 @@ gfx::Size BookmarkBarView::GetMinimumSize() const { |
| // if they are visible. |
| int width = GetHorizontalMargin(); |
| - int height = chrome::kBookmarkBarHeight; |
| + int height = GetPreferredHeight(); |
| if (IsDetached()) { |
| double current_state = 1 - size_animation_.GetCurrentValue(); |
| width += 2 * static_cast<int>(kNewTabHorizontalPadding * current_state); |
| @@ -925,7 +942,7 @@ void BookmarkBarView::Layout() { |
| int top_margin = IsDetached() ? kDetachedTopMargin : 0; |
| int y = top_margin; |
| int width = View::width() - 2 * GetHorizontalMargin(); |
| - int height = chrome::kBookmarkBarHeight - kBottomMargin; |
| + int height = GetPreferredHeight() - kBottomMargin; |
| int separator_margin = kSeparatorMargin; |
| if (IsDetached()) { |
| @@ -938,7 +955,7 @@ void BookmarkBarView::Layout() { |
| // For the attached appearance, pin the content to the bottom of the bar |
| // when animating in/out, as shrinking its height instead looks weird. This |
| // also matches how we layout infobars. |
| - y += View::height() - chrome::kBookmarkBarHeight; |
| + y += View::height() - GetPreferredHeight(); |
| } |
| gfx::Size other_bookmarks_pref = other_bookmarks_button_->visible() ? |