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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 2758343002: cc: Use Element Id to Record Animation Changes (Closed)
Patch Set: fix for test Created 3 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
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 8b0976ddfaa674473b8921f232d0eea4036e938f..1d38bf87e707def7b4eefc90a47948e524fb844c 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -1311,9 +1311,79 @@ void LayerTreeHost::ElementIsAnimatingChanged(
ElementListType list_type,
const PropertyAnimationState& mask,
const PropertyAnimationState& state) {
- Layer* layer = LayerByElementId(element_id);
- if (layer)
- layer->OnIsAnimatingChanged(mask, state);
+ // TODO(weiliangc): Most of the code is duplicated with LayerTeeHostImpl
+ // version of function. Should try to share code.
+ DCHECK_EQ(ElementListType::ACTIVE, list_type);
+
+ for (int property = TargetProperty::FIRST_TARGET_PROPERTY;
+ property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) {
+ if (!mask.currently_running[property] &&
+ !mask.potentially_animating[property])
+ continue;
+
+ switch (property) {
+ case TargetProperty::TRANSFORM:
+ if (TransformNode* transform_node =
+ property_trees()->transform_tree.FindNodeFromElementId(
+ element_id)) {
+ if (mask.currently_running[property])
+ transform_node->is_currently_animating =
+ state.currently_running[property];
+ if (mask.potentially_animating[property]) {
+ transform_node->has_potential_animation =
+ state.potentially_animating[property];
+ transform_node->has_only_translation_animations =
+ mutator_host()->HasOnlyTranslationTransforms(element_id,
+ list_type);
+ property_trees()->transform_tree.set_needs_update(true);
+ }
+ } else {
+ if (state.currently_running[property] ||
+ state.potentially_animating[property])
+ DCHECK(property_trees()->needs_rebuild)
+ << "Attempting to animate non existent transform node";
+ }
+ break;
+ case TargetProperty::OPACITY:
+ if (EffectNode* effect_node =
+ property_trees()->effect_tree.FindNodeFromElementId(
+ element_id)) {
+ if (mask.currently_running[property])
+ effect_node->is_currently_animating_opacity =
+ state.currently_running[property];
+ if (mask.potentially_animating[property]) {
+ effect_node->has_potential_opacity_animation =
+ state.potentially_animating[property];
+ property_trees()->effect_tree.set_needs_update(true);
+ }
+ } else {
+ if (state.currently_running[property] ||
+ state.potentially_animating[property])
+ DCHECK(property_trees()->needs_rebuild)
+ << "Attempting to animate opacity on non existent effect node";
+ }
+ break;
+ case TargetProperty::FILTER:
+ if (EffectNode* effect_node =
+ property_trees()->effect_tree.FindNodeFromElementId(
+ element_id)) {
+ if (mask.currently_running[property])
+ effect_node->is_currently_animating_filter =
+ state.currently_running[property];
+ if (mask.potentially_animating[property])
+ effect_node->has_potential_filter_animation =
+ state.potentially_animating[property];
+ } else {
+ if (state.currently_running[property] ||
+ state.potentially_animating[property])
+ DCHECK(property_trees()->needs_rebuild)
+ << "Attempting to animate filter on non existent effect node";
+ }
+ break;
+ default:
+ break;
+ }
+ }
}
gfx::ScrollOffset LayerTreeHost::GetScrollOffsetForAnimation(
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698