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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/compositor/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 bool is_viewport_scroll_layer = 2950 bool is_viewport_scroll_layer =
2951 viewport()->MainScrollLayer() && 2951 viewport()->MainScrollLayer() &&
2952 scroll_node->owner_id == viewport()->MainScrollLayer()->id(); 2952 scroll_node->owner_id == viewport()->MainScrollLayer()->id();
2953 2953
2954 // This is needed if the scroll chains up to the viewport without going 2954 // This is needed if the scroll chains up to the viewport without going
2955 // through the outer viewport scroll layer. This can happen if we scroll an 2955 // through the outer viewport scroll layer. This can happen if we scroll an
2956 // element that's not a descendant of the document.rootScroller. In that case 2956 // element that's not a descendant of the document.rootScroller. In that case
2957 // we want to scroll the inner viewport -- to allow panning while zoomed -- 2957 // we want to scroll the inner viewport -- to allow panning while zoomed --
2958 // but also move browser controls if needed. 2958 // but also move browser controls if needed.
2959 bool is_inner_viewport_scroll_layer = 2959 bool is_inner_viewport_scroll_layer =
2960 InnerViewportScrollLayer() &&
2960 scroll_node->owner_id == InnerViewportScrollLayer()->id(); 2961 scroll_node->owner_id == InnerViewportScrollLayer()->id();
2961 2962
2962 if (is_viewport_scroll_layer || is_inner_viewport_scroll_layer) { 2963 if (is_viewport_scroll_layer || is_inner_viewport_scroll_layer) {
2963 Viewport::ScrollResult result = viewport()->ScrollBy( 2964 Viewport::ScrollResult result = viewport()->ScrollBy(
2964 delta, viewport_point, scroll_state->is_direct_manipulation(), 2965 delta, viewport_point, scroll_state->is_direct_manipulation(),
2965 !wheel_scrolling_, is_viewport_scroll_layer); 2966 !wheel_scrolling_, is_viewport_scroll_layer);
2966 2967
2967 applied_delta = result.consumed_delta; 2968 applied_delta = result.consumed_delta;
2968 delta_applied_to_content = result.content_scrolled_delta; 2969 delta_applied_to_content = result.content_scrolled_delta;
2969 } else { 2970 } else {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, 3045 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,
3045 active_tree()); 3046 active_tree());
3046 scroll_state->DistributeToScrollChainDescendant(); 3047 scroll_state->DistributeToScrollChainDescendant();
3047 } 3048 }
3048 3049
3049 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( 3050 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
3050 ScrollState* scroll_state) { 3051 ScrollState* scroll_state) {
3051 DCHECK(scroll_state); 3052 DCHECK(scroll_state);
3052 3053
3053 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); 3054 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
3055
3056 if (!CurrentlyScrollingLayer()) {
3057 // If the InputHandlerClient didn't call ScrollBegin() to re-perform a
3058 // hit-test but provided an element to scroll instead, scroll that.
3059 ElementId provided_element =
3060 scroll_state->data()->current_native_scrolling_element();
3061 if (provided_element) {
3062 // Assume the primaryId matches the layer_id for lookup (this is true for
3063 // ui:Layers), then check the match.
3064 LayerImpl* layer = active_tree()->LayerById(provided_element.primaryId);
3065 if (layer && layer->element_id() == provided_element)
3066 active_tree_->SetCurrentlyScrollingLayer(layer);
3067 }
3068 }
3069
3054 if (!CurrentlyScrollingLayer()) 3070 if (!CurrentlyScrollingLayer())
3055 return InputHandlerScrollResult(); 3071 return InputHandlerScrollResult();
3056 3072
3057 float initial_top_controls_offset = 3073 float initial_top_controls_offset =
3058 browser_controls_offset_manager_->ControlsTopOffset(); 3074 browser_controls_offset_manager_->ControlsTopOffset();
3059 3075
3060 scroll_state->set_delta_consumed_for_scroll_sequence( 3076 scroll_state->set_delta_consumed_for_scroll_sequence(
3061 did_lock_scrolling_layer_); 3077 did_lock_scrolling_layer_);
3062 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); 3078 scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
3063 scroll_state->set_current_native_scrolling_node( 3079 scroll_state->set_current_native_scrolling_node(
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 worker_context_visibility_ = 4073 worker_context_visibility_ =
4058 worker_context->CacheController()->ClientBecameVisible(); 4074 worker_context->CacheController()->ClientBecameVisible();
4059 } else { 4075 } else {
4060 worker_context->CacheController()->ClientBecameNotVisible( 4076 worker_context->CacheController()->ClientBecameNotVisible(
4061 std::move(worker_context_visibility_)); 4077 std::move(worker_context_visibility_));
4062 } 4078 }
4063 } 4079 }
4064 } 4080 }
4065 4081
4066 } // namespace cc 4082 } // namespace cc
OLDNEW
« 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