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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2471523002: Make touch events uncancelable during fling when they are on the current active scroll layer (Closed)
Patch Set: fling layer Created 4 years, 1 month 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 7889ddce3de41937972cde28ee84e323bdf42d35..a3cc2f42b448d07ab049bd350bf337de07b9a1ac 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -154,6 +154,22 @@ void RecordCompositorSlowScrollMetric(InputHandler::ScrollInputType type,
}
}
+// Return true if ancestor is same as child or its ancestor.
+bool isAncestor(LayerImpl* child, LayerImpl* ancestor) {
bokan 2016/11/14 18:32:48 This should be called isScrollingAncestor to make
weiliangc 2016/11/14 19:02:55 It is an unfortunate implementation detail of Prop
bokan 2016/11/14 19:04:32 But in that case, there shouldn't be a LayerImpl t
weiliangc 2016/11/14 20:57:20 Yeah, so only one of the two function would be fin
lanwei 2016/11/14 22:47:45 https://codesearch.chromium.org/chromium/src/cc/tr
weiliangc 2016/11/15 15:32:35 How about rename the function to isScrolledBy? It
+ DCHECK(ancestor);
+ if (!child)
+ return false;
+
+ ScrollTree& scroll_tree =
+ child->layer_tree_impl()->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->owner_id == ancestor->id())
+ return true;
+ }
+ return false;
+}
+
} // namespace
DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer,
@@ -581,7 +597,7 @@ EventListenerProperties LayerTreeHostImpl::GetEventListenerProperties(
return active_tree_->event_listener_properties(event_class);
}
-bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt(
+EventListenerProperties LayerTreeHostImpl::DoTouchHandlersBlockScrollAt(
const gfx::Point& viewport_point) {
gfx::PointF device_viewport_point = gfx::ScalePoint(
gfx::PointF(viewport_point), active_tree_->device_scale_factor());
@@ -591,7 +607,16 @@ bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt(
LayerImpl* layer_impl =
active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion(
device_viewport_point);
- return layer_impl != NULL;
+ if (layer_impl == NULL)
+ return EventListenerProperties::kNone;
+
+ if (!CurrentlyScrollingLayer())
+ return EventListenerProperties::kBlocking;
+
+ bool is_ancestor =
+ isAncestor(layer_impl, active_tree_->CurrentlyScrollingLayer());
+ return is_ancestor ? EventListenerProperties::kBlockingAndPassiveDueToFling
+ : EventListenerProperties::kBlocking;
}
std::unique_ptr<SwapPromiseMonitor>
« 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