Commit eef56146 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Use solid color for applist background shield when possible

Use NOT_DRAWN layer for the folder's container layer because it's
used only to apply transform

TBR=weidongg@chromium.org

Bug: 893385
Change-Id: I14b375ce13f38630a8e3f0fb5c2bceddbc798b45
Reviewed-on: https://chromium-review.googlesource.com/c/1302413
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603360}
parent d7934996
...@@ -449,8 +449,7 @@ AppListFolderView::AppListFolderView(AppsContainerView* container_view, ...@@ -449,8 +449,7 @@ AppListFolderView::AppListFolderView(AppsContainerView* container_view,
AddChildView(background_view_); AddChildView(background_view_);
view_model_->Add(background_view_, kIndexBackground); view_model_->Add(background_view_, kIndexBackground);
contents_container_->SetPaintToLayer(); contents_container_->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
contents_container_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(contents_container_); AddChildView(contents_container_);
view_model_->Add(contents_container_, kIndexContentsContainer); view_model_->Add(contents_container_, kIndexContentsContainer);
......
...@@ -227,22 +227,28 @@ class TransitionAnimationObserver : public ui::ImplicitAnimationObserver { ...@@ -227,22 +227,28 @@ class TransitionAnimationObserver : public ui::ImplicitAnimationObserver {
// The view for the app list background shield which changes color and radius. // The view for the app list background shield which changes color and radius.
class AppListBackgroundShieldView : public views::View { class AppListBackgroundShieldView : public views::View {
public: public:
AppListBackgroundShieldView() explicit AppListBackgroundShieldView(ui::LayerType layer_type)
: color_(AppListView::kDefaultBackgroundColor), corner_radius_(0) { : color_(AppListView::kDefaultBackgroundColor), corner_radius_(0) {
SetPaintToLayer(); SetPaintToLayer(layer_type);
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
if (layer()->type() == ui::LAYER_SOLID_COLOR)
layer()->SetColor(color_);
} }
~AppListBackgroundShieldView() override = default; ~AppListBackgroundShieldView() override = default;
void UpdateColor(SkColor color) { void UpdateColor(SkColor color) {
color_ = color; color_ = color;
SchedulePaint(); if (layer()->type() == ui::LAYER_SOLID_COLOR)
layer()->SetColor(color);
else
SchedulePaint();
} }
void UpdateCornerRadius(int corner_radius) { void UpdateCornerRadius(int corner_radius) {
corner_radius_ = corner_radius; corner_radius_ = corner_radius;
SchedulePaint(); if (!layer())
SchedulePaint();
} }
// Overridden from views::View: // Overridden from views::View:
...@@ -496,11 +502,14 @@ views::View* AppListView::GetAppListBackgroundShieldForTest() { ...@@ -496,11 +502,14 @@ views::View* AppListView::GetAppListBackgroundShieldForTest() {
void AppListView::InitContents(int initial_apps_page) { void AppListView::InitContents(int initial_apps_page) {
// The shield view that colors/blurs the background of the app list and // The shield view that colors/blurs the background of the app list and
// makes it transparent. // makes it transparent.
app_list_background_shield_ = new AppListBackgroundShieldView(); bool use_background_blur =
is_background_blur_enabled_ && !IsHomeLauncherEnabledInTabletMode();
app_list_background_shield_ = new AppListBackgroundShieldView(
use_background_blur ? ui::LAYER_SOLID_COLOR : ui::LAYER_TEXTURED);
app_list_background_shield_->layer()->SetOpacity( app_list_background_shield_->layer()->SetOpacity(
is_background_blur_enabled_ ? kAppListOpacityWithBlur : kAppListOpacity); is_background_blur_enabled_ ? kAppListOpacityWithBlur : kAppListOpacity);
SetBackgroundShieldColor(); SetBackgroundShieldColor();
if (is_background_blur_enabled_ && !IsHomeLauncherEnabledInTabletMode()) { if (use_background_blur) {
app_list_background_shield_mask_ = views::Painter::CreatePaintedLayer( app_list_background_shield_mask_ = views::Painter::CreatePaintedLayer(
views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK, views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK,
kAppListBackgroundRadius)); kAppListBackgroundRadius));
...@@ -1339,7 +1348,6 @@ void AppListView::UpdateYPositionAndOpacity(int y_position_in_screen, ...@@ -1339,7 +1348,6 @@ void AppListView::UpdateYPositionAndOpacity(int y_position_in_screen,
gfx::NativeView native_view = fullscreen_widget_->GetNativeView(); gfx::NativeView native_view = fullscreen_widget_->GetNativeView();
::wm::ConvertRectFromScreen(native_view->parent(), &new_widget_bounds); ::wm::ConvertRectFromScreen(native_view->parent(), &new_widget_bounds);
native_view->SetBounds(new_widget_bounds); native_view->SetBounds(new_widget_bounds);
UpdateChildViewsYPositionAndOpacity(); UpdateChildViewsYPositionAndOpacity();
} }
......
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