| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 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 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_IMPL_H_ |
| 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "cc/animation/animation_delegate.h" |
| 12 #include "cc/animation/scroll_offset_animation_curve.h" |
| 13 #include "cc/trees/mutator_host_client.h" |
| 14 #include "ui/gfx/geometry/scroll_offset.h" |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 class AnimationPlayer; |
| 19 class AnimationHost; |
| 20 class AnimationTimeline; |
| 21 class ElementAnimations; |
| 22 |
| 23 // Contains an AnimationTimeline and its AnimationPlayer that owns the impl |
| 24 // only scroll offset animations running on a particular CC Layer. |
| 25 // We have just one player for impl-only scroll offset animations. I.e. only |
| 26 // one element can have an impl-only scroll offset animation at any given time. |
| 27 // Note that this class only exists on the compositor thread. |
| 28 class CC_EXPORT ScrollOffsetAnimationsImpl : public AnimationDelegate { |
| 29 public: |
| 30 explicit ScrollOffsetAnimationsImpl(AnimationHost* animation_host); |
| 31 |
| 32 ~ScrollOffsetAnimationsImpl() override; |
| 33 |
| 34 void ScrollAnimationCreate(ElementId element_id, |
| 35 const gfx::ScrollOffset& target_offset, |
| 36 const gfx::ScrollOffset& current_offset); |
| 37 |
| 38 bool ScrollAnimationUpdateTarget(ElementId element_id, |
| 39 const gfx::Vector2dF& scroll_delta, |
| 40 const gfx::ScrollOffset& max_scroll_offset, |
| 41 base::TimeTicks frame_monotonic_time); |
| 42 |
| 43 void ScrollAnimationAbort(bool needs_completion); |
| 44 |
| 45 // AnimationDelegate implementation. |
| 46 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
| 47 TargetProperty::Type target_property, |
| 48 int group) override {} |
| 49 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
| 50 TargetProperty::Type target_property, |
| 51 int group) override; |
| 52 void NotifyAnimationAborted(base::TimeTicks monotonic_time, |
| 53 TargetProperty::Type target_property, |
| 54 int group) override {} |
| 55 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, |
| 56 TargetProperty::Type target_property, |
| 57 double animation_start_time, |
| 58 std::unique_ptr<AnimationCurve> curve) override { |
| 59 } |
| 60 |
| 61 private: |
| 62 void ReattachScrollOffsetPlayerIfNeeded(ElementId element_id); |
| 63 |
| 64 AnimationHost* animation_host_; |
| 65 scoped_refptr<AnimationTimeline> scroll_offset_timeline_; |
| 66 |
| 67 // We have just one player for impl-only scroll offset animations. |
| 68 // I.e. only one element can have an impl-only scroll offset animation at |
| 69 // any given time. |
| 70 scoped_refptr<AnimationPlayer> scroll_offset_animation_player_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationsImpl); |
| 73 }; |
| 74 |
| 75 } // namespace cc |
| 76 |
| 77 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_IMPL_H_ |
| OLD | NEW |