| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 DCHECK_EQ(element_id, scroll_offset_animation_player_->element_id()); | 68 DCHECK_EQ(element_id, scroll_offset_animation_player_->element_id()); |
| 69 | 69 |
| 70 Animation* animation = | 70 Animation* animation = |
| 71 scroll_offset_animation_player_->element_animations()->GetAnimation( | 71 scroll_offset_animation_player_->element_animations()->GetAnimation( |
| 72 TargetProperty::SCROLL_OFFSET); | 72 TargetProperty::SCROLL_OFFSET); |
| 73 if (!animation) { | 73 if (!animation) { |
| 74 scroll_offset_animation_player_->DetachElement(); | 74 scroll_offset_animation_player_->DetachElement(); |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 if (scroll_delta.IsZero()) |
| 78 return true; |
| 77 | 79 |
| 78 ScrollOffsetAnimationCurve* curve = | 80 ScrollOffsetAnimationCurve* curve = |
| 79 animation->curve()->ToScrollOffsetAnimationCurve(); | 81 animation->curve()->ToScrollOffsetAnimationCurve(); |
| 80 | 82 |
| 81 gfx::ScrollOffset new_target = | 83 gfx::ScrollOffset new_target = |
| 82 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 84 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
| 83 new_target.SetToMax(gfx::ScrollOffset()); | 85 new_target.SetToMax(gfx::ScrollOffset()); |
| 84 new_target.SetToMin(max_scroll_offset); | 86 new_target.SetToMin(max_scroll_offset); |
| 85 | 87 |
| 86 curve->UpdateTarget( | 88 curve->UpdateTarget( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 109 ElementId element_id) { | 111 ElementId element_id) { |
| 110 if (scroll_offset_animation_player_->element_id() != element_id) { | 112 if (scroll_offset_animation_player_->element_id() != element_id) { |
| 111 if (scroll_offset_animation_player_->element_id()) | 113 if (scroll_offset_animation_player_->element_id()) |
| 112 scroll_offset_animation_player_->DetachElement(); | 114 scroll_offset_animation_player_->DetachElement(); |
| 113 if (element_id) | 115 if (element_id) |
| 114 scroll_offset_animation_player_->AttachElement(element_id); | 116 scroll_offset_animation_player_->AttachElement(element_id); |
| 115 } | 117 } |
| 116 } | 118 } |
| 117 | 119 |
| 118 } // namespace cc | 120 } // namespace cc |
| OLD | NEW |