Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ash/wm/window_animations.cc

Issue 82573002: Changes sequence of docked animations when evicting windows from dock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes sequence of docked animations (added test) Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot( 101 scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot(
102 new ui::InterpolatedTransformAboutPivot( 102 new ui::InterpolatedTransformAboutPivot(
103 gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5), 103 gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5),
104 rotation.release())); 104 rotation.release()));
105 105
106 scale->SetChild(translation.release()); 106 scale->SetChild(translation.release());
107 rotation_about_pivot->SetChild(scale.release()); 107 rotation_about_pivot->SetChild(scale.release());
108 108
109 rotation_about_pivot->SetReversed(show); 109 rotation_about_pivot->SetReversed(show);
110 110
111 base::TimeDelta duration = base::TimeDelta::FromMilliseconds( 111 base::TimeDelta duration = window->layer()->GetAnimator()->
112 kLayerAnimationsForMinimizeDurationMS); 112 GetTransitionDuration();
113 113
114 scoped_ptr<ui::LayerAnimationElement> transition( 114 scoped_ptr<ui::LayerAnimationElement> transition(
115 ui::LayerAnimationElement::CreateInterpolatedTransformElement( 115 ui::LayerAnimationElement::CreateInterpolatedTransformElement(
116 rotation_about_pivot.release(), duration)); 116 rotation_about_pivot.release(), duration));
117 117
118 transition->set_tween_type( 118 transition->set_tween_type(
119 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT); 119 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT);
120 120
121 window->layer()->GetAnimator()->ScheduleAnimation( 121 window->layer()->GetAnimator()->ScheduleAnimation(
122 new ui::LayerAnimationSequence(transition.release())); 122 new ui::LayerAnimationSequence(transition.release()));
123 123
124 // When hiding a window, turn off blending until the animation is 3 / 4 done 124 // When hiding a window, turn off blending until the animation is 3 / 4 done
125 // to save bandwidth and reduce jank. 125 // to save bandwidth and reduce jank.
126 if (!show) { 126 if (!show) {
127 window->layer()->GetAnimator()->SchedulePauseForProperties( 127 window->layer()->GetAnimator()->SchedulePauseForProperties(
128 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1); 128 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1);
129 } 129 }
130 130
131 // Fade in and out quickly when the window is small to reduce jank. 131 // Fade in and out quickly when the window is small to reduce jank.
132 float opacity = show ? 1.0f : 0.0f; 132 float opacity = show ? 1.0f : 0.0f;
133 window->layer()->GetAnimator()->ScheduleAnimation( 133 window->layer()->GetAnimator()->ScheduleAnimation(
134 new ui::LayerAnimationSequence( 134 new ui::LayerAnimationSequence(
135 ui::LayerAnimationElement::CreateOpacityElement( 135 ui::LayerAnimationElement::CreateOpacityElement(
136 opacity, duration / 4))); 136 opacity, duration / 4)));
137 } 137 }
138 138
139 void AnimateShowWindow_Minimize(aura::Window* window) { 139 void AnimateShowWindow_Minimize(aura::Window* window) {
140 window->layer()->set_delegate(window); 140 window->layer()->set_delegate(window);
141 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); 141 window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
142 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
143 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
144 kLayerAnimationsForMinimizeDurationMS);
145 settings.SetTransitionDuration(duration);
142 AddLayerAnimationsForMinimize(window, true); 146 AddLayerAnimationsForMinimize(window, true);
143 147
144 // Now that the window has been restored, we need to clear its animation style 148 // Now that the window has been restored, we need to clear its animation style
145 // to default so that normal animation applies. 149 // to default so that normal animation applies.
146 views::corewm::SetWindowVisibilityAnimationType( 150 views::corewm::SetWindowVisibilityAnimationType(
147 window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); 151 window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT);
148 } 152 }
149 153
150 void AnimateHideWindow_Minimize(aura::Window* window) { 154 void AnimateHideWindow_Minimize(aura::Window* window) {
151 window->layer()->set_delegate(NULL); 155 window->layer()->set_delegate(NULL);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 557 }
554 558
555 // Assume the launcher is overflowed, zoom off to the bottom right of the 559 // Assume the launcher is overflowed, zoom off to the bottom right of the
556 // work area. 560 // work area.
557 gfx::Rect work_area = 561 gfx::Rect work_area =
558 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); 562 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
559 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); 563 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
560 } 564 }
561 565
562 } // namespace ash 566 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698