Index: cc/layer_tree_host_impl.cc |
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
index 3c13252533264361d6f3f2234f17bf91f0a72c40..bd3440fb61348ce9daf8579e46170262a0551dab 100644 |
--- a/cc/layer_tree_host_impl.cc |
+++ b/cc/layer_tree_host_impl.cc |
@@ -1560,6 +1560,7 @@ void LayerTreeHostImpl::ScrollEnd() { |
if (top_controls_manager_) |
top_controls_manager_->ScrollEnd(); |
ClearCurrentlyScrollingLayer(); |
+ StartScrollbarAnimation(base::TimeTicks::Now()); |
} |
void LayerTreeHostImpl::PinchGestureBegin() { |
@@ -1605,12 +1606,6 @@ void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, |
void LayerTreeHostImpl::PinchGestureEnd() { |
pinch_gesture_active_ = false; |
- if (RootScrollLayer() && |
- RootScrollLayer()->scrollbar_animation_controller()) { |
- RootScrollLayer()->scrollbar_animation_controller()-> |
- didPinchGestureEnd(base::TimeTicks::Now()); |
- } |
- |
client_->SetNeedsCommitOnImplThread(); |
} |
@@ -1830,13 +1825,40 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, |
ScrollbarAnimationController* scrollbar_controller = |
layer->scrollbar_animation_controller(); |
- if (scrollbar_controller && scrollbar_controller->animate(time)) |
+ if (scrollbar_controller && scrollbar_controller->animate(time)) { |
+ TRACE_EVENT_INSTANT0( |
+ "cc", "LayerTreeHostImpl::setNeedsRedraw due to AnimateScrollbars"); |
client_->SetNeedsRedrawOnImplThread(); |
+ } |
for (size_t i = 0; i < layer->children().size(); ++i) |
AnimateScrollbarsRecursive(layer->children()[i], time); |
} |
+void LayerTreeHostImpl::StartScrollbarAnimation(base::TimeTicks time) { |
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::startScrollbarAnimation"); |
+ StartScrollbarAnimationRecursive(RootLayer(), time); |
+} |
+ |
+void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer, |
+ base::TimeTicks time) { |
+ if (!layer) |
+ return; |
+ |
+ ScrollbarAnimationController* scrollbar_controller = |
+ layer->scrollbar_animation_controller(); |
+ if (scrollbar_controller && layer != CurrentlyScrollingLayer()) { |
+ double delay = scrollbar_controller->secondsBeforeStart(time); |
+ if (delay > 0) |
+ client_->RequestScrollbarAnimationOnImplThread(delay); |
+ else if (delay == 0 && scrollbar_controller->animate(time)) |
+ client_->SetNeedsRedrawOnImplThread(); |
+ } |
+ |
+ for (size_t i = 0; i < layer->children().size(); ++i) |
+ StartScrollbarAnimationRecursive(layer->children()[i], time); |
+} |
+ |
void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { |
if (!tile_manager_) |
return; |