| 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 d47f504871741c890f5daf7280c13c7412cf7e2e..4c4feea30c50c09813c157a918fb3e8ab834bf45 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -2643,43 +2643,41 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
|
| scroll_status.main_thread_scrolling_reasons =
|
| MainThreadScrollingReason::kNotScrollingOnMain;
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
|
| -
|
| + bool scroll_on_main_thread = false;
|
| + LayerImpl* scrolling_layer_impl;
|
| // 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(),
|
| - scroll_state->position_y());
|
| -
|
| - gfx::PointF device_viewport_point = gfx::ScalePoint(
|
| - gfx::PointF(viewport_point), active_tree_->device_scale_factor());
|
| - LayerImpl* layer_impl =
|
| - active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
|
| + if (scroll_state->is_in_inertial_phase()) {
|
| + scrolling_layer_impl = CurrentlyScrollingLayer();
|
| + } else {
|
| + ClearCurrentlyScrollingLayer();
|
|
|
| - if (layer_impl) {
|
| - LayerImpl* scroll_layer_impl =
|
| - active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
|
| - device_viewport_point);
|
| - if (scroll_layer_impl &&
|
| - !HasScrollAncestor(layer_impl, scroll_layer_impl)) {
|
| - scroll_status.thread = SCROLL_UNKNOWN;
|
| - scroll_status.main_thread_scrolling_reasons =
|
| - MainThreadScrollingReason::kFailedHitTest;
|
| - return scroll_status;
|
| + gfx::Point viewport_point(scroll_state->position_x(),
|
| + scroll_state->position_y());
|
| + gfx::PointF device_viewport_point = gfx::ScalePoint(
|
| + gfx::PointF(viewport_point), active_tree_->device_scale_factor());
|
| + LayerImpl* layer_impl =
|
| + active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
|
| + if (layer_impl) {
|
| + LayerImpl* scroll_layer_impl =
|
| + active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
|
| + device_viewport_point);
|
| + if (scroll_layer_impl &&
|
| + !HasScrollAncestor(layer_impl, scroll_layer_impl)) {
|
| + scroll_status.thread = SCROLL_UNKNOWN;
|
| + scroll_status.main_thread_scrolling_reasons =
|
| + MainThreadScrollingReason::kFailedHitTest;
|
| + return scroll_status;
|
| + }
|
| }
|
| - }
|
| -
|
| - bool scroll_on_main_thread = false;
|
| - LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
|
| - device_viewport_point, type, layer_impl, &scroll_on_main_thread,
|
| - &scroll_status.main_thread_scrolling_reasons);
|
| + scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
|
| + device_viewport_point, type, layer_impl, &scroll_on_main_thread,
|
| + &scroll_status.main_thread_scrolling_reasons);
|
|
|
| - if (scrolling_layer_impl)
|
| - scroll_affects_scroll_handler_ =
|
| - scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
|
| + if (scrolling_layer_impl)
|
| + scroll_affects_scroll_handler_ =
|
| + scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
|
| + }
|
|
|
| if (scroll_on_main_thread) {
|
| RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
|
| @@ -3178,9 +3176,8 @@ void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
|
| DistributeScrollDelta(scroll_state);
|
| top_controls_manager_->ScrollEnd();
|
|
|
| - if (scroll_state->is_in_inertial_phase()) {
|
| + if (!scroll_state->data()->fling_might_happen_next) {
|
| // 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();
|
| }
|
| }
|
|
|