| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 active_tree_->ScrollableSize(), active_tree_->current_page_scale_factor(), | 3743 active_tree_->ScrollableSize(), active_tree_->current_page_scale_factor(), |
| 3744 active_tree_->min_page_scale_factor(), | 3744 active_tree_->min_page_scale_factor(), |
| 3745 active_tree_->max_page_scale_factor()); | 3745 active_tree_->max_page_scale_factor()); |
| 3746 } | 3746 } |
| 3747 | 3747 |
| 3748 void LayerTreeHostImpl::ScrollAnimationAbort(LayerImpl* layer_impl) { | 3748 void LayerTreeHostImpl::ScrollAnimationAbort(LayerImpl* layer_impl) { |
| 3749 if (animation_host_) | 3749 if (animation_host_) |
| 3750 return animation_host_->ScrollAnimationAbort(); | 3750 return animation_host_->ScrollAnimationAbort(); |
| 3751 | 3751 |
| 3752 layer_impl->layer_animation_controller()->AbortAnimations( | 3752 layer_impl->layer_animation_controller()->AbortAnimations( |
| 3753 Animation::SCROLL_OFFSET); | 3753 TargetProperty::SCROLL_OFFSET); |
| 3754 } | 3754 } |
| 3755 | 3755 |
| 3756 void LayerTreeHostImpl::ScrollAnimationCreate( | 3756 void LayerTreeHostImpl::ScrollAnimationCreate( |
| 3757 ScrollNode* scroll_node, | 3757 ScrollNode* scroll_node, |
| 3758 const gfx::ScrollOffset& target_offset, | 3758 const gfx::ScrollOffset& target_offset, |
| 3759 const gfx::ScrollOffset& current_offset) { | 3759 const gfx::ScrollOffset& current_offset) { |
| 3760 if (animation_host_) | 3760 if (animation_host_) |
| 3761 return animation_host_->ImplOnlyScrollAnimationCreate( | 3761 return animation_host_->ImplOnlyScrollAnimationCreate( |
| 3762 scroll_node->owner_id, target_offset, current_offset); | 3762 scroll_node->owner_id, target_offset, current_offset); |
| 3763 | 3763 |
| 3764 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); | 3764 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); |
| 3765 | 3765 |
| 3766 scoped_ptr<ScrollOffsetAnimationCurve> curve = | 3766 scoped_ptr<ScrollOffsetAnimationCurve> curve = |
| 3767 ScrollOffsetAnimationCurve::Create( | 3767 ScrollOffsetAnimationCurve::Create( |
| 3768 target_offset, EaseInOutTimingFunction::Create(), | 3768 target_offset, EaseInOutTimingFunction::Create(), |
| 3769 ScrollOffsetAnimationCurve::DurationBehavior::INVERSE_DELTA); | 3769 ScrollOffsetAnimationCurve::DurationBehavior::INVERSE_DELTA); |
| 3770 curve->SetInitialValue(current_offset); | 3770 curve->SetInitialValue(current_offset); |
| 3771 | 3771 |
| 3772 scoped_ptr<Animation> animation = Animation::Create( | 3772 scoped_ptr<Animation> animation = Animation::Create( |
| 3773 std::move(curve), AnimationIdProvider::NextAnimationId(), | 3773 std::move(curve), AnimationIdProvider::NextAnimationId(), |
| 3774 AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET); | 3774 AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET); |
| 3775 animation->set_is_impl_only(true); | 3775 animation->set_is_impl_only(true); |
| 3776 | 3776 |
| 3777 layer_impl->layer_animation_controller()->AddAnimation(std::move(animation)); | 3777 layer_impl->layer_animation_controller()->AddAnimation(std::move(animation)); |
| 3778 } | 3778 } |
| 3779 | 3779 |
| 3780 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget( | 3780 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget( |
| 3781 ScrollNode* scroll_node, | 3781 ScrollNode* scroll_node, |
| 3782 const gfx::Vector2dF& scroll_delta) { | 3782 const gfx::Vector2dF& scroll_delta) { |
| 3783 if (animation_host_) | 3783 if (animation_host_) |
| 3784 return animation_host_->ImplOnlyScrollAnimationUpdateTarget( | 3784 return animation_host_->ImplOnlyScrollAnimationUpdateTarget( |
| 3785 scroll_node->owner_id, scroll_delta, | 3785 scroll_node->owner_id, scroll_delta, |
| 3786 active_tree_->property_trees()->scroll_tree.MaxScrollOffset( | 3786 active_tree_->property_trees()->scroll_tree.MaxScrollOffset( |
| 3787 scroll_node->id), | 3787 scroll_node->id), |
| 3788 CurrentBeginFrameArgs().frame_time); | 3788 CurrentBeginFrameArgs().frame_time); |
| 3789 | 3789 |
| 3790 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); | 3790 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); |
| 3791 | 3791 |
| 3792 Animation* animation = | 3792 Animation* animation = |
| 3793 layer_impl->layer_animation_controller() | 3793 layer_impl->layer_animation_controller() |
| 3794 ? layer_impl->layer_animation_controller()->GetAnimation( | 3794 ? layer_impl->layer_animation_controller()->GetAnimation( |
| 3795 Animation::SCROLL_OFFSET) | 3795 TargetProperty::SCROLL_OFFSET) |
| 3796 : nullptr; | 3796 : nullptr; |
| 3797 if (!animation) | 3797 if (!animation) |
| 3798 return false; | 3798 return false; |
| 3799 | 3799 |
| 3800 ScrollOffsetAnimationCurve* curve = | 3800 ScrollOffsetAnimationCurve* curve = |
| 3801 animation->curve()->ToScrollOffsetAnimationCurve(); | 3801 animation->curve()->ToScrollOffsetAnimationCurve(); |
| 3802 | 3802 |
| 3803 gfx::ScrollOffset new_target = | 3803 gfx::ScrollOffset new_target = |
| 3804 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 3804 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
| 3805 new_target.SetToMax(gfx::ScrollOffset()); | 3805 new_target.SetToMax(gfx::ScrollOffset()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3980 return task_runner_provider_->HasImplThread(); | 3980 return task_runner_provider_->HasImplThread(); |
| 3981 } | 3981 } |
| 3982 | 3982 |
| 3983 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3983 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3984 // In single threaded mode we skip the pending tree and commit directly to the | 3984 // In single threaded mode we skip the pending tree and commit directly to the |
| 3985 // active tree. | 3985 // active tree. |
| 3986 return !task_runner_provider_->HasImplThread(); | 3986 return !task_runner_provider_->HasImplThread(); |
| 3987 } | 3987 } |
| 3988 | 3988 |
| 3989 } // namespace cc | 3989 } // namespace cc |
| OLD | NEW |