OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/animation/scroll_offset_animations.h" | |
6 | |
7 #include "cc/animation/animation_host.h" | |
8 | |
9 namespace cc { | |
10 | |
11 ScrollOffsetAnimationUpdate::ScrollOffsetAnimationUpdate() {} | |
12 | |
13 ScrollOffsetAnimations::ScrollOffsetAnimations(AnimationHost* animation_host) | |
14 : animation_host_(animation_host) {} | |
15 | |
16 ScrollOffsetAnimations::~ScrollOffsetAnimations() {} | |
17 | |
18 void ScrollOffsetAnimations::AddUpdate(ScrollOffsetAnimationUpdate update) { | |
19 queue_.push_back(update); | |
20 animation_host_->SetNeedsCommit(); | |
21 } | |
22 | |
23 bool ScrollOffsetAnimations::HasUpdatesForTesting() const { | |
24 return !queue_.empty(); | |
25 } | |
26 | |
27 void ScrollOffsetAnimations::PushPropertiesTo( | |
28 ScrollOffsetAnimationsImpl* animations, | |
29 base::TimeTicks frame_monotonic_time) { | |
30 if (!animations) | |
31 return; | |
32 if (queue_.empty()) | |
33 return; | |
34 | |
35 for (auto& update : queue_) { | |
36 switch (update.type_) { | |
37 case ScrollOffsetAnimationUpdate::Type::SCROLL_OFFSET_CHANGED: { | |
skobes
2016/05/07 00:25:16
{ } is not typically used around case blocks.
ymalik
2016/05/10 19:40:59
Done.
| |
38 animations->ScrollAnimationApplyAdjustment( | |
39 update.element_id_, update.adjustment_, frame_monotonic_time); | |
40 } | |
41 } | |
42 } | |
43 queue_.clear(); | |
44 } | |
45 | |
46 } // namespace cc | |
OLD | NEW |