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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2197503002: Route Scroll events through a cc::InputHandler Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollWheelAsScrollEvent
Patch Set: Abandon DeliverInputForBeginFrame: will not help fix the header row Created 4 years 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 | ui/compositor/BUILD.gn » ('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 2e5b954ba3853611a1ca9b042aa394ca5c45c49b..95307c4dc154b1d95f17e28dc5822f6e6435024d 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2957,6 +2957,7 @@ void LayerTreeHostImpl::ApplyScroll(ScrollNode* scroll_node,
// we want to scroll the inner viewport -- to allow panning while zoomed --
// but also move browser controls if needed.
bool is_inner_viewport_scroll_layer =
+ InnerViewportScrollLayer() &&
scroll_node->owner_id == InnerViewportScrollLayer()->id();
if (is_viewport_scroll_layer || is_inner_viewport_scroll_layer) {
@@ -3051,6 +3052,21 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
DCHECK(scroll_state);
TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
+
+ if (!CurrentlyScrollingLayer()) {
+ // If the InputHandlerClient didn't call ScrollBegin() to re-perform a
+ // hit-test but provided an element to scroll instead, scroll that.
+ ElementId provided_element =
+ scroll_state->data()->current_native_scrolling_element();
+ if (provided_element) {
+ // Assume the primaryId matches the layer_id for lookup (this is true for
+ // ui:Layers), then check the match.
+ LayerImpl* layer = active_tree()->LayerById(provided_element.primaryId);
+ if (layer && layer->element_id() == provided_element)
+ active_tree_->SetCurrentlyScrollingLayer(layer);
+ }
+ }
+
if (!CurrentlyScrollingLayer())
return InputHandlerScrollResult();
« no previous file with comments | « no previous file | ui/compositor/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698