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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2621133002: Return main thread scroll layer in FindScrollLayerForDeviceViewportPoint (Closed)
Patch Set: return current layer when it is main thread scrolling Created 3 years, 11 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
« no previous file with comments | « no previous file | 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 14a6ffd138bfc0fe8b56c5fa7c7f949fa56decf4..a619264b439c9bb14077a112de48118efaa926d7 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -576,7 +576,7 @@ bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
device_viewport_point, type, layer_impl, &scroll_on_main_thread,
&main_thread_scrolling_reasons);
- if (!test_layer_impl)
+ if (scroll_on_main_thread)
return false;
if (scrolling_layer_impl == test_layer_impl)
@@ -1655,7 +1655,6 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
}
}
-
CompositorFrame compositor_frame;
compositor_frame.metadata = std::move(metadata);
resource_provider_->PrepareSendToParent(resources,
@@ -2525,7 +2524,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
// Walk up the hierarchy and look for a scrollable layer.
ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
- LayerImpl* potentially_scrolling_layer_impl = NULL;
+ LayerImpl* potentially_scrolling_layer_impl = nullptr;
if (layer_impl) {
ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index());
for (; scroll_tree.parent(scroll_node);
@@ -2537,7 +2536,7 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
if (IsMainThreadScrolling(status, scroll_node)) {
*scroll_on_main_thread = true;
*main_thread_scrolling_reasons = status.main_thread_scrolling_reasons;
- return NULL;
+ return active_tree_->LayerById(scroll_node->owning_layer_id);
}
if (status.thread == InputHandler::SCROLL_ON_IMPL_THREAD &&
@@ -2566,7 +2565,6 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
if (IsMainThreadScrolling(status, scroll_node)) {
*scroll_on_main_thread = true;
*main_thread_scrolling_reasons = status.main_thread_scrolling_reasons;
- return NULL;
}
}
@@ -2678,15 +2676,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
device_viewport_point, type, layer_impl, &scroll_on_main_thread,
&scroll_status.main_thread_scrolling_reasons);
}
- if (scrolling_layer_impl)
- scroll_affects_scroll_handler_ =
- scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
if (scroll_on_main_thread) {
RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
scroll_status.thread = SCROLL_ON_MAIN_THREAD;
return scroll_status;
+ } else if (scrolling_layer_impl) {
+ scroll_affects_scroll_handler_ =
+ scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
}
return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type);
@@ -3242,7 +3240,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
// Check if mouse is over a scrollbar or not.
// TODO(sahel): get rid of this extera checking when
// FindScrollLayerForDeviceViewportPoint finds the proper layer for
- // scrolling on main thread, as well.
+ // scrolling on main thread when mouse is over scrollbar as well.
int new_id = Layer::INVALID_ID;
if (layer_impl && layer_impl->ToScrollbarLayer())
new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId();
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698