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

Unified Diff: cc/layers/layer.cc

Issue 2130053002: cc: Clean up Layer and LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_minor_layer_cleanup
Patch Set: Rebase Created 4 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/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 30c110e7311dc2320a9ee285f6c7d50ecc5f2094..e36d7456dfc3b9422d2c54d5677184adea0bff59 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -162,7 +162,8 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
inputs_.replica_layer->SetLayerTreeHost(host);
const bool has_any_animation =
- layer_tree_host_ ? layer_tree_host_->HasAnyAnimation(this) : false;
+ layer_tree_host_ ? GetAnimationHost()->HasAnyAnimation(element_id())
+ : false;
if (host && has_any_animation)
host->SetNeedsCommit();
@@ -465,15 +466,6 @@ void Layer::SetFilters(const FilterOperations& filters) {
SetNeedsCommit();
}
-bool Layer::FilterIsAnimating() const {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->IsAnimatingFilterProperty(this);
-}
-
-bool Layer::HasPotentiallyRunningFilterAnimation() const {
- return layer_tree_host_->HasPotentiallyRunningFilterAnimation(this);
-}
-
void Layer::SetBackgroundFilters(const FilterOperations& filters) {
DCHECK(IsPropertyChangeAllowed());
if (inputs_.background_filters == filters)
@@ -515,15 +507,6 @@ float Layer::EffectiveOpacity() const {
return inputs_.hide_layer_and_subtree ? 0.f : inputs_.opacity;
}
-bool Layer::OpacityIsAnimating() const {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->IsAnimatingOpacityProperty(this);
-}
-
-bool Layer::HasPotentiallyRunningOpacityAnimation() const {
- return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this);
-}
-
bool Layer::OpacityCanAnimateOnImplThread() const {
return false;
}
@@ -717,40 +700,13 @@ void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) {
SetNeedsCommit();
}
-bool Layer::AnimationsPreserveAxisAlignment() const {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->AnimationsPreserveAxisAlignment(this);
-}
-
-bool Layer::TransformIsAnimating() const {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->IsAnimatingTransformProperty(this);
-}
-
-bool Layer::HasPotentiallyRunningTransformAnimation() const {
- return layer_tree_host_->HasPotentiallyRunningTransformAnimation(this);
+bool Layer::ScrollOffsetAnimationWasInterrupted() const {
+ return GetAnimationHost()->ScrollOffsetAnimationWasInterrupted(element_id());
}
bool Layer::HasOnlyTranslationTransforms() const {
- return layer_tree_host_->HasOnlyTranslationTransforms(this);
-}
-
-bool Layer::MaximumTargetScale(float* max_scale) const {
- return layer_tree_host_->MaximumTargetScale(this, max_scale);
-}
-
-bool Layer::AnimationStartScale(float* start_scale) const {
- return layer_tree_host_->AnimationStartScale(this, start_scale);
-}
-
-bool Layer::HasAnyAnimationTargetingProperty(
- TargetProperty::Type property) const {
- return layer_tree_host_->HasAnyAnimationTargetingProperty(this, property);
-}
-
-bool Layer::ScrollOffsetAnimationWasInterrupted() const {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->ScrollOffsetAnimationWasInterrupted(this);
+ return GetAnimationHost()->HasOnlyTranslationTransforms(
+ element_id(), GetElementTypeForAnimation());
}
void Layer::SetScrollParent(Layer* parent) {
@@ -1637,6 +1593,16 @@ void Layer::SetLayerPropertyChanged() {
SetNeedsPushProperties();
}
+bool Layer::FilterIsAnimating() const {
+ return GetAnimationHost()->IsAnimatingFilterProperty(
+ element_id(), GetElementTypeForAnimation());
+}
+
+bool Layer::TransformIsAnimating() const {
+ return GetAnimationHost()->IsAnimatingTransformProperty(
+ element_id(), GetElementTypeForAnimation());
+}
+
gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const {
return CurrentScrollOffset();
}
@@ -1761,8 +1727,9 @@ void Layer::OnOpacityIsPotentiallyAnimatingChanged(
}
bool Layer::HasActiveAnimationForTesting() const {
- return layer_tree_host_ ? layer_tree_host_->HasActiveAnimationForTesting(this)
- : false;
+ return layer_tree_host_
+ ? GetAnimationHost()->HasActiveAnimationForTesting(element_id())
+ : false;
}
void Layer::SetHasWillChangeTransformHint(bool has_will_change) {
@@ -1772,12 +1739,16 @@ void Layer::SetHasWillChangeTransformHint(bool has_will_change) {
SetNeedsCommit();
}
-ScrollbarLayerInterface* Layer::ToScrollbarLayer() {
- return nullptr;
+AnimationHost* Layer::GetAnimationHost() const {
+ return layer_tree_host_ ? layer_tree_host_->animation_host() : nullptr;
+}
+
+ElementListType Layer::GetElementTypeForAnimation() const {
+ return ElementListType::ACTIVE;
}
-RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const {
- return layer_tree_host_->rendering_stats_instrumentation();
+ScrollbarLayerInterface* Layer::ToScrollbarLayer() {
+ return nullptr;
}
void Layer::RemoveFromScrollTree() {
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698