Index: ash/wm/workspace/workspace_animations.cc |
diff --git a/ash/wm/workspace/workspace_animations.cc b/ash/wm/workspace/workspace_animations.cc |
index 2bffbd57503ef29c359f9ecf3522f64f60bf86bc..96c7c1da8c74b2fd44e335b3c1036fa8effe0261 100644 |
--- a/ash/wm/workspace/workspace_animations.cc |
+++ b/ash/wm/workspace/workspace_animations.cc |
@@ -49,6 +49,13 @@ base::TimeDelta DurationForWorkspaceShowOrHide( |
details.duration; |
} |
+void HideWindow(aura::Window* window) { |
+ ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
+ settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); |
+ settings.SetTransitionDuration(base::TimeDelta()); |
+ window->Hide(); |
+} |
+ |
} // namespace |
WorkspaceAnimationDetails::WorkspaceAnimationDetails() |
@@ -140,20 +147,25 @@ void HideWorkspace(aura::Window* window, |
window->layer()->SetTransform(gfx::Transform()); |
} |
- // NOTE: Hide() must be before SetOpacity(), else |
- // VisibilityController::UpdateLayerVisibility doesn't pass the false to the |
- // layer so that the layer and window end up out of sync and confused. |
- window->Hide(); |
+ window->layer()->SetVisible(false); |
if (details.animate_opacity) |
window->layer()->SetOpacity(0.0f); |
+ base::Closure hide_window_callback = base::Bind(&HideWindow, window); |
Daniel Erat
2012/11/27 18:32:11
add a comment describing why you're doing this
Denis Kuznetsov (DE-MUC)
2012/11/27 18:46:59
Done.
|
+ window->layer()->GetAnimator()->ScheduleSuccessCallbackForProperties( |
+ hide_window_callback, |
+ ui::LayerAnimationElement::VISIBILITY, |
+ -1 |
+ ); |
+ |
// After the animation completes snap the transform back to the identity, |
// otherwise any one that asks for screen bounds gets a slightly scaled |
// version. |
settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); |
settings.SetTransitionDuration(base::TimeDelta()); |
window->layer()->SetTransform(gfx::Transform()); |
+ |
Daniel Erat
2012/11/27 18:32:11
nit: remove extra blank line
Denis Kuznetsov (DE-MUC)
2012/11/27 18:46:59
Done.
|
} |
} // namespace internal |