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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1987123002: cc : Track transform animation changes on transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 77b1c68ecfdbc6706f62c28daa671f52dcecd8b2..b060d4d48e1cf1cb316ac80a2805e982100fdbf3 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9750,6 +9750,69 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) {
EXPECT_FALSE(node->data.has_potential_opacity_animation);
}
+TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) {
+ const gfx::Transform identity_matrix;
+ scoped_refptr<Layer> root = Layer::Create();
+ scoped_refptr<LayerWithForcedDrawsContent> animated =
+ make_scoped_refptr(new LayerWithForcedDrawsContent());
+ root->AddChild(animated);
+
+ host()->SetRootLayer(root);
+
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(100, 100), true, false);
+ SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(20, 20), true, false);
+
+ root->SetForceRenderSurfaceForTesting(true);
+
+ scoped_refptr<AnimationPlayer> player =
+ AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
+ timeline()->AttachPlayer(player);
+ player->AttachElement(animated->id());
+
+ std::unique_ptr<KeyframedTransformAnimationCurve> curve(
+ KeyframedTransformAnimationCurve::Create());
+ TransformOperations start;
+ start.AppendTranslate(1.f, 2.f, 3.f);
+ gfx::Transform transform;
+ transform.Scale3d(1.0, 2.0, 3.0);
+ TransformOperations operation;
+ operation.AppendMatrix(transform);
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
+ curve->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
+ std::unique_ptr<Animation> animation(
+ Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
+ animation->set_fill_mode(Animation::FillMode::NONE);
+ animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
+ Animation* animation_ptr = animation.get();
+ AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(),
+ std::move(animation));
+
+ ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
+
+ TransformTree& tree =
+ root->layer_tree_host()->property_trees()->transform_tree;
+ TransformNode* node = tree.Node(animated->transform_tree_index());
+ EXPECT_FALSE(node->data.is_currently_animating);
+ EXPECT_TRUE(node->data.has_potential_animation);
+
+ animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0));
+ root->layer_tree_host()->AnimateLayers(
+ base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max()));
+ node = tree.Node(animated->transform_tree_index());
+ EXPECT_TRUE(node->data.is_currently_animating);
+ EXPECT_TRUE(node->data.has_potential_animation);
+
+ player->AbortAnimations(TargetProperty::TRANSFORM,
+ false /*needs_completion*/);
+ node = tree.Node(animated->transform_tree_index());
+ EXPECT_FALSE(node->data.is_currently_animating);
+ EXPECT_FALSE(node->data.has_potential_animation);
+}
+
TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) {
LayerTreeHostCommon::ScrollUpdateInfo scroll;
scroll.layer_id = 2;
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698