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

Unified Diff: cc/trees/layer_tree_host_impl.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/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index d9f1a22aefd1c60effdaa1f527280a69a8ceda65..a4745800fc0d7c283d2add4f62fe5c0322fb3d95 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -72,6 +72,7 @@
#include "cc/trees/damage_tracker.h"
#include "cc/trees/debug_rect_history.h"
#include "cc/trees/draw_property_utils.h"
+#include "cc/trees/effect_node.h"
#include "cc/trees/frame_rate_counter.h"
#include "cc/trees/latency_info_swap_promise_monitor.h"
#include "cc/trees/layer_tree_host_common.h"
@@ -79,6 +80,7 @@
#include "cc/trees/mutator_host.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/single_thread_proxy.h"
+#include "cc/trees/transform_node.h"
#include "cc/trees/tree_synchronizer.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/context_support.h"
@@ -2041,10 +2043,10 @@ void LayerTreeHostImpl::ActivateSyncTree() {
else
active_tree_->MoveChangeTrackingToLayers();
}
+ TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree());
active_tree_->property_trees()->PushOpacityIfNeeded(
pending_tree_->property_trees());
- TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree());
pending_tree_->PushPropertiesTo(active_tree_.get());
if (!pending_tree_->LayerListIsEmpty())
pending_tree_->property_trees()->ResetAllChangeTracking();
@@ -4120,13 +4122,75 @@ void LayerTreeHostImpl::ElementIsAnimatingChanged(
ElementListType list_type,
const PropertyAnimationState& mask,
const PropertyAnimationState& state) {
+ // TODO(weiliangc): Most of the code is duplicated with LayerTeeHost version
+ // of function. Should try to share code.
LayerTreeImpl* tree =
list_type == ElementListType::ACTIVE ? active_tree() : pending_tree();
if (!tree)
return;
- LayerImpl* layer = tree->LayerByElementId(element_id);
- if (layer)
- layer->OnIsAnimatingChanged(mask, state);
+ PropertyTrees* property_trees = tree->property_trees();
+
+ 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);
+ tree->set_needs_update_draw_properties();
+ // TODO(crbug.com/702777):
+ // was_ever_ready_since_last_transform_animation should not live on
+ // layers.
+ if (LayerImpl* layer = tree->LayerByElementId(element_id)) {
+ layer->set_was_ever_ready_since_last_transform_animation(false);
+ }
+ }
+ }
+ 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);
+ }
+ }
+ 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];
+ // Filter animation changes only the node, and the subtree does not
+ // care. There is no need to request update on property trees here.
+ }
+ break;
+ default:
+ break;
+ }
+ }
}
void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698