| 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_host.h" | 7 #include "cc/animation/animation_host.h" |
| 8 #include "cc/animation/animation_id_provider.h" | 8 #include "cc/animation/animation_id_provider.h" |
| 9 #include "cc/animation/animation_player.h" | 9 #include "cc/animation/animation_player.h" |
| 10 #include "cc/animation/animation_timeline.h" | 10 #include "cc/animation/animation_timeline.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 base::TimeDelta trimmed = | 91 base::TimeDelta trimmed = |
| 92 animation->run_state() == Animation::WAITING_FOR_TARGET_AVAILABILITY | 92 animation->run_state() == Animation::WAITING_FOR_TARGET_AVAILABILITY |
| 93 ? base::TimeDelta() | 93 ? base::TimeDelta() |
| 94 : animation->TrimTimeToCurrentIteration(frame_monotonic_time); | 94 : animation->TrimTimeToCurrentIteration(frame_monotonic_time); |
| 95 | 95 |
| 96 // Re-target taking the delay into account. Note that if the duration of the | 96 // Re-target taking the delay into account. Note that if the duration of the |
| 97 // animation is 0, trimmed will be 0 and UpdateTarget will be called with | 97 // animation is 0, trimmed will be 0 and UpdateTarget will be called with |
| 98 // t = -delayed_by. | 98 // t = -delayed_by. |
| 99 trimmed -= delayed_by; | 99 trimmed -= delayed_by; |
| 100 | 100 |
| 101 double old_dur = curve->Duration().InMillisecondsF(); |
| 101 curve->UpdateTarget(trimmed.InSecondsF(), new_target); | 102 curve->UpdateTarget(trimmed.InSecondsF(), new_target); |
| 103 double new_dur = curve->Duration().InMillisecondsF(); |
| 102 | 104 |
| 103 return true; | 105 return old_dur != new_dur; |
| 104 } | 106 } |
| 105 | 107 |
| 106 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( | 108 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( |
| 107 ElementId element_id, | 109 ElementId element_id, |
| 108 const gfx::Vector2dF& adjustment) { | 110 const gfx::Vector2dF& adjustment) { |
| 109 DCHECK(scroll_offset_animation_player_); | 111 DCHECK(scroll_offset_animation_player_); |
| 110 if (element_id != scroll_offset_animation_player_->element_id()) | 112 if (element_id != scroll_offset_animation_player_->element_id()) |
| 111 return; | 113 return; |
| 112 | 114 |
| 113 if (!scroll_offset_animation_player_->element_animations()) | 115 if (!scroll_offset_animation_player_->element_animations()) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ElementId element_id) { | 159 ElementId element_id) { |
| 158 if (scroll_offset_animation_player_->element_id() != element_id) { | 160 if (scroll_offset_animation_player_->element_id() != element_id) { |
| 159 if (scroll_offset_animation_player_->element_id()) | 161 if (scroll_offset_animation_player_->element_id()) |
| 160 scroll_offset_animation_player_->DetachElement(); | 162 scroll_offset_animation_player_->DetachElement(); |
| 161 if (element_id) | 163 if (element_id) |
| 162 scroll_offset_animation_player_->AttachElement(element_id); | 164 scroll_offset_animation_player_->AttachElement(element_id); |
| 163 } | 165 } |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace cc | 168 } // namespace cc |
| OLD | NEW |