OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/animation/scroll_offset_animations_impl.h" | 5 #include "cc/animation/scroll_offset_animations_impl.h" |
6 | 6 |
7 #include "cc/animation/animation_events.h" | 7 #include "cc/animation/animation_events.h" |
8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/animation_player.h" | 10 #include "cc/animation/animation_player.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 scroll_offset_timeline_->DetachPlayer(scroll_offset_animation_player_.get()); | 32 scroll_offset_timeline_->DetachPlayer(scroll_offset_animation_player_.get()); |
33 animation_host_->RemoveAnimationTimeline(scroll_offset_timeline_.get()); | 33 animation_host_->RemoveAnimationTimeline(scroll_offset_timeline_.get()); |
34 } | 34 } |
35 | 35 |
36 void ScrollOffsetAnimationsImpl::ScrollAnimationCreate( | 36 void ScrollOffsetAnimationsImpl::ScrollAnimationCreate( |
37 ElementId element_id, | 37 ElementId element_id, |
38 const gfx::ScrollOffset& target_offset, | 38 const gfx::ScrollOffset& target_offset, |
39 const gfx::ScrollOffset& current_offset) { | 39 const gfx::ScrollOffset& current_offset) { |
40 std::unique_ptr<ScrollOffsetAnimationCurve> curve = | 40 std::unique_ptr<ScrollOffsetAnimationCurve> curve = |
41 ScrollOffsetAnimationCurve::Create( | 41 ScrollOffsetAnimationCurve::Create( |
42 target_offset, EaseInOutTimingFunction::Create(), | 42 target_offset, CubicBezierTimingFunction::CreatePreset( |
| 43 CubicBezierTimingFunction::EaseType::EASE_IN_OUT), |
43 ScrollOffsetAnimationCurve::DurationBehavior::INVERSE_DELTA); | 44 ScrollOffsetAnimationCurve::DurationBehavior::INVERSE_DELTA); |
44 curve->SetInitialValue(current_offset); | 45 curve->SetInitialValue(current_offset); |
45 | 46 |
46 std::unique_ptr<Animation> animation = Animation::Create( | 47 std::unique_ptr<Animation> animation = Animation::Create( |
47 std::move(curve), AnimationIdProvider::NextAnimationId(), | 48 std::move(curve), AnimationIdProvider::NextAnimationId(), |
48 AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET); | 49 AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET); |
49 animation->set_is_impl_only(true); | 50 animation->set_is_impl_only(true); |
50 | 51 |
51 DCHECK(scroll_offset_animation_player_); | 52 DCHECK(scroll_offset_animation_player_); |
52 DCHECK(scroll_offset_animation_player_->animation_timeline()); | 53 DCHECK(scroll_offset_animation_player_->animation_timeline()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ElementId element_id) { | 148 ElementId element_id) { |
148 if (scroll_offset_animation_player_->element_id() != element_id) { | 149 if (scroll_offset_animation_player_->element_id() != element_id) { |
149 if (scroll_offset_animation_player_->element_id()) | 150 if (scroll_offset_animation_player_->element_id()) |
150 scroll_offset_animation_player_->DetachElement(); | 151 scroll_offset_animation_player_->DetachElement(); |
151 if (element_id) | 152 if (element_id) |
152 scroll_offset_animation_player_->AttachElement(element_id); | 153 scroll_offset_animation_player_->AttachElement(element_id); |
153 } | 154 } |
154 } | 155 } |
155 | 156 |
156 } // namespace cc | 157 } // namespace cc |
OLD | NEW |