Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 238803005: Scroll on main if impl-hit testing isn't guaranteed to be correct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding some breaks. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698