summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 01:40:21 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 01:40:21 +0000
commit6ed4b93f7cf53af95c12e0e54a167b7f99028a82 (patch)
treec68c52c3c23d301146353d3b7128556e08956a6a /chrome
parent962c7f7d99ef92ed5339ae384a7b13d41ee38b95 (diff)
downloadchromium_src-6ed4b93f7cf53af95c12e0e54a167b7f99028a82.zip
chromium_src-6ed4b93f7cf53af95c12e0e54a167b7f99028a82.tar.gz
chromium_src-6ed4b93f7cf53af95c12e0e54a167b7f99028a82.tar.bz2
Reduce the amount of space between the location bar and the bookmark bar by allowing the bookmark bar to overlap the toolbar when 'always shown'. This reduces the total height of the toolbar stack by 4 pixels and makes it look better.
Review URL: http://codereview.chromium.org/12668 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc22
-rw-r--r--chrome/browser/views/bookmark_bar_view.h7
-rw-r--r--chrome/browser/views/find_bar_win.cc8
-rw-r--r--chrome/browser/views/frame/browser_view.cc11
4 files changed, 34 insertions, 14 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 7cacef1..0dc01d2 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -52,9 +52,13 @@ using views::MenuButton;
using views::MenuItemView;
using views::View;
+// How much we want the bookmark bar to overlap the toolbar when in its
+// 'always shown' mode.
+static const double kToolbarOverlap = 4.0;
+
// Margins around the content.
-static const int kTopMargin = 2;
-static const int kBottomMargin = 3;
+static const int kTopMargin = 1;
+static const int kBottomMargin = 2;
static const int kLeftMargin = 1;
static const int kRightMargin = 1;
@@ -757,7 +761,7 @@ gfx::Size BookmarkBarView::GetPreferredSize() {
}
gfx::Size prefsize;
- if (IsNewTabPage()) {
+ if (OnNewTabPage()) {
prefsize.set_height(kBarHeight + static_cast<int>(static_cast<double>
(kNewtabBarHeight - kBarHeight) *
(1 - size_animation_->GetCurrentValue())));
@@ -786,7 +790,7 @@ void BookmarkBarView::Layout() {
int height = View::height() - kTopMargin - kBottomMargin;
int separator_margin = kSeparatorMargin;
- if (IsNewTabPage()) {
+ if (OnNewTabPage()) {
double current_state = 1 - size_animation_->GetCurrentValue();
x += static_cast<int>(static_cast<double>
(kNewtabHorizontalPadding) * current_state);
@@ -874,7 +878,7 @@ void BookmarkBarView::ViewHierarchyChanged(bool is_add,
}
void BookmarkBarView::Paint(ChromeCanvas* canvas) {
- if (IsNewTabPage() && (!IsAlwaysShown() || size_animation_->IsAnimating())) {
+ if (OnNewTabPage() && (!IsAlwaysShown() || size_animation_->IsAnimating())) {
// Draw the background to match the new tab page.
canvas->FillRectInt(kNewtabBackgroundColor, 0, 0, width(), height());
@@ -1106,11 +1110,15 @@ bool BookmarkBarView::IsAlwaysShown() {
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
}
-bool BookmarkBarView::IsNewTabPage() {
+bool BookmarkBarView::OnNewTabPage() {
return (browser_ && browser_->GetSelectedTabContents() &&
browser_->GetSelectedTabContents()->IsBookmarkBarAlwaysVisible());
}
+int BookmarkBarView::GetToolbarOverlap() {
+ return static_cast<int>(size_animation_->GetCurrentValue() * kToolbarOverlap);
+}
+
void BookmarkBarView::AnimationProgressed(const Animation* animation) {
if (browser_)
browser_->ToolbarSizeChanged(NULL, true);
@@ -1368,7 +1376,7 @@ void BookmarkBarView::RunMenu(views::View* view,
int x = view->GetX(APPLY_MIRRORING_TRANSFORMATION);
int bar_height = height() - kMenuOffset;
- if (IsNewTabPage() && !IsAlwaysShown())
+ if (OnNewTabPage() && !IsAlwaysShown())
bar_height -= kNewtabVerticalPadding;
int start_index = 0;
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index 754d6b6..3cd7a57 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -135,8 +135,11 @@ class BookmarkBarView : public views::View,
// page).
bool IsAlwaysShown();
- // True if we're supposed to draw the bookmarks bar in the new tab style.
- bool IsNewTabPage();
+ // True if we're on a page where the bookmarks bar is always visible.
+ bool OnNewTabPage();
+
+ // How much we want the bookmark bar to overlap the toolbar.
+ int GetToolbarOverlap();
// Whether or not we are animating.
bool IsAnimating() { return size_animation_->IsAnimating(); }
diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc
index 4df9801..0510762 100644
--- a/chrome/browser/views/find_bar_win.cc
+++ b/chrome/browser/views/find_bar_win.cc
@@ -506,7 +506,7 @@ void FindBarWin::GetDialogBounds(gfx::Rect* bounds) {
// If we're not in the New Tab page style, align ourselves with
// the bookmarks bar (this works even if the bar is hidden).
- if (!bookmark_bar->IsNewTabPage() ||
+ if (!bookmark_bar->OnNewTabPage() ||
bookmark_bar->IsAlwaysShown()) {
bookmark_bar_bounds = bookmark_bar->bounds();
}
@@ -526,8 +526,10 @@ void FindBarWin::GetDialogBounds(gfx::Rect* bounds) {
y_pos_offset = toolbar_bounds.bottom() - 1;
// If there is a bookmark bar attached to the toolbar we should appear
// attached to it instead of the toolbar.
- if (!bookmark_bar_bounds.IsEmpty())
- y_pos_offset += bookmark_bar_bounds.height() - 1;
+ if (!bookmark_bar_bounds.IsEmpty()) {
+ y_pos_offset += bookmark_bar_bounds.height() - 1 -
+ bookmark_bar->GetToolbarOverlap();
+ }
} else {
// There is no toolbar, so this is probably a constrained window or a Chrome
// Application. This means we draw the Find window at the top of the page
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 4a54a4e..f9894dd 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -516,7 +516,7 @@ bool BrowserView::IsBookmarkBarVisible() const {
if (!bookmark_bar_view_.get())
return false;
- if (bookmark_bar_view_->IsNewTabPage() || bookmark_bar_view_->IsAnimating())
+ if (bookmark_bar_view_->OnNewTabPage() || bookmark_bar_view_->IsAnimating())
return true;
// 1 is the minimum in GetPreferredSize for the bookmark bar.
@@ -1068,11 +1068,17 @@ int BrowserView::LayoutBookmarkAndInfoBars(int top) {
// Info bar _above_ the Bookmark bar, since the Bookmark bar is styled to
// look like it's part of the New Tab Page...
if (active_bookmark_bar_ &&
- bookmark_bar_view_->IsNewTabPage() &&
+ bookmark_bar_view_->OnNewTabPage() &&
!bookmark_bar_view_->IsAlwaysShown()) {
top = LayoutInfoBar(top);
return LayoutBookmarkBar(top);
}
+
+ // If we're showing a regular bookmark bar and it's not below an infobar,
+ // make it overlap the toolbar so that the bar items can be drawn higher.
+ if (active_bookmark_bar_)
+ top -= bookmark_bar_view_->GetToolbarOverlap();
+
// Otherwise, Bookmark bar first, Info bar second.
top = LayoutBookmarkBar(top);
}
@@ -1089,6 +1095,7 @@ int BrowserView::LayoutBookmarkBar(int top) {
}
return top;
}
+
int BrowserView::LayoutInfoBar(int top) {
if (SupportsWindowFeature(FEATURE_INFOBAR)) {
// Layout the InfoBar container.