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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2759523002: Make sure all the touch events during an active fling are uncancelable (Closed)
Patch Set: rebase master Created 3 years, 9 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_impl.h ('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 c4235c6776e8ce9857518b1952670c926e7b2222..76c9e0d879bc5ade5c91ccf90c13b30a3b0a580e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -602,13 +602,12 @@ EventListenerProperties LayerTreeHostImpl::GetEventListenerProperties(
// Return true if scrollable node for 'ancestor' is the same as 'child' or an
// ancestor along the scroll tree.
-bool IsScrolledBy(LayerImpl* child, ScrollNode* ancestor) {
+bool LayerTreeHostImpl::IsScrolledBy(LayerImpl* child, ScrollNode* ancestor) {
DCHECK(ancestor && ancestor->scrollable);
if (!child)
return false;
-
- auto* property_trees = child->layer_tree_impl()->property_trees();
- ScrollTree& scroll_tree = property_trees->scroll_tree;
+ DCHECK_EQ(child->layer_tree_impl(), active_tree_.get());
+ ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index());
scroll_node; scroll_node = scroll_tree.parent(scroll_node)) {
if (scroll_node->id == ancestor->id)
@@ -625,15 +624,22 @@ LayerTreeHostImpl::EventListenerTypeForTouchStartAt(
// Now determine if there are actually any handlers at that point.
// TODO(rbyers): Consider also honoring touch-action (crbug.com/347272).
- LayerImpl* layer_impl =
+ LayerImpl* layer_impl_with_touch_handler =
active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion(
device_viewport_point);
- if (layer_impl == NULL)
+ if (layer_impl_with_touch_handler == NULL)
return InputHandler::TouchStartEventListenerType::NO_HANDLER;
if (!CurrentlyScrollingNode())
return InputHandler::TouchStartEventListenerType::HANDLER;
+ // Check if the touch start hits on the current scrolling layer or its
+ // descendant. layer_impl_with_touch_handler is the layer hit by the pointer
+ // and has an event handler, otherwise it is null.
+ // We want to compare the most inner layer we are hitting on which may not
+ // have an event listener with the actual scrolling layer.
+ LayerImpl* layer_impl =
+ active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
bool is_ancestor = IsScrolledBy(layer_impl, CurrentlyScrollingNode());
return is_ancestor ? InputHandler::TouchStartEventListenerType::
HANDLER_ON_SCROLLING_LAYER
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698