summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 00:08:19 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 00:08:19 +0000
commit778c0d933118eec1b9a027010051e432d6d09852 (patch)
treeeaa868f55e0174d3fea22a8df0cc7d81bd2aa123 /chrome/browser
parent28b5a8494387b85fa19ca61940760e08954bcaa3 (diff)
downloadchromium_src-778c0d933118eec1b9a027010051e432d6d09852.zip
chromium_src-778c0d933118eec1b9a027010051e432d6d09852.tar.gz
chromium_src-778c0d933118eec1b9a027010051e432d6d09852.tar.bz2
Don't allow the browser window to be resized so small that layout starts breaking horribly. When it _is_ small, draw the frame correctly.This is an incomplete fix; only non-Aero main/popup/app windows are handled so far, but this was becoming hairy enough I wanted to checkpoint it.BUG=9885
Review URL: http://codereview.chromium.org/88069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc9
-rw-r--r--chrome/browser/views/bookmark_bar_view.h6
-rw-r--r--chrome/browser/views/frame/browser_view.cc31
-rw-r--r--chrome/browser/views/frame/browser_view.h1
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc178
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.h11
-rw-r--r--chrome/browser/views/toolbar_view.cc13
7 files changed, 181 insertions, 68 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 5acf012..364624c 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -529,6 +529,10 @@ gfx::Size BookmarkBarView::GetPreferredSize() {
return prefsize;
}
+gfx::Size BookmarkBarView::GetMinimumSize() {
+ return gfx::Size(0, kBarHeight);
+}
+
void BookmarkBarView::Layout() {
if (!GetParent())
return;
@@ -891,8 +895,9 @@ bool BookmarkBarView::OnNewTabPage() {
browser_->GetSelectedTabContents()->IsBookmarkBarAlwaysVisible());
}
-int BookmarkBarView::GetToolbarOverlap() {
- return static_cast<int>(size_animation_->GetCurrentValue() * kToolbarOverlap);
+int BookmarkBarView::GetToolbarOverlap(bool return_max) {
+ return static_cast<int>(kToolbarOverlap *
+ (return_max ? 1.0 : size_animation_->GetCurrentValue()));
}
void BookmarkBarView::AnimationProgressed(const Animation* animation) {
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index 0726449..5947c60 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -90,6 +90,7 @@ class BookmarkBarView : public views::View,
// View methods:
virtual gfx::Size GetPreferredSize();
+ virtual gfx::Size GetMinimumSize();
virtual void Layout();
virtual void DidChangeBounds(const gfx::Rect& previous,
const gfx::Rect& current);
@@ -138,8 +139,9 @@ class BookmarkBarView : public views::View,
// 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();
+ // How much we want the bookmark bar to overlap the toolbar. If |return_max|
+ // is true, we return the maximum overlap rather than the current overlap.
+ int GetToolbarOverlap(bool return_max);
// Whether or not we are animating.
bool IsAnimating() { return size_animation_->IsAnimating(); }
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index e9378ff..b7906ed 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1164,6 +1164,35 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
return views::ClientView::NonClientHitTest(point);
}
+gfx::Size BrowserView::GetMinimumSize() {
+ // TODO: In theory the tabstrip width should probably be
+ // (OTR + tabstrip + caption buttons) width.
+ gfx::Size tabstrip_size(
+ browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
+ tabstrip_->GetMinimumSize() : gfx::Size());
+ gfx::Size toolbar_size(
+ (browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
+ browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ?
+ toolbar_->GetMinimumSize() : gfx::Size());
+ if (tabstrip_size.height() && toolbar_size.height())
+ toolbar_size.Enlarge(0, -kToolbarTabStripVerticalOverlap);
+ gfx::Size bookmark_bar_size;
+ if (active_bookmark_bar_ &&
+ browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) {
+ bookmark_bar_size = active_bookmark_bar_->GetMinimumSize();
+ bookmark_bar_size.Enlarge(0,
+ -kSeparationLineHeight - bookmark_bar_view_->GetToolbarOverlap(true));
+ }
+ gfx::Size contents_size(contents_container_->GetMinimumSize());
+
+ int min_height = tabstrip_size.height() + toolbar_size.height() +
+ bookmark_bar_size.height() + contents_size.height();
+ int widths[] = { tabstrip_size.width(), toolbar_size.width(),
+ bookmark_bar_size.width(), contents_size.width() };
+ int min_width = *std::max_element(&widths[0], &widths[arraysize(widths)]);
+ return gfx::Size(min_width, min_height);
+}
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, views::View overrides:
@@ -1327,7 +1356,7 @@ int BrowserView::LayoutBookmarkBar(int top) {
int height, y = top;
if (visible) {
y -= kSeparationLineHeight + (bookmark_bar_view_->IsDetachedStyle() ?
- 0 : bookmark_bar_view_->GetToolbarOverlap());
+ 0 : bookmark_bar_view_->GetToolbarOverlap(false));
height = bookmark_bar_view_->GetPreferredSize().height();
} else {
height = 0;
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 30b5aaf6..8bfb180 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -243,6 +243,7 @@ class BrowserView : public BrowserWindow,
// Overridden from views::ClientView:
virtual bool CanClose() const;
virtual int NonClientHitTest(const gfx::Point& point);
+ virtual gfx::Size GetMinimumSize();
// Is P13N enabled for this browser window?
#ifdef CHROME_PERSONALIZATION
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index ef80018..a93449f 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -442,6 +442,26 @@ void OpaqueBrowserFrameView::UpdateThrobber(bool running) {
window_icon_->Update();
}
+gfx::Size OpaqueBrowserFrameView::GetMinimumSize() {
+ gfx::Size min_size(browser_view_->GetMinimumSize());
+ int border_thickness = NonClientBorderThickness();
+ min_size.Enlarge(2 * border_thickness,
+ NonClientTopBorderHeight() + border_thickness);
+
+ views::WindowDelegate* d = frame_->GetDelegate();
+ int min_titlebar_width = (2 * FrameBorderThickness()) + kIconLeftSpacing +
+ (d->ShouldShowWindowIcon() ?
+ (IconSize(NULL, NULL, NULL) + kTitleLogoSpacing) : 0) +
+ ((distributor_logo_ && browser_view_->ShouldShowDistributorLogo()) ?
+ (distributor_logo_->width() + kLogoCaptionSpacing) : 0) +
+ minimize_button_->GetMinimumSize().width() +
+ restore_button_->GetMinimumSize().width() +
+ close_button_->GetMinimumSize().width();
+ min_size.set_width(std::max(min_size.width(), min_titlebar_width));
+
+ return min_size;
+}
+
///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, views::NonClientFrameView implementation:
@@ -663,10 +683,8 @@ int OpaqueBrowserFrameView::NonClientBorderThickness() const {
}
int OpaqueBrowserFrameView::NonClientTopBorderHeight() const {
- if (frame_->GetDelegate()->ShouldShowWindowTitle()) {
- int title_top_spacing, title_thickness;
- return TitleCoordinates(&title_top_spacing, &title_thickness);
- }
+ if (frame_->GetDelegate()->ShouldShowWindowTitle())
+ return TitleCoordinates(NULL, NULL);
return FrameBorderThickness() +
((frame_->IsMaximized() || frame_->IsFullscreen()) ?
@@ -685,11 +703,11 @@ int OpaqueBrowserFrameView::UnavailablePixelsAtBottomOfNonClientHeight() const {
(frame_->IsMaximized() ? 0 : kClientEdgeThickness);
}
-int OpaqueBrowserFrameView::TitleCoordinates(int* title_top_spacing,
- int* title_thickness) const {
+int OpaqueBrowserFrameView::TitleCoordinates(int* title_top_spacing_ptr,
+ int* title_thickness_ptr) const {
int frame_thickness = FrameBorderThickness();
int min_titlebar_height = kTitlebarMinimumHeight + frame_thickness;
- *title_top_spacing = frame_thickness + kTitleTopSpacing;
+ int title_top_spacing = frame_thickness + kTitleTopSpacing;
// The bottom spacing should be the same apparent height as the top spacing.
// Because the actual top spacing height varies based on the system border
// thickness, we calculate this based on the restored top spacing and then
@@ -703,15 +721,38 @@ int OpaqueBrowserFrameView::TitleCoordinates(int* title_top_spacing,
// When we maximize, the top border appears to be chopped off; shift the
// title down to stay centered within the remaining space.
int title_adjust = (kFrameBorderThickness / 2);
- *title_top_spacing += title_adjust;
+ title_top_spacing += title_adjust;
title_bottom_spacing -= title_adjust;
}
- *title_thickness = std::max(title_font_->height(),
- min_titlebar_height - *title_top_spacing - title_bottom_spacing);
- return *title_top_spacing + *title_thickness + title_bottom_spacing +
+ int title_thickness = std::max(title_font_->height(),
+ min_titlebar_height - title_top_spacing - title_bottom_spacing);
+ if (title_top_spacing_ptr)
+ *title_top_spacing_ptr = title_top_spacing;
+ if (title_thickness_ptr)
+ *title_thickness_ptr = title_thickness;
+ return title_top_spacing + title_thickness + title_bottom_spacing +
UnavailablePixelsAtBottomOfNonClientHeight();
}
+int OpaqueBrowserFrameView::IconSize(int* title_top_spacing_ptr,
+ int* title_thickness_ptr,
+ int* available_height_ptr) const {
+ // The usable height of the titlebar area is the total height minus the top
+ // resize border and any edge area we draw at its bottom.
+ int frame_thickness = FrameBorderThickness();
+ int top_height = TitleCoordinates(title_top_spacing_ptr, title_thickness_ptr);
+ int available_height = top_height - frame_thickness -
+ UnavailablePixelsAtBottomOfNonClientHeight();
+ if (available_height_ptr)
+ *available_height_ptr = available_height;
+
+ // The icon takes up a constant fraction of the available height, down to a
+ // minimum size, and is always an even number of pixels on a side (presumably
+ // to make scaled icons look better). It's centered within the usable height.
+ return std::max((available_height * kIconHeightFractionNumerator /
+ kIconHeightFractionDenominator) / 2 * 2, kIconMinimumSize);
+}
+
void OpaqueBrowserFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) {
SkBitmap* top_left_corner = resources()->GetPartBitmap(FRAME_TOP_LEFT_CORNER);
SkBitmap* top_right_corner =
@@ -726,11 +767,17 @@ void OpaqueBrowserFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) {
SkBitmap* bottom_edge = resources()->GetPartBitmap(FRAME_BOTTOM_EDGE);
// Top.
- canvas->DrawBitmapInt(*top_left_corner, 0, 0);
+ int top_left_height = std::min(top_left_corner->height(),
+ height() - bottom_left_corner->height());
+ canvas->DrawBitmapInt(*top_left_corner, 0, 0, top_left_corner->width(),
+ top_left_height, 0, 0, top_left_corner->width(), top_left_height, false);
canvas->TileImageInt(*top_edge, top_left_corner->width(), 0,
width() - top_right_corner->width(), top_edge->height());
- canvas->DrawBitmapInt(*top_right_corner,
- width() - top_right_corner->width(), 0);
+ int top_right_height = std::min(top_right_corner->height(),
+ height() - bottom_right_corner->height());
+ canvas->DrawBitmapInt(*top_right_corner, 0, 0, top_right_corner->width(),
+ top_right_height, width() - top_right_corner->width(), 0,
+ top_right_corner->width(), top_right_height, false);
// Note: When we don't have a toolbar, we need to draw some kind of bottom
// edge here. Because the App Window graphics we use for this have an
// attached client edge and their sizing algorithm is a little involved, we do
@@ -738,9 +785,8 @@ void OpaqueBrowserFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) {
// Right.
canvas->TileImageInt(*right_edge, width() - right_edge->width(),
- top_right_corner->height(), right_edge->width(),
- height() - top_right_corner->height() -
- bottom_right_corner->height());
+ top_right_height, right_edge->width(),
+ height() - top_right_height - bottom_right_corner->height());
// Bottom.
canvas->DrawBitmapInt(*bottom_right_corner,
@@ -755,9 +801,8 @@ void OpaqueBrowserFrameView::PaintRestoredFrameBorder(ChromeCanvas* canvas) {
height() - bottom_left_corner->height());
// Left.
- canvas->TileImageInt(*left_edge, 0, top_left_corner->height(),
- left_edge->width(),
- height() - top_left_corner->height() - bottom_left_corner->height());
+ canvas->TileImageInt(*left_edge, 0, top_left_height, left_edge->width(),
+ height() - top_left_height - bottom_left_corner->height());
}
void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) {
@@ -812,29 +857,44 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(ChromeCanvas* canvas) {
View::ConvertPointToView(frame_->GetClientView(), this, &toolbar_origin);
toolbar_bounds.set_origin(toolbar_origin);
- SkBitmap* toolbar_left =
- resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT);
- canvas->DrawBitmapInt(*toolbar_left,
- toolbar_bounds.x() - toolbar_left->width(),
- toolbar_bounds.y());
-
- // Gross hack: We split the toolbar image into two pieces, since sometimes
+ // Gross hack: We split the toolbar images into two pieces, since sometimes
// (popup mode) the toolbar isn't tall enough to show the whole image. The
// split happens between the top shadow section and the bottom gradient
// section so that we never break the gradient.
int split_point = kFrameShadowThickness * 2;
+ int bottom_y = toolbar_bounds.y() + split_point;
+ SkBitmap* toolbar_left =
+ resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT);
+ int bottom_edge_height =
+ std::min(toolbar_left->height(), toolbar_bounds.height()) - split_point;
+
+ canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point,
+ toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y(),
+ toolbar_left->width(), split_point, false);
+ canvas->DrawBitmapInt(*toolbar_left, 0,
+ toolbar_left->height() - bottom_edge_height, toolbar_left->width(),
+ bottom_edge_height, toolbar_bounds.x() - toolbar_left->width(), bottom_y,
+ toolbar_left->width(), bottom_edge_height, false);
+
SkBitmap* toolbar_center =
resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP);
canvas->TileImageInt(*toolbar_center, 0, 0, toolbar_bounds.x(),
toolbar_bounds.y(), toolbar_bounds.width(), split_point);
+ int bottom_center_height =
+ std::min(toolbar_center->height(), toolbar_bounds.height()) - split_point;
canvas->TileImageInt(*toolbar_center, 0,
- toolbar_center->height() - toolbar_bounds.height() + split_point,
- toolbar_bounds.x(), toolbar_bounds.y() + split_point,
- toolbar_bounds.width(), toolbar_bounds.height() - split_point);
-
- canvas->DrawBitmapInt(
- *resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT),
- toolbar_bounds.right(), toolbar_bounds.y());
+ toolbar_center->height() - bottom_center_height, toolbar_bounds.x(),
+ bottom_y, toolbar_bounds.width(), bottom_center_height);
+
+ SkBitmap* toolbar_right =
+ resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT);
+ canvas->DrawBitmapInt(*toolbar_right, 0, 0, toolbar_right->width(),
+ split_point, toolbar_bounds.right(), toolbar_bounds.y(),
+ toolbar_right->width(), split_point, false);
+ canvas->DrawBitmapInt(*toolbar_right, 0,
+ toolbar_right->height() - bottom_edge_height, toolbar_right->width(),
+ bottom_edge_height, toolbar_bounds.right(), bottom_y,
+ toolbar_right->width(), bottom_edge_height, false);
}
void OpaqueBrowserFrameView::PaintOTRAvatar(ChromeCanvas* canvas) {
@@ -854,10 +914,12 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(ChromeCanvas* canvas) {
gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
if (browser_view_->IsToolbarVisible()) {
- // The client edges start below the toolbar upper corner images regardless
- // of how tall the toolbar itself is.
- client_area_top += browser_view_->GetToolbarBounds().y() +
- resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height();
+ // The client edges start below the toolbar or its corner images, whichever
+ // is shorter.
+ gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds());
+ client_area_top += toolbar_bounds.y() + std::min(
+ resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height(),
+ toolbar_bounds.height());
} else {
// The toolbar isn't going to draw a client edge for us, so draw one
// ourselves.
@@ -865,18 +927,23 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(ChromeCanvas* canvas) {
// shorter than the top left and right bitmaps. We need their top edges to
// line up, and we need the left and right edges to start below the corners'
// bottoms.
+ SkBitmap* top_left = resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_LEFT);
SkBitmap* top_center =
resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_CENTER);
- SkBitmap* top_left = resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_LEFT);
+ SkBitmap* top_right =
+ resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_RIGHT);
int top_edge_y = client_area_top - top_center->height();
- client_area_top = top_edge_y + top_left->height();
- canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(),
- top_edge_y);
- canvas->TileImageInt(*top_center, client_area_bounds.x(), top_edge_y,
- client_area_bounds.width(), top_center->height());
- canvas->DrawBitmapInt(
- *resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_RIGHT),
- client_area_bounds.right(), top_edge_y);
+ client_area_top = std::min(top_edge_y + top_left->height(),
+ height() - NonClientBorderThickness());
+ int height = client_area_top - top_edge_y;
+ canvas->DrawBitmapInt(*top_left, 0, 0, top_left->width(), height,
+ client_area_bounds.x() - top_left->width(), top_edge_y,
+ top_left->width(), height, false);
+ canvas->TileImageInt(*top_center, 0, 0, client_area_bounds.x(), top_edge_y,
+ client_area_bounds.width(), std::min(height, top_center->height()));
+ canvas->DrawBitmapInt(*top_right, 0, 0, top_right->width(), height,
+ client_area_bounds.right(), top_edge_y,
+ top_right->width(), height, false);
}
int client_area_bottom =
@@ -970,19 +1037,10 @@ void OpaqueBrowserFrameView::LayoutTitleBar() {
int frame_thickness = FrameBorderThickness();
int icon_x = frame_thickness + kIconLeftSpacing;
- // The usable height of the titlebar area is the total height minus the top
- // resize border and any edge area we draw at its bottom.
- int title_top_spacing, title_thickness;
- InitAppWindowResources();
- int top_height = TitleCoordinates(&title_top_spacing, &title_thickness);
- int available_height = top_height - frame_thickness -
- UnavailablePixelsAtBottomOfNonClientHeight();
-
- // The icon takes up a constant fraction of the available height, down to a
- // minimum size, and is always an even number of pixels on a side (presumably
- // to make scaled icons look better). It's centered within the usable height.
- int icon_size = std::max((available_height * kIconHeightFractionNumerator /
- kIconHeightFractionDenominator) / 2 * 2, kIconMinimumSize);
+ InitAppWindowResources(); // ! Should we do this? Isn't this a perf hit?
+ int title_top_spacing, title_thickness, available_height;
+ int icon_size =
+ IconSize(&title_top_spacing, &title_thickness, &available_height);
int icon_y = ((available_height - icon_size) / 2) + frame_thickness;
// Hack: Our frame border has a different "3D look" than Windows'. Theirs has
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h
index fd80b7c..ecbab36 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.h
@@ -32,6 +32,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
// Overridden from BrowserNonClientFrameView:
virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const;
virtual void UpdateThrobber(bool running);
+ virtual gfx::Size GetMinimumSize();
protected:
// Overridden from views::NonClientFrameView:
@@ -87,8 +88,14 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
// Calculates multiple values related to title layout. Returns the height of
// the entire titlebar including any connected client edge.
- int TitleCoordinates(int* title_top_spacing,
- int* title_thickness) const;
+ int TitleCoordinates(int* title_top_spacing_ptr,
+ int* title_thickness_ptr) const;
+
+ // Calculates multiple values related to icon layout. Returns the size of the
+ // icon (along one edge).
+ int IconSize(int* title_top_spacing_ptr,
+ int* title_thickness_ptr,
+ int* available_height_ptr) const;
// Paint various sub-components of this view. The *FrameBorder() functions
// also paint the background of the titlebar area, since the top frame border
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index d5136b6..31bf7d2 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -534,12 +534,23 @@ bool BrowserToolbarView::OnKeyReleased(const views::KeyEvent& e) {
gfx::Size BrowserToolbarView::GetPreferredSize() {
if (IsDisplayModeNormal()) {
+ int min_width = kControlIndent + back_->GetPreferredSize().width() +
+ forward_->GetPreferredSize().width() + kControlHorizOffset +
+ reload_->GetPreferredSize().width() + (show_home_button_.GetValue() ?
+ (home_->GetPreferredSize().width() + kControlHorizOffset) : 0) +
+ star_->GetPreferredSize().width() + go_->GetPreferredSize().width() +
+ kMenuButtonOffset +
+ (bookmark_menu_ ? bookmark_menu_->GetPreferredSize().width() : 0) +
+ page_menu_->GetPreferredSize().width() +
+ app_menu_->GetPreferredSize().width() + kPaddingRight;
+
static SkBitmap normal_background;
if (normal_background.isNull()) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER);
}
- return gfx::Size(0, normal_background.height());
+
+ return gfx::Size(min_width, normal_background.height());
}
int vertical_spacing = PopupTopSpacing() +