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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 25629006: Suppress scrolls that begin on fixed-pos layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/trees/layer_tree_host_impl.h ('k') | content/renderer/gpu/input_handler_proxy.h » ('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 60272111685995e6722c2cc29f1a464fc224552f..e4e7f8dec1f203ffe5e16cdf51cfb4cf77e1d3a8 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1927,6 +1927,8 @@ void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) {
}
static LayerImpl* NextScrollLayer(LayerImpl* layer) {
+ if (layer->position_constraint().is_fixed_position())
+ return NULL;
if (LayerImpl* scroll_parent = layer->scroll_parent())
return scroll_parent;
return layer->parent();
@@ -1934,7 +1936,7 @@ static LayerImpl* NextScrollLayer(LayerImpl* layer) {
LayerImpl* LayerTreeHostImpl::FindScrollLayerForViewportPoint(
gfx::Point viewport_point, InputHandler::ScrollInputType type,
- bool* scroll_on_main_thread) {
+ bool* scroll_on_main_thread) const {
DCHECK(scroll_on_main_thread);
gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point,
@@ -1967,17 +1969,9 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForViewportPoint(
return NULL;
}
- if (status == ScrollStarted && !potentially_scrolling_layer_impl)
- 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();
+ if ((layer_impl == RootScrollLayer() || status == ScrollStarted) &&
+ !potentially_scrolling_layer_impl)
+ potentially_scrolling_layer_impl = scroll_layer_impl;
}
return potentially_scrolling_layer_impl;
@@ -2006,10 +2000,6 @@ 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)
- potentially_scrolling_layer_impl = RootScrollLayer();
-
if (potentially_scrolling_layer_impl) {
active_tree_->SetCurrentlyScrollingLayer(
potentially_scrolling_layer_impl);
@@ -2122,8 +2112,12 @@ bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point,
for (LayerImpl* layer_impl = CurrentlyScrollingLayer();
layer_impl;
layer_impl = layer_impl->parent()) {
- if (!layer_impl->scrollable())
+ if (!layer_impl->scrollable()) {
+ if (layer_impl->position_constraint().is_fixed_position()) {
+ break;
+ }
continue;
+ }
if (layer_impl == RootScrollLayer()) {
// Only allow bubble scrolling when the scroll is in the direction to make
@@ -2158,10 +2152,13 @@ bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point,
did_scroll_x |= did_move_layer_x;
did_scroll_y |= did_move_layer_y;
if (!did_move_layer_x && !did_move_layer_y) {
- if (should_bubble_scrolls_ || !did_lock_scrolling_layer_)
+ if (layer_impl->position_constraint().is_fixed_position())
+ break;
+ if (should_bubble_scrolls_ || !did_lock_scrolling_layer_) {
continue;
- else
+ } else {
break;
+ }
}
if (layer_impl == RootScrollLayer())
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | content/renderer/gpu/input_handler_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698