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

Unified Diff: cc/layers/layer_utils_unittest.cc

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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_unittest.cc ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_utils_unittest.cc
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index 1a6ebd2a35dfcade1c6374be0ddaede5f7f91716..e5d82fdc782b8d7c25085a41f3d17cb0abeb0c44 100644
--- a/cc/layers/layer_utils_unittest.cc
+++ b/cc/layers/layer_utils_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_task_graph_runner.h"
+#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/box_f.h"
@@ -41,6 +42,7 @@ class LayerUtilsGetAnimationBoundsTest : public testing::Test {
timeline_ =
AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
host_impl_.animation_host()->AddAnimationTimeline(timeline_);
+ host_impl_.active_tree()->SetElementIdsForTesting();
}
LayerImpl* root() { return root_; }
@@ -106,8 +108,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, ScaleRoot) {
start.AppendScale(1.f, 1.f, 1.f);
TransformOperations end;
end.AppendScale(2.f, 2.f, 1.f);
- AddAnimatedTransformToLayerWithPlayer(root()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(root()->element_id(), timeline(),
+ duration, start, end);
root()->SetPosition(gfx::PointF());
parent1()->SetPosition(gfx::PointF());
@@ -133,8 +135,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, TranslateParentLayer) {
start.AppendTranslate(0.f, 0.f, 0.f);
TransformOperations end;
end.AppendTranslate(50.f, 50.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(parent1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(parent1()->element_id(), timeline(),
+ duration, start, end);
parent1()->SetBounds(gfx::Size(350, 200));
@@ -158,8 +160,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, TranslateChildLayer) {
start.AppendTranslate(0.f, 0.f, 0.f);
TransformOperations end;
end.AppendTranslate(50.f, 50.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, end);
parent1()->SetBounds(gfx::Size(350, 200));
child1()->SetDrawsContent(true);
@@ -182,13 +184,13 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, TranslateBothLayers) {
start.AppendTranslate(0.f, 0.f, 0.f);
TransformOperations child_end;
child_end.AppendTranslate(50.f, 0.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(parent1()->id(), timeline(), duration,
- start, child_end);
+ AddAnimatedTransformToElementWithPlayer(parent1()->element_id(), timeline(),
+ duration, start, child_end);
TransformOperations grand_child_end;
grand_child_end.AppendTranslate(0.f, 50.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, grand_child_end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, grand_child_end);
parent1()->SetBounds(gfx::Size(350, 200));
@@ -213,8 +215,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, RotateXNoPerspective) {
TransformOperations end;
end.AppendRotate(1.f, 0.f, 0.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, end);
parent1()->SetBounds(gfx::Size(350, 200));
@@ -242,8 +244,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, RotateXWithPerspective) {
TransformOperations end;
end.AppendRotate(1.f, 0.f, 0.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, end);
// Make the anchor point not the default 0.5 value and line up with the
// child center to make the math easier.
@@ -283,8 +285,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, RotateXWithPerspectiveOnSameLayer) {
TransformOperations end;
end.AppendRotate(1.f, 0.f, 0.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(parent1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(parent1()->element_id(), timeline(),
+ duration, start, end);
// Make the anchor point not the default 0.5 value and line up
// with the child center to make the math easier.
@@ -319,8 +321,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, RotateZ) {
start.AppendRotate(0.f, 0.f, 1.f, 0.f);
TransformOperations end;
end.AppendRotate(0.f, 0.f, 1.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, end);
parent1()->SetBounds(gfx::Size(350, 200));
@@ -353,8 +355,8 @@ TEST_F(LayerUtilsGetAnimationBoundsTest, MismatchedTransforms) {
start.AppendTranslate(5, 6, 7);
TransformOperations end;
end.AppendRotate(0.f, 0.f, 1.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(child1()->id(), timeline(), duration,
- start, end);
+ AddAnimatedTransformToElementWithPlayer(child1()->element_id(), timeline(),
+ duration, start, end);
parent1()->SetBounds(gfx::Size(350, 200));
@@ -388,8 +390,9 @@ TEST_F(LayerUtilsGetAnimationBoundsTest,
start.AppendTranslate(0.f, 0.f, 0.f);
TransformOperations great_grand_child_end;
great_grand_child_end.AppendTranslate(50.f, 0.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(grand_child()->id(), timeline(),
- duration, start, great_grand_child_end);
+ AddAnimatedTransformToElementWithPlayer(grand_child()->element_id(),
+ timeline(), duration, start,
+ great_grand_child_end);
gfx::Transform translate_2d_transform;
translate_2d_transform.Translate(80.f, 60.f);
@@ -416,8 +419,9 @@ TEST_F(LayerUtilsGetAnimationBoundsTest,
start.AppendRotate(0.f, 0.f, 1.f, 0.f);
TransformOperations great_grand_child_end;
great_grand_child_end.AppendRotate(0.f, 0.f, 1.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(grand_child()->id(), timeline(),
- duration, start, great_grand_child_end);
+ AddAnimatedTransformToElementWithPlayer(grand_child()->element_id(),
+ timeline(), duration, start,
+ great_grand_child_end);
gfx::Transform translate_2d_transform;
translate_2d_transform.Translate(80.f, 60.f);
@@ -463,8 +467,9 @@ TEST_F(LayerUtilsGetAnimationBoundsTest,
start.AppendRotate(1.f, 0.f, 0.f, 0.f);
TransformOperations great_grand_child_end;
great_grand_child_end.AppendRotate(1.f, 0.f, 0.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(great_grand_child()->id(), timeline(),
- duration, start, great_grand_child_end);
+ AddAnimatedTransformToElementWithPlayer(great_grand_child()->element_id(),
+ timeline(), duration, start,
+ great_grand_child_end);
gfx::Transform translate_2d_transform;
translate_2d_transform.Translate(80.f, 60.f);
@@ -544,8 +549,9 @@ TEST_F(LayerUtilsGetAnimationBoundsTest,
start.AppendRotate(1.f, 0.f, 0.f, 0.f);
TransformOperations rotate_x_end;
rotate_x_end.AppendRotate(1.f, 0.f, 0.f, 90.f);
- AddAnimatedTransformToLayerWithPlayer(great_grand_child()->id(), timeline(),
- duration, start, rotate_x_end);
+ AddAnimatedTransformToElementWithPlayer(great_grand_child()->element_id(),
+ timeline(), duration, start,
+ rotate_x_end);
gfx::Transform translate_2d_transform;
translate_2d_transform.Translate(80.f, 60.f);
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698