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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: update the tests 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..9a96ea2bfad674b8f7603afbee704627df059a2f 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());
majidvp 2017/07/05 21:30:03 nit: x_dominant is more appropriate. Also we shoul
sunyunjia 2017/07/14 02:59:00 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;
majidvp 2017/07/05 21:30:03 Please move this to its own function e.g., CanBubb
sunyunjia 2017/07/14 02:59:00 Done.
}
}
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());
+ 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);
majidvp 2017/07/05 21:30:03 Do I understand this correctly that the reason the
sunyunjia 2017/07/14 02:59:00 Done.
+
+ if ((x_dominated &&
+ scroll_node->scroll_boundary_behavior.x !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) ||
+ (!x_dominated &&
+ scroll_node->scroll_boundary_behavior.y !=
+ ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto))
+ break;
majidvp 2017/07/05 21:30:03 ditto. This should be a function called from both
sunyunjia 2017/07/14 02:59:00 Done.
}
}
active_tree_->SetCurrentlyScrollingNode(

Powered by Google App Engine
This is Rietveld 408576698