Chromium Code Reviews| Index: ash/wm/window_animations.cc |
| diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc |
| index b3f80e34d66e6dc6664f20fce0dea976a1cb4046..d7e4ca3777f7090aa0418b16fbba3b89fc383be3 100644 |
| --- a/ash/wm/window_animations.cc |
| +++ b/ash/wm/window_animations.cc |
| @@ -149,8 +149,10 @@ class HidingWindowAnimationObserver : public ui::ImplicitAnimationObserver, |
| // Overridden from ui::ImplicitAnimationObserver: |
| virtual void OnImplicitAnimationsCompleted() OVERRIDE { |
| // Window may have been destroyed by this point. |
| - if (window_) |
| + if (window_) { |
| + window_->layer()->SetVisible(false); |
|
sky
2012/08/10 15:47:39
If you do this then the TargetVisibility is true a
alexst (slow to review)
2012/08/10 17:50:55
Ah, this was the wrong solution to a real problem.
|
| window_->RemoveObserver(this); |
| + } |
| MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| } |
| @@ -447,10 +449,23 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) { |
| window->layer()->GetAnimator()->ScheduleAnimation( |
| new ui::LayerAnimationSequence(transition.release())); |
| + // When hiding a window, turn off blending until the animation is |
| + // 3 / 4 done to save bandwidth and reduce jank |
| + if (!show) { |
| + ui::LayerAnimationElement::AnimatableProperties propertiesToPause; |
| + propertiesToPause.insert(ui::LayerAnimationElement::OPACITY); |
| + window->layer()->GetAnimator()->ScheduleAnimation( |
| + new ui::LayerAnimationSequence( |
| + ui::LayerAnimationElement::CreatePauseElement( |
| + propertiesToPause, (duration * 3 ) / 4))); |
| + } |
| + |
| + // Fade in and out quickly when the window is small to reduce jank |
| float opacity = show ? 1.0f : 0.0f; |
| window->layer()->GetAnimator()->ScheduleAnimation( |
| new ui::LayerAnimationSequence( |
| - ui::LayerAnimationElement::CreateOpacityElement(opacity, duration))); |
| + ui::LayerAnimationElement::CreateOpacityElement( |
| + opacity, duration / 4))); |
| } |
| void AnimateShowWindow_Minimize(aura::Window* window) { |
| @@ -470,7 +485,6 @@ void AnimateHideWindow_Minimize(aura::Window* window) { |
| // Property sets within this scope will be implicitly animated. |
| ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| settings.AddObserver(new HidingWindowAnimationObserver(window)); |
| - window->layer()->SetVisible(false); |
| AddLayerAnimationsForMinimize(window, false); |
| } |