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

Side by Side Diff: ui/compositor/layer_animation_sequence.cc

Issue 2473483013: [ash-md] Enhanced LayerAnimator to allow animations to be aborted/started in OnLayerAnimationStarte… (Closed)
Patch Set: Addresse review comments. Created 4 years, 1 month 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 | « ui/compositor/layer_animation_observer.h ('k') | ui/compositor/layer_animator.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 "ui/compositor/layer_animation_sequence.h" 5 #include "ui/compositor/layer_animation_sequence.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 30 matching lines...) Expand all
41 for (auto& observer : observers_) 41 for (auto& observer : observers_)
42 observer.DetachedFromSequence(this, true); 42 observer.DetachedFromSequence(this, true);
43 } 43 }
44 44
45 void LayerAnimationSequence::Start(LayerAnimationDelegate* delegate) { 45 void LayerAnimationSequence::Start(LayerAnimationDelegate* delegate) {
46 DCHECK(start_time_ != base::TimeTicks()); 46 DCHECK(start_time_ != base::TimeTicks());
47 last_progressed_fraction_ = 0.0; 47 last_progressed_fraction_ = 0.0;
48 if (elements_.empty()) 48 if (elements_.empty())
49 return; 49 return;
50 50
51 elements_[0]->set_requested_start_time(start_time_);
52 elements_[0]->Start(delegate, animation_group_id_);
53
51 NotifyStarted(); 54 NotifyStarted();
52 55
53 elements_[0]->set_requested_start_time(start_time_); 56 // This may have been aborted.
54 elements_[0]->Start(delegate, animation_group_id_);
55 } 57 }
56 58
57 void LayerAnimationSequence::Progress(base::TimeTicks now, 59 void LayerAnimationSequence::Progress(base::TimeTicks now,
58 LayerAnimationDelegate* delegate) { 60 LayerAnimationDelegate* delegate) {
59 DCHECK(start_time_ != base::TimeTicks()); 61 DCHECK(start_time_ != base::TimeTicks());
60 bool redraw_required = false; 62 bool redraw_required = false;
61 63
62 if (elements_.empty()) 64 if (elements_.empty())
63 return; 65 return;
64 66
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 276
275 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { 277 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const {
276 if (elements_.empty()) 278 if (elements_.empty())
277 return NULL; 279 return NULL;
278 280
279 size_t current_index = last_element_ % elements_.size(); 281 size_t current_index = last_element_ % elements_.size();
280 return elements_[current_index].get(); 282 return elements_[current_index].get();
281 } 283 }
282 284
283 } // namespace ui 285 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animation_observer.h ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698