Commit 6b5ed95e authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Blends Shelf into Launcher to help fix FPS on low-end devices

Bug: 883032
Change-Id: Ib65bc5fb61f0526d9ccc688769f1f68284f3bfeb
Reviewed-on: https://chromium-review.googlesource.com/c/1269860
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600151}
parent 0dbf7abc
...@@ -575,8 +575,8 @@ void AppListView::InitContents(int initial_apps_page) { ...@@ -575,8 +575,8 @@ void AppListView::InitContents(int initial_apps_page) {
SetBackgroundShieldColor(); SetBackgroundShieldColor();
if (is_background_blur_enabled_ && !IsHomeLauncherEnabledInTabletMode()) { if (is_background_blur_enabled_ && !IsHomeLauncherEnabledInTabletMode()) {
app_list_background_shield_mask_ = views::Painter::CreatePaintedLayer( app_list_background_shield_mask_ = views::Painter::CreatePaintedLayer(
views::Painter::CreateSolidRoundRectPainter( views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK,
SK_ColorBLACK, AppListConfig::instance().blur_radius())); kAppListBackgroundRadius));
app_list_background_shield_mask_->layer()->SetFillsBoundsOpaquely(false); app_list_background_shield_mask_->layer()->SetFillsBoundsOpaquely(false);
app_list_background_shield_->layer()->SetMaskLayer( app_list_background_shield_->layer()->SetMaskLayer(
app_list_background_shield_mask_->layer()); app_list_background_shield_mask_->layer());
......
...@@ -97,10 +97,8 @@ bool IsTabletModeEnabled() { ...@@ -97,10 +97,8 @@ bool IsTabletModeEnabled() {
// TODO(sammiequon): This should be the same as IsTabletModeEnabled once home // TODO(sammiequon): This should be the same as IsTabletModeEnabled once home
// launcher flag is removed. // launcher flag is removed.
bool IsHomeLauncherEnabled() { bool IsHomeLauncherEnabledInTabletMode() {
return Shell::Get() return app_list_features::IsHomeLauncherEnabled() && IsTabletModeEnabled();
->app_list_controller()
->IsHomeLauncherEnabledInTabletMode();
} }
} // namespace } // namespace
...@@ -549,7 +547,7 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { ...@@ -549,7 +547,7 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
// If the app list is active and the home launcher is not shown, hide the // If the app list is active and the home launcher is not shown, hide the
// shelf background to prevent overlap. // shelf background to prevent overlap.
if (is_app_list_visible_ && !IsHomeLauncherEnabled()) if (is_app_list_visible_ && !IsHomeLauncherEnabledInTabletMode())
return SHELF_BACKGROUND_APP_LIST; return SHELF_BACKGROUND_APP_LIST;
if (state_.visibility_state != SHELF_AUTO_HIDE && if (state_.visibility_state != SHELF_AUTO_HIDE &&
...@@ -1001,7 +999,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( ...@@ -1001,7 +999,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
if (visibility_state != SHELF_AUTO_HIDE) if (visibility_state != SHELF_AUTO_HIDE)
return SHELF_AUTO_HIDE_HIDDEN; return SHELF_AUTO_HIDE_HIDDEN;
if (shelf_widget_->IsShowingAppList() && !IsHomeLauncherEnabled()) if (shelf_widget_->IsShowingAppList() && !IsHomeLauncherEnabledInTabletMode())
return SHELF_AUTO_HIDE_SHOWN; return SHELF_AUTO_HIDE_SHOWN;
if (shelf_widget_->status_area_widget() && if (shelf_widget_->status_area_widget() &&
...@@ -1221,7 +1219,7 @@ void ShelfLayoutManager::StartGestureDrag( ...@@ -1221,7 +1219,7 @@ void ShelfLayoutManager::StartGestureDrag(
} }
// Disable the shelf dragging if the fullscreen app list is opened. // Disable the shelf dragging if the fullscreen app list is opened.
if (is_app_list_visible_ && !IsHomeLauncherEnabled()) if (is_app_list_visible_ && !IsHomeLauncherEnabledInTabletMode())
return; return;
gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS;
...@@ -1391,7 +1389,7 @@ bool ShelfLayoutManager::CanStartFullscreenAppListDrag( ...@@ -1391,7 +1389,7 @@ bool ShelfLayoutManager::CanStartFullscreenAppListDrag(
// In overview mode, app list for tablet mode is hidden temporarily and will // In overview mode, app list for tablet mode is hidden temporarily and will
// be shown automatically after overview mode ends. So prevent opening it // be shown automatically after overview mode ends. So prevent opening it
// here. // here.
if (IsHomeLauncherEnabled()) if (IsHomeLauncherEnabledInTabletMode())
return false; return false;
return true; return true;
......
...@@ -189,7 +189,9 @@ void ShelfWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) { ...@@ -189,7 +189,9 @@ void ShelfWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) {
} }
void ShelfWidget::DelegateView::UpdateBackgroundBlur() { void ShelfWidget::DelegateView::UpdateBackgroundBlur() {
// Blur only if the background is visible.
const bool should_blur_background = const bool should_blur_background =
opaque_background_.visible() &&
shelf_widget_->shelf_layout_manager()->ShouldBlurShelfBackground(); shelf_widget_->shelf_layout_manager()->ShouldBlurShelfBackground();
if (should_blur_background == background_is_currently_blurred_) if (should_blur_background == background_is_currently_blurred_)
return; return;
...@@ -208,6 +210,19 @@ void ShelfWidget::DelegateView::UpdateOpaqueBackground() { ...@@ -208,6 +210,19 @@ void ShelfWidget::DelegateView::UpdateOpaqueBackground() {
const ShelfBackgroundType background_type = const ShelfBackgroundType background_type =
shelf_widget_->GetBackgroundType(); shelf_widget_->GetBackgroundType();
// If the app list is showing in clamshell mode, we should hide the shelf.
// otherwise, we should show it again. This creates a 'blending' effect
// between the two
if (background_type == SHELF_BACKGROUND_APP_LIST) {
opaque_background_.SetVisible(false);
UpdateBackgroundBlur();
return;
}
if (!opaque_background_.visible()) {
opaque_background_.SetVisible(true);
}
// Show rounded corners except in maximized and split modes. // Show rounded corners except in maximized and split modes.
if (background_type == SHELF_BACKGROUND_MAXIMIZED || if (background_type == SHELF_BACKGROUND_MAXIMIZED ||
background_type == SHELF_BACKGROUND_SPLIT_VIEW) { background_type == SHELF_BACKGROUND_SPLIT_VIEW) {
......
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