Allow bubble scrolling that will result in the top controls becoming visible.
Helps on sites that enter fullscreen and have a large scrolling div
that makes it difficult to find the root layer to scroll on.
BUG=172638
R=aelias
Review URL: https://chromiumcodereview.appspot.com/12527013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190059 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ee98af3..d8127ef 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1513,11 +1513,8 @@
gfx::Vector2dF pending_delta = scroll_delta;
bool did_scroll = false;
-
- if (top_controls_manager_ && CurrentlyScrollingLayer() == RootScrollLayer()) {
- pending_delta = top_controls_manager_->ScrollBy(pending_delta);
- UpdateMaxScrollOffset();
- }
+ bool consume_by_top_controls = top_controls_manager_ &&
+ (CurrentlyScrollingLayer() == RootScrollLayer() || scroll_delta.y() < 0);
for (LayerImpl* layer_impl = CurrentlyScrollingLayer();
layer_impl;
@@ -1525,6 +1522,13 @@
if (!layer_impl->scrollable())
continue;
+ // Only allow bubble scrolling when the scroll is in the direction to make
+ // the top controls visible.
+ if (consume_by_top_controls && layer_impl == RootScrollLayer()) {
+ pending_delta = top_controls_manager_->ScrollBy(pending_delta);
+ UpdateMaxScrollOffset();
+ }
+
gfx::Vector2dF applied_delta;
// Gesture events need to be transformed from viewport coordinates to local
// layer coordinates so that the scrolling contents exactly follow the