Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 return true; | 79 return true; |
| 80 | 80 |
| 81 ScrollOffsetAnimationCurve* curve = | 81 ScrollOffsetAnimationCurve* curve = |
| 82 animation->curve()->ToScrollOffsetAnimationCurve(); | 82 animation->curve()->ToScrollOffsetAnimationCurve(); |
| 83 | 83 |
| 84 gfx::ScrollOffset new_target = | 84 gfx::ScrollOffset new_target = |
| 85 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 85 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
| 86 new_target.SetToMax(gfx::ScrollOffset()); | 86 new_target.SetToMax(gfx::ScrollOffset()); |
| 87 new_target.SetToMin(max_scroll_offset); | 87 new_target.SetToMin(max_scroll_offset); |
| 88 | 88 |
| 89 curve->UpdateTarget( | 89 // TODO(ymalik): Animation::TrimTimeToCurrentIteration should probably check |
| 90 animation->TrimTimeToCurrentIteration(frame_monotonic_time).InSecondsF(), | 90 // for run_state == Animation::WAITING_FOR_TARGET_AVAILABILITY. |
|
ajuma
2016/08/18 14:16:25
Yeah, Animation::ConvertToActiveTime should probab
ymalik
2016/08/18 17:23:33
Yeah. I tried to do it in this CL and a bunch of t
| |
| 91 new_target); | 91 base::TimeDelta trimmed = |
| 92 animation->run_state() == Animation::WAITING_FOR_TARGET_AVAILABILITY | |
| 93 ? base::TimeDelta() | |
| 94 : animation->TrimTimeToCurrentIteration(frame_monotonic_time); | |
| 95 | |
| 96 curve->UpdateTarget(trimmed.InSecondsF(), new_target); | |
|
ymalik
2016/08/18 07:34:20
The observed failure mode is that when you do two
| |
| 92 | 97 |
| 93 return true; | 98 return true; |
| 94 } | 99 } |
| 95 | 100 |
| 96 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( | 101 void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( |
| 97 ElementId element_id, | 102 ElementId element_id, |
| 98 const gfx::Vector2dF& adjustment) { | 103 const gfx::Vector2dF& adjustment) { |
| 99 DCHECK(scroll_offset_animation_player_); | 104 DCHECK(scroll_offset_animation_player_); |
| 100 if (element_id != scroll_offset_animation_player_->element_id()) | 105 if (element_id != scroll_offset_animation_player_->element_id()) |
| 101 return; | 106 return; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 ElementId element_id) { | 153 ElementId element_id) { |
| 149 if (scroll_offset_animation_player_->element_id() != element_id) { | 154 if (scroll_offset_animation_player_->element_id() != element_id) { |
| 150 if (scroll_offset_animation_player_->element_id()) | 155 if (scroll_offset_animation_player_->element_id()) |
| 151 scroll_offset_animation_player_->DetachElement(); | 156 scroll_offset_animation_player_->DetachElement(); |
| 152 if (element_id) | 157 if (element_id) |
| 153 scroll_offset_animation_player_->AttachElement(element_id); | 158 scroll_offset_animation_player_->AttachElement(element_id); |
| 154 } | 159 } |
| 155 } | 160 } |
| 156 | 161 |
| 157 } // namespace cc | 162 } // namespace cc |
| OLD | NEW |