Commit 02c8b958 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix shadow placed in the wrong spot.

Bug caused by press while still animation, then shadow gets applied after
animation end. Fix this by canceling animation watching if press event.

Test: manual
Bug: 817436
Change-Id: Icd1677d4854db8fc6b5ec12c7c71d1a76e955ea6
Reviewed-on: https://chromium-review.googlesource.com/941721
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540374}
parent b5e746c6
...@@ -530,6 +530,23 @@ void ScopedTransformOverviewWindow::EnsureVisible() { ...@@ -530,6 +530,23 @@ void ScopedTransformOverviewWindow::EnsureVisible() {
original_opacity_ = 1.f; original_opacity_ = 1.f;
} }
aura::Window*
ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const {
return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr;
}
void ScopedTransformOverviewWindow::UpdateWindowDimensionsType() {
if (!IsNewOverviewUi())
return;
type_ = GetWindowDimensionsType(window_);
window_selector_bounds_.reset();
}
void ScopedTransformOverviewWindow::CancelAnimationsListener() {
StopObservingImplicitAnimations();
}
void ScopedTransformOverviewWindow::OnImplicitAnimationsCompleted() { void ScopedTransformOverviewWindow::OnImplicitAnimationsCompleted() {
// Add the mask which gives the window selector items rounded corners, and add // Add the mask which gives the window selector items rounded corners, and add
// the shadow around the window. // the shadow around the window.
...@@ -549,19 +566,6 @@ void ScopedTransformOverviewWindow::OnImplicitAnimationsCompleted() { ...@@ -549,19 +566,6 @@ void ScopedTransformOverviewWindow::OnImplicitAnimationsCompleted() {
selector_item_->EnableBackdropIfNeeded(); selector_item_->EnableBackdropIfNeeded();
} }
aura::Window*
ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const {
return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr;
}
void ScopedTransformOverviewWindow::UpdateWindowDimensionsType() {
if (!IsNewOverviewUi())
return;
type_ = GetWindowDimensionsType(window_);
window_selector_bounds_.reset();
}
void ScopedTransformOverviewWindow::CreateMirrorWindowForMinimizedState() { void ScopedTransformOverviewWindow::CreateMirrorWindowForMinimizedState() {
DCHECK(!minimized_widget_.get()); DCHECK(!minimized_widget_.get());
views::Widget::InitParams params; views::Widget::InitParams params;
......
...@@ -177,6 +177,9 @@ class ASH_EXPORT ScopedTransformOverviewWindow ...@@ -177,6 +177,9 @@ class ASH_EXPORT ScopedTransformOverviewWindow
// change. Must be called before PositionWindows in WindowGrid. // change. Must be called before PositionWindows in WindowGrid.
void UpdateWindowDimensionsType(); void UpdateWindowDimensionsType();
// Stop listening to any animations to finish.
void CancelAnimationsListener();
views::Widget* minimized_widget() { return minimized_widget_.get(); } views::Widget* minimized_widget() { return minimized_widget_.get(); }
// ui::ImplicitAnimationObserver: // ui::ImplicitAnimationObserver:
......
...@@ -1277,6 +1277,12 @@ aura::Window* WindowSelectorItem::GetOverviewWindowForMinimizedStateForTest() { ...@@ -1277,6 +1277,12 @@ aura::Window* WindowSelectorItem::GetOverviewWindowForMinimizedStateForTest() {
void WindowSelectorItem::StartDrag() { void WindowSelectorItem::StartDrag() {
window_grid_->SetSelectionWidgetVisibility(false); window_grid_->SetSelectionWidgetVisibility(false);
// |transform_window_| handles hiding shadow and rounded edges mask while
// animating, and applies them after animation is complete. Prevent the shadow
// and rounded edges mask from showing up after dragging in the case the
// window is pressed while still animating.
transform_window_.CancelAnimationsListener();
gfx::Rect scaled_bounds(target_bounds_); gfx::Rect scaled_bounds(target_bounds_);
scaled_bounds.Inset(-target_bounds_.width() * kDragWindowScale, scaled_bounds.Inset(-target_bounds_.width() * kDragWindowScale,
-target_bounds_.height() * kDragWindowScale); -target_bounds_.height() * kDragWindowScale);
......
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