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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: Use only gpuBenchmarking. Created 3 years, 7 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
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 613093e8041bef8ff4eaa4fe55d41e2a39de7da6..f79f47bdf085258bf53a319a915e99bc96d85178 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3012,6 +3012,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
MainThreadScrollingReason::kNotScrollingOnMain;
ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode();
+ bool x_dominated = (std::abs(scroll_delta.x()) > std::abs(scroll_delta.y()));
if (scroll_node) {
// Flash the overlay scrollbar even if the scroll dalta is 0.
@@ -3091,6 +3092,14 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
}
pending_delta -= scroll_delta;
+
+ if ((x_dominated &&
+ scroll_node->scroll_boundary_behavior.x !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) ||
+ (!x_dominated &&
+ scroll_node->scroll_boundary_behavior.y !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto))
+ break;
}
}
scroll_state.set_is_ending(true);
@@ -3298,6 +3307,8 @@ void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode();
ScrollNode* viewport_scroll_node = OuterViewportScrollNode();
+ bool x_dominated =
+ (std::abs(scroll_state->delta_x()) > std::abs(scroll_state->delta_y()));
if (scroll_node) {
// TODO(bokan): The loop checks for a null parent but don't we still want to
// distribute to the root scroll node?
@@ -3312,10 +3323,16 @@ void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
break;
}
- if (!scroll_node->scrollable)
- continue;
+ if (scroll_node->scrollable)
+ current_scroll_chain.push_front(scroll_node);
- current_scroll_chain.push_front(scroll_node);
+ if ((x_dominated &&
+ scroll_node->scroll_boundary_behavior.x !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) ||
+ (!x_dominated &&
+ scroll_node->scroll_boundary_behavior.y !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto))
+ break;
}
}
scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,

Powered by Google App Engine
This is Rietveld 408576698