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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2040543002: Take MT jank into account when animating the scroll offset on CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test + apply suggested improvement 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/trees/layer_tree_host_impl.h ('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 57ea8fdc8f942d4a3c061aa1244abc01fa39fb44..9c5737e9611b6607d1be2440d10bd23579d7fce6 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2747,7 +2747,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimatedBegin(
if (scroll_node) {
gfx::Vector2dF delta;
- if (ScrollAnimationUpdateTarget(scroll_node, delta)) {
+ if (ScrollAnimationUpdateTarget(scroll_node, delta, base::TimeDelta())) {
scroll_status.thread = SCROLL_ON_IMPL_THREAD;
} else {
scroll_status.thread = SCROLL_IGNORED;
@@ -2803,7 +2803,8 @@ gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta(
}
bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
- const gfx::Vector2dF& delta) {
+ const gfx::Vector2dF& delta,
+ base::TimeDelta delayed_by) {
ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
const float kEpsilon = 0.1f;
@@ -2824,8 +2825,8 @@ bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
ElementId(active_tree()->LayerById(scroll_node->owner_id)->element_id()),
scroll_node->element_id);
- animation_host_->ImplOnlyScrollAnimationCreate(scroll_node->element_id,
- target_offset, current_offset);
+ animation_host_->ImplOnlyScrollAnimationCreate(
+ scroll_node->element_id, target_offset, current_offset, delayed_by);
SetNeedsOneBeginImplFrame();
@@ -2834,7 +2835,8 @@ bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
const gfx::Point& viewport_point,
- const gfx::Vector2dF& scroll_delta) {
+ const gfx::Vector2dF& scroll_delta,
+ base::TimeDelta delayed_by) {
InputHandler::ScrollStatus scroll_status;
scroll_status.main_thread_scrolling_reasons =
MainThreadScrollingReason::kNotScrollingOnMain;
@@ -2847,7 +2849,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
if (!scroll_node->user_scrollable_vertical)
delta.set_y(0);
- if (ScrollAnimationUpdateTarget(scroll_node, delta)) {
+ if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) {
scroll_status.thread = SCROLL_ON_IMPL_THREAD;
} else {
scroll_status.thread = SCROLL_IGNORED;
@@ -2878,7 +2880,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
continue;
if (scroll_node->is_inner_viewport_scroll_layer) {
- gfx::Vector2dF scrolled = viewport()->ScrollAnimated(pending_delta);
+ 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)
@@ -2889,7 +2892,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
gfx::Vector2dF scroll_delta =
ComputeScrollDelta(scroll_node, pending_delta);
- if (ScrollAnimationCreate(scroll_node, scroll_delta))
+ if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by))
return scroll_status;
pending_delta -= scroll_delta;
@@ -3910,7 +3913,8 @@ void LayerTreeHostImpl::ScrollAnimationAbort(LayerImpl* layer_impl) {
bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
ScrollNode* scroll_node,
- const gfx::Vector2dF& scroll_delta) {
+ const gfx::Vector2dF& scroll_delta,
+ base::TimeDelta delayed_by) {
DCHECK_EQ(
ElementId(active_tree()->LayerById(scroll_node->owner_id)->element_id()),
scroll_node->element_id);
@@ -3919,7 +3923,7 @@ bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
scroll_node->element_id, scroll_delta,
active_tree_->property_trees()->scroll_tree.MaxScrollOffset(
scroll_node->id),
- CurrentBeginFrameArgs().frame_time);
+ CurrentBeginFrameArgs().frame_time, delayed_by);
}
bool LayerTreeHostImpl::IsElementInList(ElementId element_id,
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698