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

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: fling layer 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
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 c7238e8b010676ff9bfebaeb3ac0e2ec7de27982..28799fdb4723d530994dfcf5dfc584a6a5e060d6 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -598,13 +598,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;
+ ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
weiliangc 2017/03/22 18:11:31 Could you DCHECK that child is on active tree? as
lanwei 2017/03/23 19:56:49 Done.
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)
@@ -621,15 +620,21 @@ 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. When we scroll on layer_impl_with_touch_handler, a blank layer
+ // is created inside it, which is the actual scrolling layer, and it does not
pdr. 2017/03/22 20:30:11 If we have the following: <div style="border: 1px
lanwei 2017/03/23 19:56:49 I changed the comments, did not mention the blank
+ // have any event handler.
+ LayerImpl* layer_impl =
+ active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
weiliangc 2017/03/22 18:11:31 Consider the case where there are two divs, where
pdr. 2017/03/22 20:30:11 +1 to Wei's question I am also curious: this logi
lanwei 2017/03/23 19:56:49 This change is part of our touch event interventio
lanwei 2017/03/23 19:56:49 Good question. No matter we scroll on the parent d
bool is_ancestor = IsScrolledBy(layer_impl, CurrentlyScrollingNode());
return is_ancestor ? InputHandler::TouchStartEventListenerType::
HANDLER_ON_SCROLLING_LAYER

Powered by Google App Engine
This is Rietveld 408576698