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

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: get element id's from scroll node data directly. 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
Index: cc/layers/layer_utils_unittest.cc
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index d41b7d06a6679df0c19ebb678d0ebb2c9fe030be..0e9334fc33ac70d6ffd844719cc052556bdc8eec 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_; }
@@ -94,8 +96,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());
@@ -121,8 +123,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));
@@ -146,8 +148,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);
@@ -170,13 +172,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));
@@ -201,8 +203,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));
@@ -230,8 +232,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.
@@ -271,8 +273,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.
@@ -307,8 +309,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));
@@ -341,8 +343,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));
@@ -376,8 +378,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);
@@ -404,8 +407,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);
@@ -451,8 +455,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);
@@ -532,8 +537,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);

Powered by Google App Engine
This is Rietveld 408576698