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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 2208973003: Add some extra height to bookmark bar if the font wants to be larger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698