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

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 (nits) 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
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/window_animations_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot( 98 scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot(
99 new ui::InterpolatedTransformAboutPivot( 99 new ui::InterpolatedTransformAboutPivot(
100 gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5), 100 gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5),
101 rotation.release())); 101 rotation.release()));
102 102
103 scale->SetChild(translation.release()); 103 scale->SetChild(translation.release());
104 rotation_about_pivot->SetChild(scale.release()); 104 rotation_about_pivot->SetChild(scale.release());
105 105
106 rotation_about_pivot->SetReversed(show); 106 rotation_about_pivot->SetReversed(show);
107 107
108 base::TimeDelta duration = base::TimeDelta::FromMilliseconds( 108 base::TimeDelta duration = window->layer()->GetAnimator()->
109 kLayerAnimationsForMinimizeDurationMS); 109 GetTransitionDuration();
110 110
111 scoped_ptr<ui::LayerAnimationElement> transition( 111 scoped_ptr<ui::LayerAnimationElement> transition(
112 ui::LayerAnimationElement::CreateInterpolatedTransformElement( 112 ui::LayerAnimationElement::CreateInterpolatedTransformElement(
113 rotation_about_pivot.release(), duration)); 113 rotation_about_pivot.release(), duration));
114 114
115 transition->set_tween_type( 115 transition->set_tween_type(
116 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT); 116 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT);
117 117
118 window->layer()->GetAnimator()->ScheduleAnimation( 118 window->layer()->GetAnimator()->ScheduleAnimation(
119 new ui::LayerAnimationSequence(transition.release())); 119 new ui::LayerAnimationSequence(transition.release()));
120 120
121 // When hiding a window, turn off blending until the animation is 3 / 4 done 121 // When hiding a window, turn off blending until the animation is 3 / 4 done
122 // to save bandwidth and reduce jank. 122 // to save bandwidth and reduce jank.
123 if (!show) { 123 if (!show) {
124 window->layer()->GetAnimator()->SchedulePauseForProperties( 124 window->layer()->GetAnimator()->SchedulePauseForProperties(
125 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1); 125 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1);
126 } 126 }
127 127
128 // Fade in and out quickly when the window is small to reduce jank. 128 // Fade in and out quickly when the window is small to reduce jank.
129 float opacity = show ? 1.0f : 0.0f; 129 float opacity = show ? 1.0f : 0.0f;
130 window->layer()->GetAnimator()->ScheduleAnimation( 130 window->layer()->GetAnimator()->ScheduleAnimation(
131 new ui::LayerAnimationSequence( 131 new ui::LayerAnimationSequence(
132 ui::LayerAnimationElement::CreateOpacityElement( 132 ui::LayerAnimationElement::CreateOpacityElement(
133 opacity, duration / 4))); 133 opacity, duration / 4)));
134 } 134 }
135 135
136 void AnimateShowWindow_Minimize(aura::Window* window) { 136 void AnimateShowWindow_Minimize(aura::Window* window) {
137 window->layer()->set_delegate(window); 137 window->layer()->set_delegate(window);
138 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); 138 window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
139 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
140 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
141 kLayerAnimationsForMinimizeDurationMS);
142 settings.SetTransitionDuration(duration);
139 AddLayerAnimationsForMinimize(window, true); 143 AddLayerAnimationsForMinimize(window, true);
140 144
141 // Now that the window has been restored, we need to clear its animation style 145 // Now that the window has been restored, we need to clear its animation style
142 // to default so that normal animation applies. 146 // to default so that normal animation applies.
143 views::corewm::SetWindowVisibilityAnimationType( 147 views::corewm::SetWindowVisibilityAnimationType(
144 window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); 148 window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT);
145 } 149 }
146 150
147 void AnimateHideWindow_Minimize(aura::Window* window) { 151 void AnimateHideWindow_Minimize(aura::Window* window) {
148 window->layer()->set_delegate(NULL); 152 window->layer()->set_delegate(NULL);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 540 }
537 541
538 // Assume the launcher is overflowed, zoom off to the bottom right of the 542 // Assume the launcher is overflowed, zoom off to the bottom right of the
539 // work area. 543 // work area.
540 gfx::Rect work_area = 544 gfx::Rect work_area =
541 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); 545 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
542 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); 546 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
543 } 547 }
544 548
545 } // namespace ash 549 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/window_animations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698