Commit 99d123d6 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

shelf: Hide navigation widget background when buttons are hidden

If no buttons are shown in the shelf navigation widget, we should hide
the widget background, too.

BUG=1012814

Change-Id: I6763c6719d256b2b07b74c06948af96074ae4851
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2025636Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736007}
parent 4e6d6b32
...@@ -1639,7 +1639,8 @@ void ShelfLayoutManager::CalculateTargetBounds( ...@@ -1639,7 +1639,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
// Enlarge the widget to take up available space, this ensures events which // Enlarge the widget to take up available space, this ensures events which
// are outside of the HomeButton bounds can be received. // are outside of the HomeButton bounds can be received.
nav_size.Enlarge(home_button_edge_spacing, home_button_edge_spacing); if (!nav_size.IsEmpty())
nav_size.Enlarge(home_button_edge_spacing, home_button_edge_spacing);
if (shelf_->IsHorizontalAlignment() && base::i18n::IsRTL()) if (shelf_->IsHorizontalAlignment() && base::i18n::IsRTL())
nav_origin.set_x(shelf_width - nav_size.width()); nav_origin.set_x(shelf_width - nav_size.width());
......
...@@ -173,11 +173,18 @@ void ShelfNavigationWidget::Delegate::Init(ui::Layer* parent_layer) { ...@@ -173,11 +173,18 @@ void ShelfNavigationWidget::Delegate::Init(ui::Layer* parent_layer) {
void ShelfNavigationWidget::Delegate::UpdateOpaqueBackground() { void ShelfNavigationWidget::Delegate::UpdateOpaqueBackground() {
opaque_background_.SetColor(ShelfConfig::Get()->GetShelfControlButtonColor()); opaque_background_.SetColor(ShelfConfig::Get()->GetShelfControlButtonColor());
// Hide background if no buttons should be shown.
if (!IsHomeButtonShown() && !IsBackButtonShown()) {
opaque_background_.SetVisible(false);
return;
}
if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletMode() && if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletMode() &&
ShelfConfig::Get()->is_in_app()) { ShelfConfig::Get()->is_in_app()) {
opaque_background_.SetVisible(false); opaque_background_.SetVisible(false);
return; return;
} }
opaque_background_.SetVisible(true); opaque_background_.SetVisible(true);
int radius = ShelfConfig::Get()->control_border_radius(); int radius = ShelfConfig::Get()->control_border_radius();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment