Chromium Code Reviews| 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 14a6ffd138bfc0fe8b56c5fa7c7f949fa56decf4..8947d1c9646f0ac9482ffc87b51e83d174b59cd2 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -576,7 +576,7 @@ bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt( |
| device_viewport_point, type, layer_impl, &scroll_on_main_thread, |
| &main_thread_scrolling_reasons); |
| - if (!test_layer_impl) |
| + if (scroll_on_main_thread) |
| return false; |
| if (scrolling_layer_impl == test_layer_impl) |
| @@ -1655,7 +1655,6 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { |
| } |
| } |
| - |
| CompositorFrame compositor_frame; |
| compositor_frame.metadata = std::move(metadata); |
| resource_provider_->PrepareSendToParent(resources, |
| @@ -2525,7 +2524,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
| // Walk up the hierarchy and look for a scrollable layer. |
| ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| - LayerImpl* potentially_scrolling_layer_impl = NULL; |
| + LayerImpl* potentially_scrolling_layer_impl = nullptr; |
| if (layer_impl) { |
| ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index()); |
| for (; scroll_tree.parent(scroll_node); |
| @@ -2537,7 +2536,9 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
| if (IsMainThreadScrolling(status, scroll_node)) { |
| *scroll_on_main_thread = true; |
| *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; |
| - return NULL; |
| + return potentially_scrolling_layer_impl |
|
weiliangc
2017/01/16 18:31:15
Why not return just active_tree->LayerById(scroll_
|
| + ? potentially_scrolling_layer_impl |
| + : active_tree_->LayerById(scroll_node->owning_layer_id); |
| } |
| if (status.thread == InputHandler::SCROLL_ON_IMPL_THREAD && |
| @@ -2566,7 +2567,6 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
| if (IsMainThreadScrolling(status, scroll_node)) { |
| *scroll_on_main_thread = true; |
| *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; |
| - return NULL; |
| } |
| } |
| @@ -2678,15 +2678,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 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 (scroll_on_main_thread) { |
| RecordCompositorSlowScrollMetric(type, MAIN_THREAD); |
| scroll_status.thread = SCROLL_ON_MAIN_THREAD; |
| return scroll_status; |
| + } else if (scrolling_layer_impl) { |
| + scroll_affects_scroll_handler_ = |
| + scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers(); |
| } |
| return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); |
| @@ -3242,7 +3242,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| // Check if mouse is over a scrollbar or not. |
| // TODO(sahel): get rid of this extera checking when |
| // FindScrollLayerForDeviceViewportPoint finds the proper layer for |
| - // scrolling on main thread, as well. |
| + // scrolling on main thread when mouse is over scrollbar as well. |
| int new_id = Layer::INVALID_ID; |
| if (layer_impl && layer_impl->ToScrollbarLayer()) |
| new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); |