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..f815891630f9cc138291491f6d9a88e87246d8a6 100644 |
--- a/cc/layers/layer_utils_unittest.cc |
+++ b/cc/layers/layer_utils_unittest.cc |
@@ -54,21 +54,28 @@ class LayerUtilsGetAnimationBoundsTest : public testing::Test { |
scoped_refptr<AnimationTimeline> timeline() { return timeline_; } |
FakeLayerTreeHostImpl& host_impl() { return host_impl_; } |
+ std::unique_ptr<LayerImpl> CreateTestLayerImpl(LayerTreeImpl* tree_impl, |
+ int id) { |
+ auto layer = LayerImpl::Create(tree_impl, id); |
+ layer->SetElementId(NextTestElementId()); |
+ return layer; |
+ } |
+ |
private: |
- static LayerImpl* CreateTwoForkTree(LayerTreeHostImpl* host_impl) { |
+ LayerImpl* CreateTwoForkTree(LayerTreeHostImpl* host_impl) { |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl->active_tree(), 1); |
+ CreateTestLayerImpl(host_impl->active_tree(), 1); |
LayerImpl* root_ptr = root.get(); |
- root->AddChild(LayerImpl::Create(host_impl->active_tree(), 2)); |
+ root->AddChild(CreateTestLayerImpl(host_impl->active_tree(), 2)); |
root->children()[0]->AddChild( |
- LayerImpl::Create(host_impl->active_tree(), 3)); |
- root->AddChild(LayerImpl::Create(host_impl->active_tree(), 4)); |
+ CreateTestLayerImpl(host_impl->active_tree(), 3)); |
+ root->AddChild(CreateTestLayerImpl(host_impl->active_tree(), 4)); |
root->children()[1]->AddChild( |
- LayerImpl::Create(host_impl->active_tree(), 5)); |
+ CreateTestLayerImpl(host_impl->active_tree(), 5)); |
root->children()[1]->children()[0]->AddChild( |
- LayerImpl::Create(host_impl->active_tree(), 6)); |
+ CreateTestLayerImpl(host_impl->active_tree(), 6)); |
root->children()[1]->children()[0]->children()[0]->AddChild( |
- LayerImpl::Create(host_impl->active_tree(), 7)); |
+ CreateTestLayerImpl(host_impl->active_tree(), 7)); |
host_impl->active_tree()->SetRootLayer(std::move(root)); |
return root_ptr; |
} |
@@ -94,8 +101,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 +128,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 +153,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 +177,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 +208,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 +237,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 +278,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 +314,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 +348,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 +383,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 +412,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 +460,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 +542,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); |