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

Unified Diff: cc/layers/layer_impl.cc

Issue 1010663002: CC Animations: Redirect all compositor animation requests to AnimationHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@introduce
Patch Set: Rebase and fix conflicts (HasPotentiallyRunningTransformAnimation) Created 5 years, 8 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/layers/layer_impl.h ('k') | cc/layers/layer_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index c47e50cfa46c6e9a75a69743dc19619456566201..aeb1c6fbff34691213f62cdd554103d7042a2848 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -85,13 +85,16 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
DCHECK_GT(layer_id_, 0);
DCHECK(layer_tree_impl_);
layer_tree_impl_->RegisterLayer(this);
- AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar();
- layer_animation_controller_ =
- registrar->GetAnimationControllerForId(layer_id_);
- layer_animation_controller_->AddValueObserver(this);
- if (IsActive()) {
- layer_animation_controller_->set_value_provider(this);
- layer_animation_controller_->set_layer_animation_delegate(this);
+
+ if (!layer_tree_impl_->settings().use_compositor_animation_timelines) {
+ AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar();
+ layer_animation_controller_ =
+ registrar->GetAnimationControllerForId(layer_id_);
+ layer_animation_controller_->AddValueObserver(this);
+ if (IsActive()) {
+ layer_animation_controller_->set_value_provider(this);
+ layer_animation_controller_->set_layer_animation_delegate(this);
+ }
}
SetNeedsPushProperties();
}
@@ -99,9 +102,11 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
LayerImpl::~LayerImpl() {
DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
- layer_animation_controller_->RemoveValueObserver(this);
- layer_animation_controller_->remove_value_provider(this);
- layer_animation_controller_->remove_layer_animation_delegate(this);
+ if (layer_animation_controller_) {
+ layer_animation_controller_->RemoveValueObserver(this);
+ layer_animation_controller_->remove_value_provider(this);
+ layer_animation_controller_->remove_layer_animation_delegate(this);
+ }
if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree())
layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this);
@@ -969,10 +974,16 @@ void LayerImpl::SetFilters(const FilterOperations& filters) {
}
bool LayerImpl::FilterIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER);
+ return layer_animation_controller_
+ ? layer_animation_controller_->IsAnimatingProperty(
+ Animation::FILTER)
+ : layer_tree_impl_->IsAnimatingFilterProperty(this);
}
bool LayerImpl::FilterIsAnimatingOnImplOnly() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this);
+
Animation* filter_animation =
layer_animation_controller_->GetAnimation(Animation::FILTER);
return filter_animation && filter_animation->is_impl_only();
@@ -1012,10 +1023,28 @@ void LayerImpl::SetOpacity(float opacity) {
}
bool LayerImpl::OpacityIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY);
+ return layer_animation_controller_
+ ? layer_animation_controller_->IsAnimatingProperty(
+ Animation::OPACITY)
+ : layer_tree_impl_->IsAnimatingOpacityProperty(this);
+}
+
+bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const {
+ if (layer_animation_controller_) {
+ if (Animation* animation =
+ layer_animation_controller()->GetAnimation(Animation::OPACITY)) {
+ return !animation->is_finished();
+ }
+ return false;
+ } else {
+ return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this);
+ }
}
bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this);
+
Animation* opacity_animation =
layer_animation_controller_->GetAnimation(Animation::OPACITY);
return opacity_animation && opacity_animation->is_impl_only();
@@ -1094,15 +1123,85 @@ void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform,
}
bool LayerImpl::TransformIsAnimating() const {
- return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM);
+ return layer_animation_controller_
+ ? layer_animation_controller_->IsAnimatingProperty(
+ Animation::TRANSFORM)
+ : layer_tree_impl_->IsAnimatingTransformProperty(this);
+}
+
+bool LayerImpl::HasPotentiallyRunningTransformAnimation() const {
+ if (layer_animation_controller_) {
+ if (Animation* animation =
+ layer_animation_controller()->GetAnimation(Animation::TRANSFORM)) {
+ return !animation->is_finished();
+ }
+ return false;
+ } else {
+ return layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this);
+ }
}
bool LayerImpl::TransformIsAnimatingOnImplOnly() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this);
+
Animation* transform_animation =
layer_animation_controller_->GetAnimation(Animation::TRANSFORM);
return transform_animation && transform_animation->is_impl_only();
}
+bool LayerImpl::HasOnlyTranslationTransforms() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->HasOnlyTranslationTransforms(this);
+
+ return layer_animation_controller_->HasOnlyTranslationTransforms();
+}
+
+bool LayerImpl::MaximumTargetScale(float* max_scale) const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->MaximumTargetScale(this, max_scale);
+
+ return layer_animation_controller_->MaximumTargetScale(max_scale);
+}
+
+bool LayerImpl::HasFilterAnimationThatInflatesBounds() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this);
+
+ return layer_animation_controller_->HasFilterAnimationThatInflatesBounds();
+}
+
+bool LayerImpl::HasTransformAnimationThatInflatesBounds() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this);
+
+ return layer_animation_controller_->HasTransformAnimationThatInflatesBounds();
+}
+
+bool LayerImpl::HasAnimationThatInflatesBounds() const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->HasAnimationThatInflatesBounds(this);
+
+ return layer_animation_controller_->HasAnimationThatInflatesBounds();
+}
+
+bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box,
+ gfx::BoxF* bounds) const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds);
+
+ return layer_animation_controller_->FilterAnimationBoundsForBox(box, bounds);
+}
+
+bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box,
+ gfx::BoxF* bounds) const {
+ if (!layer_animation_controller_)
+ return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds);
+
+ return layer_animation_controller_->TransformAnimationBoundsForBox(box,
+ bounds);
+}
+
void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) {
update_rect_ = update_rect;
SetNeedsPushProperties();
@@ -1547,7 +1646,9 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
state->SetBoolean(
"has_animation_bounds",
- layer_animation_controller()->HasAnimationThatInflatesBounds());
+ layer_animation_controller_
+ ? layer_animation_controller_->HasAnimationThatInflatesBounds()
+ : layer_tree_impl_->HasAnimationThatInflatesBounds(this));
gfx::BoxF box;
if (LayerUtils::GetAnimationBounds(*this, &box))
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698