Index: chrome/browser/ui/views/toolbar/toolbar_view.cc |
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
index 5f1b2a608f0a7b92ac4182509a32659576a85043..21dea04eabd9baad1baa53a9309ca6aa13a61adb 100644 |
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc |
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
@@ -604,21 +604,30 @@ void ToolbarView::Layout() { |
theme_provider->GetDisplayProperty( |
ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING); |
- int browser_actions_width = browser_actions_->GetPreferredSize().width(); |
+ int browser_actions_desired_width = |
+ browser_actions_->GetPreferredSize().width(); |
int app_menu_width = app_menu_->GetPreferredSize().width(); |
const int right_edge_spacing = theme_provider->GetDisplayProperty( |
ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING); |
const int location_bar_right_padding = theme_provider->GetDisplayProperty( |
ThemeProperties::PROPERTY_TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING); |
+ |
+ // Don't allow the omnibox to shrink to the point of non-existence. |
+ int kMinimumLocationBarWidth = 100; |
Peter Kasting
2015/09/15 00:13:38
(1) You should probably BUG=58915 in your CL descr
Devlin
2015/09/15 18:22:39
1) Wow, that's an old one. Good find.
2) Done.
|
int available_width = std::max( |
- 0, width() - right_edge_spacing - app_menu_width - browser_actions_width - |
- (browser_actions_width > 0 ? element_padding : 0) - |
- location_bar_right_padding - next_element_x); |
+ 0, width() - right_edge_spacing - app_menu_width - |
+ (browser_actions_desired_width > 0 ? element_padding : 0) - |
+ location_bar_right_padding - next_element_x - |
+ kMinimumLocationBarWidth); |
+ int browser_actions_width = |
+ std::min(available_width, browser_actions_desired_width); |
+ available_width -= browser_actions_width; |
Peter Kasting
2015/09/15 00:13:39
This gives the browser actions area as much space
Devlin
2015/09/15 18:22:39
Hmm... I'd like to avoid this for now. For one th
|
+ int location_bar_width = kMinimumLocationBarWidth + available_width; |
Peter Kasting
2015/09/15 00:13:39
This statement seems wrong. Why are we adding in
Devlin
2015/09/15 18:22:39
Above, we subtract out the minimum location bar wi
|
int location_height = location_bar_->GetPreferredSize().height(); |
int location_y = (height() - location_height + 1) / 2; |
location_bar_->SetBounds(next_element_x, location_y, |
- std::max(available_width, 0), location_height); |
+ location_bar_width, location_height); |
next_element_x = location_bar_->bounds().right() + location_bar_right_padding; |
browser_actions_->SetBounds( |