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 9d01bd653cb692523f0cfccf3bcc9f098ad0f097..6ac73a4ab3f435e5a75d90a6e7598b079b2f01b7 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -1659,7 +1659,6 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { |
| } |
| } |
| - |
| CompositorFrame compositor_frame; |
| compositor_frame.metadata = std::move(metadata); |
| resource_provider_->PrepareSendToParent(resources, |
| @@ -2576,6 +2575,28 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
| return potentially_scrolling_layer_impl; |
| } |
| +LayerImpl* LayerTreeHostImpl::FindScrollLayerByLayer( |
|
bokan
2017/01/10 22:36:22
This method avoids the walk up the parent layers l
|
| + LayerImpl* layer_impl) const { |
| + ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| + LayerImpl* potentially_scrolling_layer_impl = nullptr; |
| + if (layer_impl) { |
| + ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index()); |
| + potentially_scrolling_layer_impl = |
| + active_tree_->LayerById(scroll_node->owning_layer_id); |
| + } |
| + |
| + // Falling back to the viewport layer ensures generation of root overscroll |
| + // notifications. We use the viewport's main scroll layer to represent the |
| + // viewport in scrolling code. |
| + if (!potentially_scrolling_layer_impl || |
| + potentially_scrolling_layer_impl == OuterViewportScrollLayer() || |
| + potentially_scrolling_layer_impl == InnerViewportScrollLayer()) { |
| + potentially_scrolling_layer_impl = viewport()->MainScrollLayer(); |
| + } |
| + |
| + return potentially_scrolling_layer_impl; |
| +} |
| + |
| static bool IsClosestScrollAncestor(LayerImpl* child, |
| LayerImpl* scroll_ancestor) { |
| DCHECK(scroll_ancestor); |
| @@ -3243,9 +3264,6 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| active_tree_->FindLayerThatIsHitByPoint(device_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. |
| int new_id = Layer::INVALID_ID; |
| if (layer_impl && layer_impl->ToScrollbarLayer()) |
| new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); |
| @@ -3253,11 +3271,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| // Mouse over a scrollbar. |
| distance_to_scrollbar = 0; |
| } else { |
| - bool scroll_on_main_thread = false; |
| - uint32_t main_thread_scrolling_reasons; |
| - LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| - device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, |
| - &scroll_on_main_thread, &main_thread_scrolling_reasons); |
| + LayerImpl* scroll_layer_impl = FindScrollLayerByLayer(layer_impl); |
| // Scrollbars for the viewport are registered with the outer viewport layer. |
| if (scroll_layer_impl == InnerViewportScrollLayer()) |