Commit 3a86d0f2 authored by Matthew Mourgos's avatar Matthew Mourgos Committed by Commit Bot

cros: Disable blur on shelf animating background when not visible.

Bug: 1024623
Change-Id: Ie5ca2f8259598130d9d046520c568c562d13f28c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1915185Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715437}
parent bb517bb3
...@@ -137,6 +137,9 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate, ...@@ -137,6 +137,9 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate,
void OnHotseatTransitionAnimationEnded(HotseatState from_state, void OnHotseatTransitionAnimationEnded(HotseatState from_state,
HotseatState to_state) override; HotseatState to_state) override;
// Hide or show the the |animating_background_| layer.
void ShowAnimatingBackground(bool show);
SkColor GetShelfBackgroundColor() const; SkColor GetShelfBackgroundColor() const;
ui::Layer* opaque_background() { return &opaque_background_; } ui::Layer* opaque_background() { return &opaque_background_; }
...@@ -182,11 +185,9 @@ ShelfWidget::DelegateView::DelegateView(ShelfWidget* shelf_widget) ...@@ -182,11 +185,9 @@ ShelfWidget::DelegateView::DelegateView(ShelfWidget* shelf_widget)
set_allow_deactivate_on_esc(true); set_allow_deactivate_on_esc(true);
// |animating_background_| will be made visible during hotseat animations. // |animating_background_| will be made visible during hotseat animations.
animating_background_.SetVisible(false); ShowAnimatingBackground(false);
if (features::IsBackgroundBlurEnabled()) { if (features::IsBackgroundBlurEnabled())
animating_background_.SetBackgroundBlur(30);
animating_background_.SetBackdropFilterQuality(0.33f); animating_background_.SetBackdropFilterQuality(0.33f);
}
std::unique_ptr<views::View> drag_handle_ptr = std::unique_ptr<views::View> drag_handle_ptr =
std::make_unique<views::View>(); std::make_unique<views::View>();
...@@ -377,7 +378,7 @@ void ShelfWidget::DelegateView::UpdateShelfBackground(SkColor color) { ...@@ -377,7 +378,7 @@ void ShelfWidget::DelegateView::UpdateShelfBackground(SkColor color) {
void ShelfWidget::DelegateView::OnHotseatTransitionAnimationStarted( void ShelfWidget::DelegateView::OnHotseatTransitionAnimationStarted(
HotseatState from_state, HotseatState from_state,
HotseatState to_state) { HotseatState to_state) {
animating_background_.SetVisible(true); ShowAnimatingBackground(true);
// If animating from a kShown hotseat, the animating background will // If animating from a kShown hotseat, the animating background will
// animate from the hotseat background into the in-app shelf, so hide the // animate from the hotseat background into the in-app shelf, so hide the
// real shelf background until the animation is complete. // real shelf background until the animation is complete.
...@@ -388,11 +389,20 @@ void ShelfWidget::DelegateView::OnHotseatTransitionAnimationStarted( ...@@ -388,11 +389,20 @@ void ShelfWidget::DelegateView::OnHotseatTransitionAnimationStarted(
void ShelfWidget::DelegateView::OnHotseatTransitionAnimationEnded( void ShelfWidget::DelegateView::OnHotseatTransitionAnimationEnded(
HotseatState from_state, HotseatState from_state,
HotseatState to_state) { HotseatState to_state) {
animating_background_.SetVisible(false); ShowAnimatingBackground(false);
if (from_state == HotseatState::kShown) if (from_state == HotseatState::kShown)
ShowOpaqueBackground(); ShowOpaqueBackground();
} }
void ShelfWidget::DelegateView::ShowAnimatingBackground(bool show) {
animating_background_.SetVisible(show);
// To ensure smooth scrollable shelf animations, we disable blur when the
// |animating_background_| is not visible.
if (features::IsBackgroundBlurEnabled())
animating_background_.SetBackgroundBlur(show ? 30 : 0);
}
SkColor ShelfWidget::DelegateView::GetShelfBackgroundColor() const { SkColor ShelfWidget::DelegateView::GetShelfBackgroundColor() const {
return opaque_background_.background_color(); return opaque_background_.background_color();
} }
......
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