Commit fddfedf2 authored by David Black's avatar David Black Committed by Chromium LUCI CQ

Fix paint artifacts from holding space item focus/selection rings.

When scheduling repaint of holding space item focus/selection rings,
the wrong bounds were being used. As a result, there were paint
artifacts being left behind.

Bug: 1154998
Change-Id: I33f8fb681527a94f16341198cc588cef2b4c479c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581037Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#835267}
parent 0aa15419
...@@ -66,6 +66,11 @@ gfx::Transform CreateTransformFromOffset(SkScalar x, SkScalar y) { ...@@ -66,6 +66,11 @@ gfx::Transform CreateTransformFromOffset(SkScalar x, SkScalar y) {
return transform; return transform;
} }
// Schedules repaint of `layer`.
void InvalidateLayer(ui::Layer* layer) {
layer->SchedulePaint(gfx::Rect(layer->size()));
}
// CallbackPainter ------------------------------------------------------------- // CallbackPainter -------------------------------------------------------------
// A painter which delegates painting to a callback. // A painter which delegates painting to a callback.
...@@ -186,8 +191,7 @@ bool HoldingSpaceItemView::HandleAccessibleAction( ...@@ -186,8 +191,7 @@ bool HoldingSpaceItemView::HandleAccessibleAction(
void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) { void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
gfx::Rect bounds = GetLocalBounds(); gfx::Rect bounds = GetLocalBounds();
selected_layer_owner_->layer()->SetBounds(bounds); selected_layer_owner_->layer()->SetBounds(bounds);
selected_layer_owner_->layer()->SchedulePaint( InvalidateLayer(selected_layer_owner_->layer());
selected_layer_owner_->layer()->bounds());
// The focus ring is painted just outside the bounds for this view. // The focus ring is painted just outside the bounds for this view.
const float kFocusInsets = const float kFocusInsets =
...@@ -195,18 +199,15 @@ void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) { ...@@ -195,18 +199,15 @@ void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
bounds.Inset(gfx::Insets(kFocusInsets)); bounds.Inset(gfx::Insets(kFocusInsets));
focused_layer_owner_->layer()->SetBounds(bounds); focused_layer_owner_->layer()->SetBounds(bounds);
focused_layer_owner_->layer()->SchedulePaint( InvalidateLayer(focused_layer_owner_->layer());
focused_layer_owner_->layer()->bounds());
} }
void HoldingSpaceItemView::OnFocus() { void HoldingSpaceItemView::OnFocus() {
focused_layer_owner_->layer()->SchedulePaint( InvalidateLayer(focused_layer_owner_->layer());
focused_layer_owner_->layer()->bounds());
} }
void HoldingSpaceItemView::OnBlur() { void HoldingSpaceItemView::OnBlur() {
focused_layer_owner_->layer()->SchedulePaint( InvalidateLayer(focused_layer_owner_->layer());
focused_layer_owner_->layer()->bounds());
} }
void HoldingSpaceItemView::OnGestureEvent(ui::GestureEvent* event) { void HoldingSpaceItemView::OnGestureEvent(ui::GestureEvent* event) {
...@@ -273,9 +274,7 @@ void HoldingSpaceItemView::SetSelected(bool selected) { ...@@ -273,9 +274,7 @@ void HoldingSpaceItemView::SetSelected(bool selected) {
return; return;
selected_ = selected; selected_ = selected;
InvalidateLayer(selected_layer_owner_->layer());
selected_layer_owner_->layer()->SchedulePaint(
selected_layer_owner_->layer()->bounds());
} }
views::ToggleImageButton* HoldingSpaceItemView::AddPin(views::View* parent) { views::ToggleImageButton* HoldingSpaceItemView::AddPin(views::View* parent) {
......
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