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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1418493003: Let LayerTreeHostImpl::ScrollAnimated scroll the outer viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/layers/layer_impl.cc ('k') | 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 2449788df4e23896abf10b90806008792ad85054..a245975db1f20bbe738e63786e40bde546ffed5c 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2396,6 +2396,14 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
if (potentially_scrolling_layer_impl == OuterViewportScrollLayer())
potentially_scrolling_layer_impl = InnerViewportScrollLayer();
+ // Animated wheel scrolls need to scroll the outer viewport layer, and do not
+ // go through Viewport::ScrollBy which would normally handle the distribution.
+ // NOTE: This will need refactoring if we want smooth scrolling on Android.
+ if (type == ANIMATED_WHEEL &&
+ potentially_scrolling_layer_impl == InnerViewportScrollLayer()) {
+ potentially_scrolling_layer_impl = OuterViewportScrollLayer();
ymalik 2015/10/19 22:36:54 Instead of adding a new ScrollInputType, I wonder
+ }
+
return potentially_scrolling_layer_impl;
}
@@ -2419,7 +2427,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
top_controls_manager_->ScrollBegin();
active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
- wheel_scrolling_ = (type == WHEEL);
+ wheel_scrolling_ = (type == WHEEL || type == ANIMATED_WHEEL);
client_->RenewTreePriority();
UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
return SCROLL_STARTED;
@@ -2480,13 +2488,13 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
// ScrollAnimated is only used for wheel scrolls. We use the same bubbling
// behavior as ScrollBy to determine which layer to animate, but we do not
// do the Android-specific things in ScrollBy like showing top controls.
- InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, WHEEL);
+ InputHandler::ScrollStatus scroll_status =
+ ScrollBegin(viewport_point, ANIMATED_WHEEL);
if (scroll_status == SCROLL_STARTED) {
gfx::Vector2dF pending_delta = scroll_delta;
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
layer_impl = NextLayerInScrollOrder(layer_impl)) {
- // The inner viewport layer represents the viewport.
- if (!layer_impl->scrollable() || layer_impl == OuterViewportScrollLayer())
+ if (!layer_impl->scrollable())
continue;
gfx::ScrollOffset current_offset = layer_impl->CurrentScrollOffset();
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698