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

Side by Side 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: CC_EXPORT for MutatorHostClient 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3433 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3434 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3434 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3435 for (; it != swap_promise_monitor_.end(); it++) 3435 for (; it != swap_promise_monitor_.end(); it++)
3436 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3436 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3437 } 3437 }
3438 3438
3439 void LayerTreeHostImpl::ScrollAnimationCreate( 3439 void LayerTreeHostImpl::ScrollAnimationCreate(
3440 LayerImpl* layer_impl, 3440 LayerImpl* layer_impl,
3441 const gfx::ScrollOffset& target_offset, 3441 const gfx::ScrollOffset& target_offset,
3442 const gfx::ScrollOffset& current_offset) { 3442 const gfx::ScrollOffset& current_offset) {
3443 if (animation_host_)
3444 return animation_host_->ImplOnlyScrollAnimationCreate(
3445 layer_impl->id(), target_offset, current_offset);
3446
3443 scoped_ptr<ScrollOffsetAnimationCurve> curve = 3447 scoped_ptr<ScrollOffsetAnimationCurve> curve =
3444 ScrollOffsetAnimationCurve::Create(target_offset, 3448 ScrollOffsetAnimationCurve::Create(target_offset,
3445 EaseInOutTimingFunction::Create()); 3449 EaseInOutTimingFunction::Create());
3446 curve->SetInitialValue(current_offset); 3450 curve->SetInitialValue(current_offset);
3447 3451
3448 scoped_ptr<Animation> animation = Animation::Create( 3452 scoped_ptr<Animation> animation = Animation::Create(
3449 curve.Pass(), AnimationIdProvider::NextAnimationId(), 3453 curve.Pass(), AnimationIdProvider::NextAnimationId(),
3450 AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET); 3454 AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
3451 animation->set_is_impl_only(true); 3455 animation->set_is_impl_only(true);
3452 3456
3453 layer_impl->layer_animation_controller()->AddAnimation(animation.Pass()); 3457 layer_impl->layer_animation_controller()->AddAnimation(animation.Pass());
3454 } 3458 }
3455 3459
3456 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget( 3460 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
3457 LayerImpl* layer_impl, 3461 LayerImpl* layer_impl,
3458 const gfx::Vector2dF& scroll_delta) { 3462 const gfx::Vector2dF& scroll_delta) {
3463 if (animation_host_)
3464 return animation_host_->ImplOnlyScrollAnimationUpdateTarget(
3465 layer_impl->id(), scroll_delta, layer_impl->MaxScrollOffset(),
3466 CurrentBeginFrameArgs().frame_time);
3467
3459 Animation* animation = 3468 Animation* animation =
3460 layer_impl->layer_animation_controller() 3469 layer_impl->layer_animation_controller()
3461 ? layer_impl->layer_animation_controller()->GetAnimation( 3470 ? layer_impl->layer_animation_controller()->GetAnimation(
3462 Animation::SCROLL_OFFSET) 3471 Animation::SCROLL_OFFSET)
3463 : nullptr; 3472 : nullptr;
3464 if (!animation) 3473 if (!animation)
3465 return false; 3474 return false;
3466 3475
3467 ScrollOffsetAnimationCurve* curve = 3476 ScrollOffsetAnimationCurve* curve =
3468 animation->curve()->ToScrollOffsetAnimationCurve(); 3477 animation->curve()->ToScrollOffsetAnimationCurve();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3585 LayerTreeType tree_type, 3594 LayerTreeType tree_type,
3586 const gfx::ScrollOffset& scroll_offset) { 3595 const gfx::ScrollOffset& scroll_offset) {
3587 if (tree_type == LayerTreeType::ACTIVE) { 3596 if (tree_type == LayerTreeType::ACTIVE) {
3588 SetTreeLayerScrollOffsetMutated(layer_id, active_tree(), scroll_offset); 3597 SetTreeLayerScrollOffsetMutated(layer_id, active_tree(), scroll_offset);
3589 } else { 3598 } else {
3590 SetTreeLayerScrollOffsetMutated(layer_id, pending_tree(), scroll_offset); 3599 SetTreeLayerScrollOffsetMutated(layer_id, pending_tree(), scroll_offset);
3591 SetTreeLayerScrollOffsetMutated(layer_id, recycle_tree(), scroll_offset); 3600 SetTreeLayerScrollOffsetMutated(layer_id, recycle_tree(), scroll_offset);
3592 } 3601 }
3593 } 3602 }
3594 3603
3604 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
3605 ScrollEnd();
3606 }
3607
3608 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
3609 int layer_id) const {
3610 if (active_tree()) {
3611 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
3612 if (layer)
3613 return layer->ScrollOffsetForAnimation();
3614 }
3615
3616 return gfx::ScrollOffset();
3617 }
3618
3595 } // namespace cc 3619 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698