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> |