| 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 56480403e9d357cb81b9766883b9c2dc6e632840..beae60d3d9d5f7646fb14de10bd66bfd3b79d3b1 100644
|
| --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
|
| +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
|
| @@ -106,6 +106,11 @@ bool HasAshShell() {
|
| }
|
| #endif // OS_CHROMEOS
|
|
|
| +int GetToolbarHorizontalPadding() {
|
| + using Md = ui::MaterialDesignController;
|
| + return Md::GetMode() == Md::MATERIAL_HYBRID ? 8 : 4;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -531,12 +536,13 @@ void ToolbarView::Layout() {
|
| const bool maximized =
|
| browser_->window() && browser_->window()->IsMaximized();
|
| const int back_width = back_->GetPreferredSize().width();
|
| - const gfx::Insets insets(GetLayoutInsets(TOOLBAR));
|
| + // The padding at either end of the toolbar.
|
| + const int end_padding = GetToolbarHorizontalPadding();
|
| if (maximized) {
|
| - back_->SetBounds(0, child_y, back_width + insets.left(), child_height);
|
| - back_->SetLeadingMargin(insets.left());
|
| + back_->SetBounds(0, child_y, back_width + end_padding, child_height);
|
| + back_->SetLeadingMargin(end_padding);
|
| } else {
|
| - back_->SetBounds(insets.left(), child_y, back_width, child_height);
|
| + back_->SetBounds(end_padding, child_y, back_width, child_height);
|
| back_->SetLeadingMargin(0);
|
| }
|
| const int element_padding = GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
|
| @@ -573,7 +579,7 @@ void ToolbarView::Layout() {
|
| // value used to visually separate the location bar and app menu button.
|
| int available_width = std::max(
|
| 0,
|
| - width() - insets.right() - app_menu_width -
|
| + width() - end_padding - app_menu_width -
|
| (browser_actions_->GetPreferredSize().IsEmpty() ? right_padding : 0) -
|
| next_element_x);
|
| // Don't allow the omnibox to shrink to the point of non-existence, so
|
| @@ -608,10 +614,10 @@ void ToolbarView::Layout() {
|
| // Extend the app menu to the screen's right edge in maximized mode just like
|
| // we extend the back button to the left edge.
|
| if (maximized)
|
| - app_menu_width += insets.right();
|
| + app_menu_width += end_padding;
|
| app_menu_button_->SetBounds(next_element_x, child_y, app_menu_width,
|
| child_height);
|
| - app_menu_button_->SetTrailingMargin(maximized ? insets.right() : 0);
|
| + app_menu_button_->SetTrailingMargin(maximized ? end_padding : 0);
|
| }
|
|
|
| void ToolbarView::OnThemeChanged() {
|
| @@ -707,9 +713,8 @@ gfx::Size ToolbarView::GetSizeInternal(
|
| const int right_padding =
|
| GetLayoutConstant(TOOLBAR_LOCATION_BAR_RIGHT_PADDING);
|
| const int content_width =
|
| - GetLayoutInsets(TOOLBAR).width() +
|
| - (back_->*get_size)().width() + element_padding +
|
| - (forward_->*get_size)().width() + element_padding +
|
| + 2 * GetToolbarHorizontalPadding() + (back_->*get_size)().width() +
|
| + element_padding + (forward_->*get_size)().width() + element_padding +
|
| (reload_->*get_size)().width() +
|
| (show_home_button_.GetValue()
|
| ? element_padding + (home_->*get_size)().width()
|
| @@ -728,8 +733,8 @@ gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const {
|
| // and constant padding values.
|
| int content_height = std::max(back_->GetPreferredSize().height(),
|
| location_bar_->GetPreferredSize().height());
|
| - int padding = GetLayoutInsets(TOOLBAR).height();
|
| - size.SetToMax(gfx::Size(0, content_height + padding));
|
| + const int kExtraVerticalSpace = 9;
|
| + size.SetToMax(gfx::Size(0, content_height + kExtraVerticalSpace));
|
| }
|
| return size;
|
| }
|
|
|