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 ead5db73d6b313687d5e2193cc69a19024c1293d..c8104e97930bdd04bcf6df2e72d7c2a1c65cb23d 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -155,6 +155,22 @@ void RecordCompositorSlowScrollMetric(InputHandler::ScrollInputType type, |
} |
} |
+// Similar to LayerImpl::HasAncestor, but walks up the scroll parents. |
+static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { |
+ DCHECK(scroll_ancestor); |
+ if (!child) |
+ return false; |
+ ScrollTree& scroll_tree = |
+ child->layer_tree_impl()->property_trees()->scroll_tree; |
+ ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); |
+ for (; scroll_tree.parent(scroll_node); |
bokan
2016/11/04 19:32:55
This will avoid comparing against the root layer.
|
+ scroll_node = scroll_tree.parent(scroll_node)) { |
+ if (scroll_node->scrollable) |
+ return scroll_node->owner_id == scroll_ancestor->id(); |
+ } |
+ return false; |
+} |
+ |
} // namespace |
DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
@@ -591,7 +607,7 @@ EventListenerProperties LayerTreeHostImpl::GetEventListenerProperties( |
return active_tree_->event_listener_properties(event_class); |
} |
-bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt( |
+InputHandler::TouchStartHitResult LayerTreeHostImpl::DoTouchEventsBlockScrollAt( |
const gfx::Point& viewport_point) { |
gfx::PointF device_viewport_point = gfx::ScalePoint( |
gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
@@ -601,7 +617,16 @@ bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt( |
LayerImpl* layer_impl = |
active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( |
device_viewport_point); |
- return layer_impl != NULL; |
+ if (layer_impl == NULL) |
+ return TouchStartHitResult::HANDLER; |
+ |
+ if (!CurrentlyScrollingLayer()) |
+ return TouchStartHitResult::SAME_LAYER; |
tdresser
2016/11/04 17:15:20
I don't understand this, but I might just be confu
bokan
2016/11/04 19:32:55
+1, I don't know what these returns mean.
|
+ |
+ bool is_ancestor = |
+ HasScrollAncestor(layer_impl, active_tree_->CurrentlyScrollingLayer()); |
bokan
2016/11/04 19:32:55
What should happen if layer_impl == CurrentlyScrol
|
+ return is_ancestor ? TouchStartHitResult::SAME_LAYER |
+ : TouchStartHitResult::DIFFERENT_LAYER; |
} |
std::unique_ptr<SwapPromiseMonitor> |
@@ -2575,22 +2600,6 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
return potentially_scrolling_layer_impl; |
} |
-// Similar to LayerImpl::HasAncestor, but walks up the scroll parents. |
-static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { |
- DCHECK(scroll_ancestor); |
- if (!child) |
- return false; |
- ScrollTree& scroll_tree = |
- child->layer_tree_impl()->property_trees()->scroll_tree; |
- ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); |
- for (; scroll_tree.parent(scroll_node); |
- scroll_node = scroll_tree.parent(scroll_node)) { |
- if (scroll_node->scrollable) |
- return scroll_node->owner_id == scroll_ancestor->id(); |
- } |
- return false; |
-} |
- |
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( |
ScrollState* scroll_state, |
LayerImpl* scrolling_layer_impl, |
@@ -2685,7 +2694,6 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
if (scroll_on_main_thread) { |
RecordCompositorSlowScrollMetric(type, MAIN_THREAD); |
- |
scroll_status.thread = SCROLL_ON_MAIN_THREAD; |
return scroll_status; |
} |