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

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 the nit. 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
« 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 b5493224ee1d7787ba6115ca5b03efa7afd284f1..873d71d679921f01ad0c76f5055b7be99f9faf9f 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -242,7 +242,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
frame_timing_tracker_(FrameTimingTracker::Create(this)) {
if (settings.use_compositor_animation_timelines) {
if (settings.accelerated_animation_enabled) {
- animation_host_ = AnimationHost::Create();
+ animation_host_ = AnimationHost::Create(ThreadInstance::IMPL);
animation_host_->SetMutatorHostClient(this);
animation_host_->SetSupportsScrollAnimations(
proxy_->SupportsImplScrolling());
@@ -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
« 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