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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2621133002: Return main thread scroll layer in FindScrollLayerForDeviceViewportPoint (Closed)
Patch Set: 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 | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | 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 9d01bd653cb692523f0cfccf3bcc9f098ad0f097..6ac73a4ab3f435e5a75d90a6e7598b079b2f01b7 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1659,7 +1659,6 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
}
}
-
CompositorFrame compositor_frame;
compositor_frame.metadata = std::move(metadata);
resource_provider_->PrepareSendToParent(resources,
@@ -2576,6 +2575,28 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
return potentially_scrolling_layer_impl;
}
+LayerImpl* LayerTreeHostImpl::FindScrollLayerByLayer(
bokan 2017/01/10 22:36:22 This method avoids the walk up the parent layers l
+ LayerImpl* layer_impl) const {
+ ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
+ LayerImpl* potentially_scrolling_layer_impl = nullptr;
+ if (layer_impl) {
+ ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index());
+ potentially_scrolling_layer_impl =
+ active_tree_->LayerById(scroll_node->owning_layer_id);
+ }
+
+ // Falling back to the viewport layer ensures generation of root overscroll
+ // notifications. We use the viewport's main scroll layer to represent the
+ // viewport in scrolling code.
+ if (!potentially_scrolling_layer_impl ||
+ potentially_scrolling_layer_impl == OuterViewportScrollLayer() ||
+ potentially_scrolling_layer_impl == InnerViewportScrollLayer()) {
+ potentially_scrolling_layer_impl = viewport()->MainScrollLayer();
+ }
+
+ return potentially_scrolling_layer_impl;
+}
+
static bool IsClosestScrollAncestor(LayerImpl* child,
LayerImpl* scroll_ancestor) {
DCHECK(scroll_ancestor);
@@ -3243,9 +3264,6 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
active_tree_->FindLayerThatIsHitByPoint(device_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.
int new_id = Layer::INVALID_ID;
if (layer_impl && layer_impl->ToScrollbarLayer())
new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId();
@@ -3253,11 +3271,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
// Mouse over a scrollbar.
distance_to_scrollbar = 0;
} else {
- bool scroll_on_main_thread = false;
- uint32_t main_thread_scrolling_reasons;
- LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint(
- device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl,
- &scroll_on_main_thread, &main_thread_scrolling_reasons);
+ LayerImpl* scroll_layer_impl = FindScrollLayerByLayer(layer_impl);
// Scrollbars for the viewport are registered with the outer viewport layer.
if (scroll_layer_impl == InnerViewportScrollLayer())
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698