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

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: Created 5 years, 10 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 a49c516fbfe0aa93bf76bf5736f794b19b32a5f8..b7b5f00d2f63fbfa9c54d3630b76da6da05d37ff 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"
@@ -926,6 +927,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) {
@@ -3480,4 +3493,75 @@ void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
(*it)->OnForwardScrollUpdateToMainThreadOnImpl();
}
+AnimationRegistrar* LayerTreeHostImpl::GetAnimationRegistrar() const {
+ return animation_registrar_.get();
+}
+
+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