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

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: 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
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | 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..2724f543974c5d87f7b0b3aeec37932ba5f88b8e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2140,6 +2140,20 @@ 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) {
+ if (!scroll_ancestor)
+ return false;
+
+ LayerImpl* ancestor = child;
enne (OOO) 2014/04/15 21:25:54 style nit: don't put this out of scope just to avo
+ for (; ancestor; ancestor = NextScrollLayer(ancestor)) {
+ if (ancestor == scroll_ancestor)
+ return true;
+ }
+
+ return false;
+}
+
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
const gfx::Point& viewport_point,
InputHandler::ScrollInputType type) {
@@ -2159,6 +2173,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 (!HasScrollAncestor(layer_impl, scroll_layer_impl))
+ return ScrollOnMainThread;
+ }
+
bool scroll_on_main_thread = false;
LayerImpl* potentially_scrolling_layer_impl =
FindScrollLayerForDeviceViewportPoint(device_viewport_point,
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698