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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove kEnableNewCompositorAnimations. Created 5 years, 9 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 2f46ab440fc1d6b41e37eb74926849f7f85e8177..b2dac073ef512dac80fe6d2aeddcbd9b42cad11a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -15,6 +15,7 @@
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/animation/animation_id_provider.h"
+#include "cc/animation/animation_timeline.h"
#include "cc/animation/scroll_offset_animation_curve.h"
#include "cc/animation/scrollbar_animation_controller.h"
#include "cc/animation/timing_function.h"
@@ -932,6 +933,18 @@ void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) {
viewport_damage_rect_.Union(damage_rect);
}
+void LayerTreeHostImpl::SetAnimationTimeline(
+ scoped_refptr<AnimationTimeline> timeline) {
+ if (animation_timeline_.get() == timeline.get())
+ return;
+
+ if (animation_timeline_.get())
+ animation_timeline_->SetLayerTreeMutatorsClient(nullptr);
+ animation_timeline_ = timeline;
+ if (animation_timeline_.get())
+ animation_timeline_->SetLayerTreeMutatorsClient(this);
+}
+
static inline RenderPass* FindRenderPassById(
RenderPassId render_pass_id,
const LayerTreeHostImpl::FrameData& frame) {
@@ -3473,4 +3486,89 @@ bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
return true;
}
+
+AnimationRegistrar* LayerTreeHostImpl::GetAnimationRegistrar() const {
+ return animation_registrar_.get();
+}
+
+bool LayerTreeHostImpl::IsLayerInActiveTree(int layer_id) const {
+ return active_tree() ? active_tree()->LayerById(layer_id) != nullptr : false;
+}
+
+bool LayerTreeHostImpl::IsLayerInPendingTree(int layer_id) const {
+ if (pending_tree() && pending_tree()->LayerById(layer_id))
+ return true;
+ if (recycle_tree() && recycle_tree()->LayerById(layer_id))
+ return true;
+
+ return false;
+}
+
+void LayerTreeHostImpl::SetMutatorsNeedCommit() {
+ SetNeedsCommit();
+}
+
+void LayerTreeHostImpl::SetTreeLayerFilterMutated(
+ int layer_id,
+ LayerTreeImpl* tree,
+ const FilterOperations& filters) {
+ LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
+ if (layer)
+ layer->OnFilterAnimated(filters);
+}
+
+void LayerTreeHostImpl::SetTreeLayerOpacityMutated(int layer_id,
+ LayerTreeImpl* tree,
+ float opacity) {
+ LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
+ if (layer)
+ layer->OnOpacityAnimated(opacity);
+}
+
+void LayerTreeHostImpl::SetTreeLayerTransformMutated(
+ int layer_id,
+ LayerTreeImpl* tree,
+ const gfx::Transform& transform) {
+ if (!tree)
+ return;
+
+ LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
+ if (layer)
+ layer->OnTransformAnimated(transform);
+}
+
+void LayerTreeHostImpl::SetLayerFilterMutated(int layer_id,
+ bool affects_active_tree,
+ const FilterOperations& filters) {
+ if (affects_active_tree) {
+ SetTreeLayerFilterMutated(layer_id, active_tree(), filters);
+ } else {
+ SetTreeLayerFilterMutated(layer_id, pending_tree(), filters);
+ SetTreeLayerFilterMutated(layer_id, recycle_tree(), filters);
+ }
+}
+
+void LayerTreeHostImpl::SetLayerOpacityMutated(int layer_id,
+ bool affects_active_tree,
+ float opacity) {
+ if (affects_active_tree) {
+ SetTreeLayerOpacityMutated(layer_id, active_tree(), opacity);
+ } else {
+ SetTreeLayerOpacityMutated(layer_id, pending_tree(), opacity);
+ SetTreeLayerOpacityMutated(layer_id, recycle_tree(), opacity);
+ }
+}
+
+void LayerTreeHostImpl::SetLayerTransformMutated(
+ int layer_id,
+ bool affects_active_tree,
+ const gfx::Transform& transform) {
+ if (affects_active_tree) {
+ SetTreeLayerTransformMutated(layer_id, active_tree(), transform);
+ } else {
+ SetTreeLayerTransformMutated(layer_id, pending_tree(), transform);
+ SetTreeLayerTransformMutated(layer_id, recycle_tree(), transform);
+ }
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698