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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Account for the fact that OOPIF subframes don't have an InnerViewportScrollLayer. 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 unified diff | Download patch
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 LayerTreeHostImpl::EventListenerTypeForTouchStartAt( 609 LayerTreeHostImpl::EventListenerTypeForTouchStartAt(
610 const gfx::Point& viewport_point) { 610 const gfx::Point& viewport_point) {
611 gfx::PointF device_viewport_point = gfx::ScalePoint( 611 gfx::PointF device_viewport_point = gfx::ScalePoint(
612 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 612 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
613 613
614 // Now determine if there are actually any handlers at that point. 614 // Now determine if there are actually any handlers at that point.
615 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272). 615 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272).
616 LayerImpl* layer_impl = 616 LayerImpl* layer_impl =
617 active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( 617 active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion(
618 device_viewport_point); 618 device_viewport_point);
619 if (layer_impl == NULL) 619 if (layer_impl == NULL) {
enne (OOO) 2017/01/18 01:41:53 I worry a bit about the side effects of always con
wjmaclean 2017/01/18 02:14:10 That's not quite what this CL is doing. The call t
enne (OOO) 2017/01/18 19:11:44 You say that the side effects aren't a worry becau
620 // At present, TouchHandlerRegions are only set for LayerTrees serving the
621 // document's mainframe, i.e. LayerTrees that have a ViewPort defined. But
622 // subframes can still have touch handlers, so here we err on the side of
623 // caution and report a handler even if we don't know which layer it's on.
624 EventListenerProperties properties =
625 active_tree_->event_listener_properties(
626 EventListenerClass::kTouchStartOrMove);
627 if ((properties == EventListenerProperties::kBlocking ||
628 properties == EventListenerProperties::kBlockingAndPassive) &&
629 !active_tree_->OuterViewportScrollLayer()) {
630 return InputHandler::TouchStartEventListenerType::HANDLER;
631 }
620 return InputHandler::TouchStartEventListenerType::NO_HANDLER; 632 return InputHandler::TouchStartEventListenerType::NO_HANDLER;
633 }
621 634
622 if (!CurrentlyScrollingLayer()) 635 if (!CurrentlyScrollingLayer())
623 return InputHandler::TouchStartEventListenerType::HANDLER; 636 return InputHandler::TouchStartEventListenerType::HANDLER;
624 637
625 bool is_ancestor = 638 bool is_ancestor =
626 IsScrolledBy(layer_impl, active_tree_->CurrentlyScrollingLayer()); 639 IsScrolledBy(layer_impl, active_tree_->CurrentlyScrollingLayer());
627 return is_ancestor ? InputHandler::TouchStartEventListenerType:: 640 return is_ancestor ? InputHandler::TouchStartEventListenerType::
628 HANDLER_ON_SCROLLING_LAYER 641 HANDLER_ON_SCROLLING_LAYER
629 : InputHandler::TouchStartEventListenerType::HANDLER; 642 : InputHandler::TouchStartEventListenerType::HANDLER;
630 } 643 }
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 bool is_viewport_scroll_layer = 3001 bool is_viewport_scroll_layer =
2989 viewport()->MainScrollLayer() && 3002 viewport()->MainScrollLayer() &&
2990 scroll_node->owning_layer_id == viewport()->MainScrollLayer()->id(); 3003 scroll_node->owning_layer_id == viewport()->MainScrollLayer()->id();
2991 3004
2992 // This is needed if the scroll chains up to the viewport without going 3005 // This is needed if the scroll chains up to the viewport without going
2993 // through the outer viewport scroll layer. This can happen if we scroll an 3006 // through the outer viewport scroll layer. This can happen if we scroll an
2994 // element that's not a descendant of the document.rootScroller. In that case 3007 // element that's not a descendant of the document.rootScroller. In that case
2995 // we want to scroll the inner viewport -- to allow panning while zoomed -- 3008 // we want to scroll the inner viewport -- to allow panning while zoomed --
2996 // but also move browser controls if needed. 3009 // but also move browser controls if needed.
2997 bool is_inner_viewport_scroll_layer = 3010 bool is_inner_viewport_scroll_layer =
3011 InnerViewportScrollLayer() &&
2998 scroll_node->owning_layer_id == InnerViewportScrollLayer()->id(); 3012 scroll_node->owning_layer_id == InnerViewportScrollLayer()->id();
2999 3013
3000 if (is_viewport_scroll_layer || is_inner_viewport_scroll_layer) { 3014 if (is_viewport_scroll_layer || is_inner_viewport_scroll_layer) {
3001 Viewport::ScrollResult result = viewport()->ScrollBy( 3015 Viewport::ScrollResult result = viewport()->ScrollBy(
3002 delta, viewport_point, scroll_state->is_direct_manipulation(), 3016 delta, viewport_point, scroll_state->is_direct_manipulation(),
3003 !wheel_scrolling_, is_viewport_scroll_layer); 3017 !wheel_scrolling_, is_viewport_scroll_layer);
3004 3018
3005 applied_delta = result.consumed_delta; 3019 applied_delta = result.consumed_delta;
3006 delta_applied_to_content = result.content_scrolled_delta; 3020 delta_applied_to_content = result.content_scrolled_delta;
3007 } else { 3021 } else {
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
4092 worker_context_visibility_ = 4106 worker_context_visibility_ =
4093 worker_context->CacheController()->ClientBecameVisible(); 4107 worker_context->CacheController()->ClientBecameVisible();
4094 } else { 4108 } else {
4095 worker_context->CacheController()->ClientBecameNotVisible( 4109 worker_context->CacheController()->ClientBecameNotVisible(
4096 std::move(worker_context_visibility_)); 4110 std::move(worker_context_visibility_));
4097 } 4111 }
4098 } 4112 }
4099 } 4113 }
4100 4114
4101 } // namespace cc 4115 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698