| 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 f1ef243b83c595dcbfda11fe6afb26488f1a3c20..83a67283fd820257702c693cdbe1bef1a87b0a1c 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -2778,8 +2778,10 @@ gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta(
|
| return gfx::Vector2dF(scrolled.x(), scrolled.y());
|
| }
|
|
|
| -bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
|
| - const gfx::Vector2dF& delta) {
|
| +bool LayerTreeHostImpl::ScrollAnimationCreate(
|
| + ScrollNode* scroll_node,
|
| + const gfx::Vector2dF& delta,
|
| + base::TimeTicks original_event_time) {
|
| ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
|
|
|
| const float kEpsilon = 0.1f;
|
| @@ -2797,7 +2799,8 @@ bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
|
| gfx::ScrollOffset target_offset = scroll_tree.ClampScrollOffsetToLimits(
|
| current_offset + gfx::ScrollOffset(delta), scroll_node);
|
| animation_host_->ImplOnlyScrollAnimationCreate(scroll_node->owner_id,
|
| - target_offset, current_offset);
|
| + target_offset, current_offset,
|
| + original_event_time);
|
|
|
| SetNeedsOneBeginImplFrame();
|
|
|
| @@ -2806,7 +2809,8 @@ bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
|
|
|
| InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
| const gfx::Point& viewport_point,
|
| - const gfx::Vector2dF& scroll_delta) {
|
| + const gfx::Vector2dF& scroll_delta,
|
| + const ui::LatencyInfo* latency_info) {
|
| InputHandler::ScrollStatus scroll_status;
|
| scroll_status.main_thread_scrolling_reasons =
|
| MainThreadScrollingReason::kNotScrollingOnMain;
|
| @@ -2850,8 +2854,18 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
| scroll_node->data.is_outer_viewport_scroll_layer)
|
| continue;
|
|
|
| + // Some time may have passed between now and when the user actually
|
| + // asked to scroll. The animation curve should take this into account
|
| + // in the duration of the animation.
|
| + ui::LatencyInfo::LatencyComponent o_component;
|
| + o_component.event_time = base::TimeTicks();
|
| + if (latency_info)
|
| + latency_info->FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
|
| + 0, &o_component);
|
| +
|
| if (scroll_node->data.is_inner_viewport_scroll_layer) {
|
| - gfx::Vector2dF scrolled = viewport()->ScrollAnimated(pending_delta);
|
| + gfx::Vector2dF scrolled =
|
| + viewport()->ScrollAnimated(pending_delta, o_component.event_time);
|
| // Viewport::ScrollAnimated returns pending_delta as long as it
|
| // starts an animation.
|
| if (scrolled == pending_delta)
|
| @@ -2862,7 +2876,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
|
|
| gfx::Vector2dF scroll_delta =
|
| ComputeScrollDelta(scroll_node, pending_delta);
|
| - if (ScrollAnimationCreate(scroll_node, scroll_delta))
|
| + if (ScrollAnimationCreate(scroll_node, scroll_delta,
|
| + o_component.event_time))
|
| return scroll_status;
|
|
|
| pending_delta -= scroll_delta;
|
|
|