| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index 655eda22d650d9a5aa05451926f2dadbc87a606e..a2cf2bf2112b5d881800d855f49ac44da91a8665 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -283,8 +283,7 @@ LayerTreeHostImpl::~LayerTreeHostImpl() {
|
| input_handler_client_->WillShutdown();
|
| input_handler_client_ = NULL;
|
| }
|
| - if (scroll_elasticity_helper_)
|
| - scroll_elasticity_helper_.reset();
|
| + root_scroll_elasticity_helper_.reset();
|
|
|
| // The layer trees must be destroyed before the layer tree host. We've
|
| // made a contract with our animation controllers that the animation_host
|
| @@ -611,13 +610,22 @@ LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor(
|
| new LatencyInfoSwapPromiseMonitor(latency, NULL, this));
|
| }
|
|
|
| -ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() {
|
| - DCHECK(!scroll_elasticity_helper_);
|
| +ScrollElasticityHelper* LayerTreeHostImpl::CreateRootScrollElasticityHelper() {
|
| + DCHECK(!root_scroll_elasticity_helper_);
|
| if (settings_.enable_elastic_overscroll) {
|
| - scroll_elasticity_helper_.reset(
|
| + root_scroll_elasticity_helper_.reset(
|
| ScrollElasticityHelper::CreateForLayerTreeHostImpl(this));
|
| }
|
| - return scroll_elasticity_helper_.get();
|
| + return root_scroll_elasticity_helper_.get();
|
| +}
|
| +
|
| +base::WeakPtr<ScrollElasticityHelper>
|
| +LayerTreeHostImpl::ScrollElasticityHelperForScrollingLayer() {
|
| + LayerImpl* scrolling_layer_impl = CurrentlyScrollingLayer();
|
| + if (!scrolling_layer_impl)
|
| + return nullptr;
|
| +
|
| + return ScrollElasticityHelperForId(scrolling_layer_impl->id())->GetWeakPtr();
|
| }
|
|
|
| bool LayerTreeHostImpl::GetScrollOffsetForLayer(int layer_id,
|
| @@ -2614,8 +2622,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
|
| // in input_handler_proxy instead.
|
| wheel_scrolling_ = IsWheelBasedScroll(type);
|
| scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
|
| - // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure
|
| - // scroll customization callbacks are invoked.
|
| + // Invoke |DistributeScrollDelta| even with zero delta and velocity to process
|
| + // overscroll and ensure scroll customization callbacks are invoked.
|
| DistributeScrollDelta(scroll_state);
|
|
|
| client_->RenewTreePriority();
|
| @@ -3523,6 +3531,38 @@ LayerTreeHostImpl::ScrollbarAnimationControllerForId(
|
| return i->second.get();
|
| }
|
|
|
| +void LayerTreeHostImpl::RegisterScrollElasticityHelper(int scroll_layer_id) {
|
| + DCHECK(!InnerViewportScrollLayer() ||
|
| + scroll_layer_id != InnerViewportScrollLayer()->id());
|
| + DCHECK(!OuterViewportScrollLayer() ||
|
| + scroll_layer_id != OuterViewportScrollLayer()->id());
|
| + DCHECK(settings().enable_elastic_overscroll);
|
| +
|
| + auto& helper = scroll_elasticity_helpers_[scroll_layer_id];
|
| + if (!helper)
|
| + helper = active_tree_->CreateScrollElasticityHelper(scroll_layer_id);
|
| +}
|
| +
|
| +void LayerTreeHostImpl::UnregisterScrollElasticityHelper(int scroll_layer_id) {
|
| + scroll_elasticity_helpers_.erase(scroll_layer_id);
|
| +}
|
| +
|
| +ScrollElasticityHelper* LayerTreeHostImpl::ScrollElasticityHelperForId(
|
| + int scroll_layer_id) {
|
| + if (!settings().enable_elastic_overscroll)
|
| + return nullptr;
|
| +
|
| + auto i = scroll_elasticity_helpers_.find(scroll_layer_id);
|
| + if (i != scroll_elasticity_helpers_.end())
|
| + return i->second.get();
|
| +
|
| + if (!root_scroll_elasticity_helper_) {
|
| + root_scroll_elasticity_helper_.reset(
|
| + ScrollElasticityHelper::CreateForLayerTreeHostImpl(this));
|
| + }
|
| + return root_scroll_elasticity_helper_.get();
|
| +}
|
| +
|
| void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask(
|
| const base::Closure& task,
|
| base::TimeDelta delay) {
|
|
|