Chromium Code Reviews| 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 86401a7dca992c469fca2e80606a9aeac99ff513..7343cb3475a3e8490a3933c9a6327fe9bff464b7 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -1446,6 +1446,16 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| active_tree_->GetViewportSelection(&metadata.selection_start, |
| &metadata.selection_end); |
| + LayerImpl* root_layer_for_overflow = OuterViewportScrollLayer() |
| + ? OuterViewportScrollLayer() |
| + : InnerViewportScrollLayer(); |
| + if (root_layer_for_overflow) { |
| + metadata.root_overflow_x_hidden = |
| + !root_layer_for_overflow->user_scrollable_horizontal(); |
| + metadata.root_overflow_y_hidden = |
| + !root_layer_for_overflow->user_scrollable_vertical(); |
| + } |
| + |
| if (!InnerViewportScrollLayer()) |
| return metadata; |
| @@ -2664,13 +2674,26 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
| unused_root_delta.set_x(0.0f); |
| if (std::abs(unused_root_delta.y()) < kEpsilon) |
| unused_root_delta.set_y(0.0f); |
| + |
| + // If there is unconsumed scroll after application to the viewport, and |
| + // the (outer) viewport layer is explicitly marked unscrollable, suppress |
| + // any overscroll, preventing bubbling to UI layers. |
| + const LayerImpl* layer_for_user_scrollable_testing = |
|
jdduke (slow)
2015/02/11 22:22:56
Oops, I'll go ahead and revert this change, it's n
|
| + OuterViewportScrollLayer() ? OuterViewportScrollLayer() : layer_impl; |
| + if (unused_root_delta.x() && |
| + !layer_for_user_scrollable_testing->user_scrollable_horizontal()) { |
| + unused_root_delta.set_x(0); |
| + } |
| + if (unused_root_delta.y() && |
| + !layer_for_user_scrollable_testing->user_scrollable_vertical()) { |
| + unused_root_delta.set_y(0); |
| + } |
| + |
| // Disable overscroll on axes which is impossible to scroll. |
| if (settings_.report_overscroll_only_for_scrollable_axes) { |
| - if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || |
| - !layer_impl->user_scrollable_horizontal()) |
| + if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon) |
| unused_root_delta.set_x(0.0f); |
| - if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || |
| - !layer_impl->user_scrollable_vertical()) |
| + if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon) |
| unused_root_delta.set_y(0.0f); |
| } |
| } |