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

Side by Side Diff: ash/common/shelf/shelf_background_animator.cc

Issue 2749123003: [ash-md] Fixed ShelfBackgroundAnimator to not snap target values when being preempted. (Closed)
Patch Set: Removed ShelfBackgroundAnimatorTest.AnimationProgressesToTargetWhenStoppingUnfinishedAnimator. Created 3 years, 9 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/shelf/shelf_background_animator.h" 5 #include "ash/common/shelf/shelf_background_animator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/animation/animation_change_type.h" 9 #include "ash/animation/animation_change_type.h"
10 #include "ash/common/shelf/shelf_background_animator_observer.h" 10 #include "ash/common/shelf/shelf_background_animator_observer.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DCHECK_EQ(animation, animator_.get()); 91 DCHECK_EQ(animation, animator_.get());
92 SetAnimationValues(animation->GetCurrentValue()); 92 SetAnimationValues(animation->GetCurrentValue());
93 } 93 }
94 94
95 void ShelfBackgroundAnimator::AnimationEnded(const gfx::Animation* animation) { 95 void ShelfBackgroundAnimator::AnimationEnded(const gfx::Animation* animation) {
96 DCHECK_EQ(animation, animator_.get()); 96 DCHECK_EQ(animation, animator_.get());
97 SetAnimationValues(animation->GetCurrentValue()); 97 SetAnimationValues(animation->GetCurrentValue());
98 animator_.reset(); 98 animator_.reset();
99 } 99 }
100 100
101 void ShelfBackgroundAnimator::AnimationCanceled(
msw 2017/03/14 22:29:11 I don't quite understand how this fixes the issue
bruthig 2017/03/14 22:50:00 You're right, there is another confounding factor
102 const gfx::Animation* animation) {
103 DCHECK_EQ(animation, animator_.get());
104 SetAnimationValues(animator_->IsShowing() ? 1.0 : 0.0);
105 // Animations are only cancelled when they are being pre-empted so we don't
106 // destroy the |animator_| because it may be re-used immediately.
107 }
108
109 void ShelfBackgroundAnimator::OnWallpaperDataChanged() {} 101 void ShelfBackgroundAnimator::OnWallpaperDataChanged() {}
110 102
111 void ShelfBackgroundAnimator::OnWallpaperColorsChanged() { 103 void ShelfBackgroundAnimator::OnWallpaperColorsChanged() {
112 AnimateBackground(target_background_type_, AnimationChangeType::ANIMATE); 104 AnimateBackground(target_background_type_, AnimationChangeType::ANIMATE);
113 } 105 }
114 106
115 void ShelfBackgroundAnimator::OnBackgroundTypeChanged( 107 void ShelfBackgroundAnimator::OnBackgroundTypeChanged(
116 ShelfBackgroundType background_type, 108 ShelfBackgroundType background_type,
117 AnimationChangeType change_type) { 109 AnimationChangeType change_type) {
118 PaintBackground(background_type, change_type); 110 PaintBackground(background_type, change_type);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 242
251 void ShelfBackgroundAnimator::SetAnimationValues(double t) { 243 void ShelfBackgroundAnimator::SetAnimationValues(double t) {
252 DCHECK_GE(t, 0.0); 244 DCHECK_GE(t, 0.0);
253 DCHECK_LE(t, 1.0); 245 DCHECK_LE(t, 1.0);
254 shelf_background_values_.UpdateCurrentValues(t); 246 shelf_background_values_.UpdateCurrentValues(t);
255 item_background_values_.UpdateCurrentValues(t); 247 item_background_values_.UpdateCurrentValues(t);
256 NotifyObservers(); 248 NotifyObservers();
257 } 249 }
258 250
259 } // namespace ash 251 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_background_animator.h ('k') | ash/common/shelf/shelf_background_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698