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

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 2f044eeab78af6ffb4d94972f5fc60b810aac68a..d4c604b8cc64bdce580c710ffa0ef1f240afde06 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -155,6 +155,24 @@ void RecordCompositorSlowScrollMetric(InputHandler::ScrollInputType type,
}
}
+// Return true if scroll_ancestor is same as child or its ancestor.
+bool isAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) {
bokan 2016/11/11 20:41:53 Lets replace HasScrollAncestor with this function.
+ DCHECK(scroll_ancestor);
+ if (!child)
+ return false;
+ if (child->id() == scroll_ancestor->id())
+ return true;
+ ScrollTree& scroll_tree =
+ child->layer_tree_impl()->property_trees()->scroll_tree;
+ ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index());
bokan 2016/11/11 20:41:53 Put this the for loop initializer below: for(Scro
lanwei 2016/11/12 02:17:15 Done.
+ for (; scroll_tree.parent(scroll_node);
bokan 2016/11/11 20:41:53 This is still only looping if we have a parent whi
lanwei 2016/11/12 02:17:15 Done.
+ scroll_node = scroll_tree.parent(scroll_node)) {
+ if (scroll_node->owner_id == scroll_ancestor->id())
+ return true;
+ }
+ return false;
+}
+
} // namespace
DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer,
@@ -582,7 +600,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());
@@ -592,7 +610,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>
@@ -2683,7 +2710,6 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
if (scroll_on_main_thread) {
RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
-
scroll_status.thread = SCROLL_ON_MAIN_THREAD;
return scroll_status;
}
« 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