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

Use NOT_DRAWN layer for the layer that doesn't have content

This reduces the repainting during hotseat animation.

Bug: 1049355

Change-Id: I36cbdb73f7417494b224c0d71f2efb1a6929c5b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088972Reviewed-by: default avatarAndrew Xu <andrewxu@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748534}
parent e3812dad
...@@ -278,6 +278,8 @@ class ScrollableShelfView::ScrollableShelfArrowView ...@@ -278,6 +278,8 @@ class ScrollableShelfView::ScrollableShelfArrowView
shelf_button_delegate) { shelf_button_delegate) {
SetInkDropMode(InkDropMode::OFF); SetInkDropMode(InkDropMode::OFF);
SetEventTargeter(std::make_unique<views::ViewTargeter>(this)); SetEventTargeter(std::make_unique<views::ViewTargeter>(this));
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
} }
~ScrollableShelfArrowView() override = default; ~ScrollableShelfArrowView() override = default;
...@@ -500,7 +502,7 @@ void ScrollableShelfView::Init() { ...@@ -500,7 +502,7 @@ void ScrollableShelfView::Init() {
// needed. Otherwise, the child view without its own layer will be painted on // needed. Otherwise, the child view without its own layer will be painted on
// RootView which is beneath |translucent_background_| in ShelfWidget. // RootView which is beneath |translucent_background_| in ShelfWidget.
// As a result, the child view will not show. // As a result, the child view will not show.
SetPaintToLayer(); SetPaintToLayer(ui::LAYER_NOT_DRAWN);
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
// Initialize the shelf container view. // Initialize the shelf container view.
...@@ -1824,7 +1826,6 @@ void ScrollableShelfView::PaintGradientZone(const FadeZone& start_rect, ...@@ -1824,7 +1826,6 @@ void ScrollableShelfView::PaintGradientZone(const FadeZone& start_rect,
const FadeZone& end_rect) { const FadeZone& end_rect) {
gradient_layer_delegate_->set_start_fade_zone(start_rect); gradient_layer_delegate_->set_start_fade_zone(start_rect);
gradient_layer_delegate_->set_end_fade_zone(end_rect); gradient_layer_delegate_->set_end_fade_zone(end_rect);
SchedulePaint(); SchedulePaint();
} }
......
...@@ -319,6 +319,9 @@ ShelfAppButton::ShelfAppButton(ShelfView* shelf_view, ...@@ -319,6 +319,9 @@ ShelfAppButton::ShelfAppButton(ShelfView* shelf_view,
// Do not make this interactive, so that events are sent to ShelfView. // Do not make this interactive, so that events are sent to ShelfView.
icon_view_->set_can_process_events_within_subtree(false); icon_view_->set_can_process_events_within_subtree(false);
indicator_->SetPaintToLayer();
indicator_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(indicator_); AddChildView(indicator_);
AddChildView(icon_view_); AddChildView(icon_view_);
if (is_notification_indicator_enabled_) { if (is_notification_indicator_enabled_) {
......
...@@ -14,11 +14,11 @@ ShelfContainerView::ShelfContainerView(ShelfView* shelf_view) ...@@ -14,11 +14,11 @@ ShelfContainerView::ShelfContainerView(ShelfView* shelf_view)
ShelfContainerView::~ShelfContainerView() = default; ShelfContainerView::~ShelfContainerView() = default;
void ShelfContainerView::Initialize() { void ShelfContainerView::Initialize() {
SetPaintToLayer(); SetPaintToLayer(ui::LAYER_NOT_DRAWN);
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
layer()->SetMasksToBounds(true); layer()->SetMasksToBounds(true);
shelf_view_->SetPaintToLayer(); shelf_view_->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
shelf_view_->layer()->SetFillsBoundsOpaquely(false); shelf_view_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(shelf_view_); AddChildView(shelf_view_);
} }
......
...@@ -898,7 +898,7 @@ bool ShelfView::ShouldShowTooltipForChildView( ...@@ -898,7 +898,7 @@ bool ShelfView::ShouldShowTooltipForChildView(
// static // static
void ShelfView::ConfigureChildView(views::View* view) { void ShelfView::ConfigureChildView(views::View* view) {
view->SetPaintToLayer(); view->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
view->layer()->SetFillsBoundsOpaquely(false); view->layer()->SetFillsBoundsOpaquely(false);
} }
......
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