| 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 df9e29bc9415aa07188c3c3b1a16a47ca3049314..cc232e34ba5ab735fa2ea52492d581b32028ebce 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -2725,6 +2725,11 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
|
| MainThreadScrollingReason::kNotScrollingOnMain;
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
|
|
|
| + // On Mac a scroll begin with |inertial_phase| = true happens to handle a
|
| + // fling.
|
| + if (scroll_state->is_in_inertial_phase())
|
| + return FlingScrollBegin();
|
| +
|
| ClearCurrentlyScrollingLayer();
|
|
|
| gfx::Point viewport_point(scroll_state->position_x(),
|
| @@ -2887,7 +2892,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
| ScrollStateData scroll_state_data;
|
| scroll_state_data.position_x = viewport_point.x();
|
| scroll_state_data.position_y = viewport_point.y();
|
| - scroll_state_data.is_in_inertial_phase = true;
|
| + scroll_state_data.is_in_inertial_phase = false;
|
| ScrollState scroll_state(scroll_state_data);
|
|
|
| // ScrollAnimated is used for animated wheel scrolls. We find the first layer
|
| @@ -2925,7 +2930,12 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
| }
|
| }
|
| scroll_state.set_is_ending(true);
|
| + // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
|
| + // impelemented, the current scrolling layer should not get cleared after
|
| + // each animation (crbug.com/526463).
|
| ScrollEnd(&scroll_state);
|
| + ClearCurrentlyScrollingLayer();
|
| +
|
| return scroll_status;
|
| }
|
|
|
| @@ -3279,7 +3289,12 @@ void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
|
|
|
| DistributeScrollDelta(scroll_state);
|
| top_controls_manager_->ScrollEnd();
|
| - ClearCurrentlyScrollingLayer();
|
| +
|
| + if (scroll_state->is_in_inertial_phase()) {
|
| + // Only clear the currently scrolling layer if we know the scroll is done.
|
| + // A non-inertial scroll end could be followed by an inertial scroll.
|
| + ClearCurrentlyScrollingLayer();
|
| + }
|
| }
|
|
|
| InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
|
| @@ -4093,7 +4108,11 @@ void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
|
| // TODO(majidvp): We should pass in the original starting scroll position here
|
| ScrollStateData scroll_state_data;
|
| ScrollState scroll_state(scroll_state_data);
|
| + // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
|
| + // impelemented, the current scrolling layer should not get cleared after
|
| + // each animation (crbug.com/526463).
|
| ScrollEnd(&scroll_state);
|
| + ClearCurrentlyScrollingLayer();
|
| }
|
|
|
| gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
|
|
|