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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: Disable touch on mac Created 3 years, 6 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 3e781b39b5701f7e6e04ea8a14a629e3d36b1102..2894197ee3b730b029b0017d64b8d259ee798aa8 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3055,6 +3055,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()));
bokan 2017/06/30 15:44:11 nit: no need for outer parentheses
sunyunjia 2017/06/30 18:26:57 Done.
if (scroll_node) {
// Flash the overlay scrollbar even if the scroll dalta is 0.
@@ -3134,6 +3135,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);
@@ -3369,6 +3378,12 @@ void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
viewport()->MainScrollLayer()
? scroll_tree.Node(viewport()->MainScrollLayer()->scroll_tree_index())
: nullptr;
+ bool x_dominated =
+ (std::abs(scroll_state->delta_x()) > std::abs(scroll_state->delta_y()));
bokan 2017/06/30 15:44:11 ditto
sunyunjia 2017/06/30 18:26:58 Done.
+ if (scroll_state->is_beginning()) {
+ x_dominated = (std::abs(scroll_state->delta_x_hint()) >
+ std::abs(scroll_state->delta_y_hint()));
+ }
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?
@@ -3383,11 +3398,17 @@ void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
break;
}
- if (!scroll_node->scrollable)
- continue;
-
- if (CanConsumeDelta(scroll_node, *scroll_state))
+ if (scroll_node->scrollable &&
+ CanConsumeDelta(scroll_node, *scroll_state))
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;
}
}
active_tree_->SetCurrentlyScrollingNode(

Powered by Google App Engine
This is Rietveld 408576698