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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1009233002: CC Animations: Port Impl-only-scrolling to use compositor animation timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui
Patch Set: Fix code review issues. Created 5 years, 5 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 d4030045d152c8e58e7158f0a6782c1634c591fa..873d71d679921f01ad0c76f5055b7be99f9faf9f 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3440,6 +3440,10 @@ void LayerTreeHostImpl::ScrollAnimationCreate(
LayerImpl* layer_impl,
const gfx::ScrollOffset& target_offset,
const gfx::ScrollOffset& current_offset) {
+ if (animation_host_)
+ return animation_host_->ImplOnlyScrollAnimationCreate(
+ layer_impl->id(), target_offset, current_offset);
+
scoped_ptr<ScrollOffsetAnimationCurve> curve =
ScrollOffsetAnimationCurve::Create(target_offset,
EaseInOutTimingFunction::Create());
@@ -3456,6 +3460,11 @@ void LayerTreeHostImpl::ScrollAnimationCreate(
bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
LayerImpl* layer_impl,
const gfx::Vector2dF& scroll_delta) {
+ if (animation_host_)
+ return animation_host_->ImplOnlyScrollAnimationUpdateTarget(
+ layer_impl->id(), scroll_delta, layer_impl->MaxScrollOffset(),
+ CurrentBeginFrameArgs().frame_time);
+
Animation* animation =
layer_impl->layer_animation_controller()
? layer_impl->layer_animation_controller()->GetAnimation(
@@ -3592,4 +3601,19 @@ void LayerTreeHostImpl::SetLayerScrollOffsetMutated(
}
}
+void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
+ ScrollEnd();
+}
+
+gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
+ int layer_id) const {
+ if (active_tree()) {
+ LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
+ if (layer)
+ return layer->ScrollOffsetForAnimation();
+ }
+
+ return gfx::ScrollOffset();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698