| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 new_target.SetToMax(gfx::ScrollOffset()); | 85 new_target.SetToMax(gfx::ScrollOffset()); |
| 86 new_target.SetToMin(max_scroll_offset); | 86 new_target.SetToMin(max_scroll_offset); |
| 87 | 87 |
| 88 curve->UpdateTarget( | 88 curve->UpdateTarget( |
| 89 animation->TrimTimeToCurrentIteration(frame_monotonic_time).InSecondsF(), | 89 animation->TrimTimeToCurrentIteration(frame_monotonic_time).InSecondsF(), |
| 90 new_target); | 90 new_target); |
| 91 | 91 |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ScrollOffsetAnimationsImpl::ScrollAnimationAdjustDuration( |
| 96 ElementId element_id, |
| 97 base::TimeDelta adjustment) { |
| 98 if (element_id != scroll_offset_animation_player_->element_id()) |
| 99 return; |
| 100 |
| 101 if (!scroll_offset_animation_player_->element_animations()) |
| 102 return; |
| 103 |
| 104 Animation* animation = |
| 105 scroll_offset_animation_player_->element_animations()->GetAnimation( |
| 106 TargetProperty::SCROLL_OFFSET); |
| 107 if (!animation) |
| 108 return; |
| 109 |
| 110 ScrollOffsetAnimationCurve* curve = |
| 111 animation->curve()->ToScrollOffsetAnimationCurve(); |
| 112 curve->AdjustDuration(adjustment); |
| 113 } |
| 114 |
| 95 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( | 115 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( |
| 96 ElementId element_id, | 116 ElementId element_id, |
| 97 const gfx::Vector2dF& adjustment) { | 117 const gfx::Vector2dF& adjustment) { |
| 98 DCHECK(scroll_offset_animation_player_); | 118 DCHECK(scroll_offset_animation_player_); |
| 99 if (element_id != scroll_offset_animation_player_->element_id()) | 119 if (element_id != scroll_offset_animation_player_->element_id()) |
| 100 return; | 120 return; |
| 101 | 121 |
| 102 if (!scroll_offset_animation_player_->element_animations()) | 122 if (!scroll_offset_animation_player_->element_animations()) |
| 103 return; | 123 return; |
| 104 | 124 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ElementId element_id) { | 167 ElementId element_id) { |
| 148 if (scroll_offset_animation_player_->element_id() != element_id) { | 168 if (scroll_offset_animation_player_->element_id() != element_id) { |
| 149 if (scroll_offset_animation_player_->element_id()) | 169 if (scroll_offset_animation_player_->element_id()) |
| 150 scroll_offset_animation_player_->DetachElement(); | 170 scroll_offset_animation_player_->DetachElement(); |
| 151 if (element_id) | 171 if (element_id) |
| 152 scroll_offset_animation_player_->AttachElement(element_id); | 172 scroll_offset_animation_player_->AttachElement(element_id); |
| 153 } | 173 } |
| 154 } | 174 } |
| 155 | 175 |
| 156 } // namespace cc | 176 } // namespace cc |
| OLD | NEW |