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 f9076fb9be87def8080895959ff2be042118032b..5bc1fc618cad8b8d5ba01f504b278e7f6665c04b 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -2009,15 +2009,6 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
potentially_scrolling_layer_impl = scroll_layer_impl; |
} |
- // When hiding top controls is enabled and the controls are hidden or |
- // overlaying the content, force scrolls to be enabled on the root layer to |
- // allow bringing the top controls back into view. |
- if (!potentially_scrolling_layer_impl && top_controls_manager_ && |
- top_controls_manager_->content_top_offset() != |
- settings_.top_controls_height) { |
- potentially_scrolling_layer_impl = RootScrollLayer(); |
- } |
- |
return potentially_scrolling_layer_impl; |
} |
@@ -2049,8 +2040,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
return ScrollOnMainThread; |
} |
- // If we want to send a DidOverscroll for this scroll it can't be ignored. |
- if (!potentially_scrolling_layer_impl && settings_.always_overscroll) |
+ if (!potentially_scrolling_layer_impl) |
potentially_scrolling_layer_impl = RootScrollLayer(); |
if (potentially_scrolling_layer_impl) { |
@@ -2158,8 +2148,19 @@ bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point, |
gfx::Vector2dF unused_root_delta; |
bool did_scroll_x = false; |
bool did_scroll_y = false; |
- bool consume_by_top_controls = top_controls_manager_ && |
- (CurrentlyScrollingLayer() == RootScrollLayer() || scroll_delta.y() < 0); |
+ bool consume_by_top_controls = false; |
+ if (top_controls_manager_) { |
+ gfx::PointF screen_space_point = |
+ gfx::ScalePoint(viewport_point, device_scale_factor_); |
aelias_OOO_until_Jul13
2013/12/26 20:38:00
This would be incorrect when the transformation is
jdduke (slow)
2014/01/09 20:37:29
What if we simply use the |max_scroll_offset()|?
|
+ bool root_layer_gesture_scroll_active_and_possible = |
+ CurrentlyScrollingLayer() == RootScrollLayer() && |
+ RootScrollLayer()->TryScroll(screen_space_point, Gesture) |
+ != ScrollIgnored; |
+ // Showing the top controls should always be possible, while hiding them |
+ // should be possible only if the root layer can be scrolled. |
+ consume_by_top_controls = |
+ (scroll_delta.y() < 0 || root_layer_gesture_scroll_active_and_possible); |
+ } |
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
layer_impl; |
@@ -2170,7 +2171,7 @@ bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point, |
if (layer_impl == RootScrollLayer()) { |
// 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()) { |
+ if (consume_by_top_controls) { |
pending_delta = top_controls_manager_->ScrollBy(pending_delta); |
UpdateMaxScrollOffset(); |
} |