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 4a945a224384de89251c3b1d7a2b888f932c4999..a8001b7da199c0ea05167aef8a253f106578e191 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -2140,6 +2140,17 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
return potentially_scrolling_layer_impl; |
} |
+// Similar to LayerImpl::HasAncestor, but takes into account scroll parents. |
+static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { |
+ DCHECK(scroll_ancestor); |
+ for (LayerImpl* ancestor = child; ancestor; |
+ ancestor = NextScrollLayer(ancestor)) { |
+ if (ancestor->scrollable()) |
+ return ancestor == scroll_ancestor; |
+ } |
+ return false; |
+} |
+ |
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
const gfx::Point& viewport_point, |
InputHandler::ScrollInputType type) { |
@@ -2159,6 +2170,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
device_viewport_point, |
active_tree_->RenderSurfaceLayerList()); |
+ |
+ if (layer_impl) { |
+ LayerImpl* scroll_layer_impl = |
+ LayerTreeHostCommon::FindFirstScrollingLayerThatIsHitByPoint( |
+ device_viewport_point, active_tree_->RenderSurfaceLayerList()); |
+ if (scroll_layer_impl && !HasScrollAncestor(layer_impl, scroll_layer_impl)) |
+ return ScrollUnknown; |
+ } |
+ |
bool scroll_on_main_thread = false; |
LayerImpl* potentially_scrolling_layer_impl = |
FindScrollLayerForDeviceViewportPoint(device_viewport_point, |