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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2382913003: Revert of Fix scroll chaining for non-descendants of root scroller. (Closed)
Patch Set: Created 4 years, 3 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 1b1d8e16815dfe6ba4f5d3adccb580087298dee9..ab28b3454c5a1a1f5c7e6f45047e61167d1ade96 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2567,14 +2567,15 @@
}
}
- // The outer viewport layer represents the viewport.
- if (potentially_scrolling_layer_impl == InnerViewportScrollLayer())
- potentially_scrolling_layer_impl = OuterViewportScrollLayer();
-
// Falling back to the root scroll layer ensures generation of root overscroll
- // notifications.
+ // notifications. The inner viewport layer represents the viewport during
+ // scrolling.
if (!potentially_scrolling_layer_impl)
- potentially_scrolling_layer_impl = OuterViewportScrollLayer();
+ potentially_scrolling_layer_impl = InnerViewportScrollLayer();
+
+ // The inner viewport layer represents the viewport.
+ if (potentially_scrolling_layer_impl == OuterViewportScrollLayer())
+ potentially_scrolling_layer_impl = InnerViewportScrollLayer();
if (potentially_scrolling_layer_impl) {
// Ensure that final layer scrolls on impl thread (crbug.com/625100)
@@ -2847,18 +2848,19 @@
if (scroll_node) {
for (; scroll_tree.parent(scroll_node);
scroll_node = scroll_tree.parent(scroll_node)) {
- if (!scroll_node->scrollable)
+ if (!scroll_node->scrollable ||
+ scroll_node->is_outer_viewport_scroll_layer)
continue;
- if (scroll_node->is_outer_viewport_scroll_layer ||
- scroll_node->is_inner_viewport_scroll_layer) {
+ if (scroll_node->is_inner_viewport_scroll_layer) {
gfx::Vector2dF scrolled =
viewport()->ScrollAnimated(pending_delta, delayed_by);
// Viewport::ScrollAnimated returns pending_delta as long as it
// starts an animation.
if (scrolled == pending_delta)
return scroll_status;
- break;
+ pending_delta -= scrolled;
+ continue;
}
gfx::Vector2dF scroll_delta =
@@ -3001,7 +3003,7 @@
// details.
const float kEpsilon = 0.1f;
- if (scroll_node->is_outer_viewport_scroll_layer) {
+ if (scroll_node->is_inner_viewport_scroll_layer) {
bool affect_top_controls = !wheel_scrolling_;
Viewport::ScrollResult result = viewport()->ScrollBy(
delta, viewport_point, scroll_state->is_direct_manipulation(),
@@ -3022,7 +3024,7 @@
bool scrolled = std::abs(applied_delta.x()) > kEpsilon;
scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon;
- if (scrolled && !scroll_node->is_outer_viewport_scroll_layer) {
+ if (scrolled && !scroll_node->is_inner_viewport_scroll_layer) {
// If the applied delta is within 45 degrees of the input
// delta, bail out to make it easier to scroll just one layer
// in one direction without affecting any of its parents.
@@ -3059,9 +3061,11 @@
scroll_node = scroll_tree.parent(scroll_node)) {
if (scroll_node->is_outer_viewport_scroll_layer) {
// Don't chain scrolls past the outer viewport scroll layer. Once we
- // reach that, we're viewport scrolling which is special and handled by
- // cc's Viewport class.
- current_scroll_chain.push_front(scroll_node);
+ // reach that, we should scroll the viewport, which is represented by
+ // the inner viewport scroll layer.
+ ScrollNode* inner_viewport_scroll_node =
+ scroll_tree.Node(InnerViewportScrollLayer()->scroll_tree_index());
+ current_scroll_chain.push_front(inner_viewport_scroll_node);
break;
}
@@ -3235,6 +3239,8 @@
LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint(
device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl,
&scroll_on_main_thread, &main_thread_scrolling_reasons);
+ if (scroll_layer_impl == InnerViewportScrollLayer())
+ scroll_layer_impl = OuterViewportScrollLayer();
if (scroll_on_main_thread || !scroll_layer_impl)
return;
@@ -3282,7 +3288,7 @@
client_->RenewTreePriority();
pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer();
active_tree_->SetCurrentlyScrollingLayer(
- active_tree_->OuterViewportScrollLayer());
+ active_tree_->InnerViewportScrollLayer());
top_controls_manager_->PinchBegin();
}
« 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