Chromium Code Reviews| 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 103e3d4f6163cb381e782ad25a0699b677c49515..9abc393ca081e83ca255d547f1e4b5ac1afcc0fa 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -2553,25 +2553,27 @@ TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { |
| gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); |
| parent->layer_tree_impl()->BuildPropertyTreesForTesting(); |
| + SetElementIdsForTesting(); |
| // Put an animated opacity on the render surface. |
| - AddOpacityTransitionToLayerWithPlayer(render_surface1->id(), timeline_impl(), |
| - 10.0, 1.f, 0.f, false); |
| + AddOpacityTransitionToElementWithPlayer( |
| + render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); |
| // Also put an animated opacity on a layer without descendants. |
| - AddOpacityTransitionToLayerWithPlayer(grand_child_of_root->id(), |
| - timeline_impl(), 10.0, 1.f, 0.f, false); |
| + AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(), |
| + timeline_impl(), 10.0, 1.f, 0.f, |
| + false); |
| // Put a transform animation on the render surface. |
| - AddAnimatedTransformToLayerWithPlayer(render_surface2->id(), timeline_impl(), |
| - 10.0, 30, 0); |
| + AddAnimatedTransformToElementWithPlayer(render_surface2->element_id(), |
| + timeline_impl(), 10.0, 30, 0); |
| // Also put transform animations on grand_child_of_root, and |
| // grand_child_of_rs2 |
| - AddAnimatedTransformToLayerWithPlayer(grand_child_of_root->id(), |
| - timeline_impl(), 10.0, 30, 0); |
| - AddAnimatedTransformToLayerWithPlayer(grand_child_of_rs2->id(), |
| - timeline_impl(), 10.0, 30, 0); |
| + AddAnimatedTransformToElementWithPlayer(grand_child_of_root->element_id(), |
| + timeline_impl(), 10.0, 30, 0); |
| + AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(), |
| + timeline_impl(), 10.0, 30, 0); |
| parent->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(parent); |
| @@ -2690,14 +2692,16 @@ TEST_F(LayerTreeHostCommonTest, |
| gfx::PointF(), gfx::Size(10, 10), true, false, |
| false); |
| + SetElementIdsForTesting(); |
| + |
| // Add a transform animation with a start delay to |grand_child|. |
| std::unique_ptr<Animation> animation = Animation::Create( |
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, |
| TargetProperty::TRANSFORM); |
| animation->set_fill_mode(Animation::FillMode::NONE); |
| animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| - AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), |
| - std::move(animation)); |
| + AddAnimationToElementWithPlayer(grand_child->element_id(), timeline_impl(), |
| + std::move(animation)); |
| ExecuteCalculateDrawProperties(parent); |
| EXPECT_FALSE(parent->screen_space_transform_is_animating()); |
| @@ -4418,12 +4422,14 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { |
| backface_matrix.RotateAboutYAxis(180.0); |
| backface_matrix.Translate(-50.0, -50.0); |
| + SetElementIdsForTesting(); |
| + |
| // Animate the transform on the render surface. |
| - AddAnimatedTransformToLayerWithPlayer(animating_surface->id(), |
| - timeline_impl(), 10.0, 30, 0); |
| + AddAnimatedTransformToElementWithPlayer(animating_surface->element_id(), |
| + timeline_impl(), 10.0, 30, 0); |
| // This is just an animating layer, not a surface. |
| - AddAnimatedTransformToLayerWithPlayer(animating_child->id(), timeline_impl(), |
| - 10.0, 30, 0); |
| + AddAnimatedTransformToElementWithPlayer(animating_child->element_id(), |
| + timeline_impl(), 10.0, 30, 0); |
| SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(100, 100), true, false); |
| @@ -5035,13 +5041,18 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
| LayerImpl* root_layer = root.get(); |
| host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| host_impl.pending_tree()->BuildPropertyTreesForTesting(); |
| + |
| // Add opacity animation. |
| scoped_refptr<AnimationTimeline> timeline = |
| AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| host_impl.animation_host()->AddAnimationTimeline(timeline); |
| + host_impl.pending_tree()->SetElementIdsForTesting(); |
| - AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f, |
| - false); |
| + ElementId child_element_id = |
| + host_impl.pending_tree()->LayerById(child_id)->element_id(); |
| + |
| + AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0, |
| + 0.0f, 1.0f, false); |
| LayerImplList render_surface_layer_list; |
| LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| @@ -5145,6 +5156,8 @@ class LCDTextTest : public LayerTreeHostCommonTestBase, |
| root_->AddChild(std::move(child_ptr)); |
| host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); |
| + host_impl_.active_tree()->SetElementIdsForTesting(); |
| + |
| root_->SetContentsOpaque(true); |
| child_->SetContentsOpaque(true); |
| grand_child_->SetContentsOpaque(true); |
| @@ -5297,8 +5310,10 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) { |
| // Add opacity animation. |
| child_->test_properties()->opacity = 0.9f; |
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| - AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, |
| - 0.1f, false); |
| + SetElementIdsForTesting(); |
| + |
| + AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
| + 10.0, 0.9f, 0.1f, false); |
| ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, |
| layers_always_allowed_lcd_text_); |
| // Text LCD should be adjusted while animation is active. |
| @@ -5317,11 +5332,12 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { |
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
| + SetElementIdsForTesting(); |
| // Mark contents non-opaque within the first animation frame. |
| child_->SetContentsOpaque(false); |
| - AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, |
| - 0.1f, false); |
| + AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
| + 10.0, 0.9f, 0.1f, false); |
| ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, |
| layers_always_allowed_lcd_text_); |
| // LCD text should be disabled for non-opaque layers even during animations. |
| @@ -7087,8 +7103,11 @@ TEST_F(LayerTreeHostCommonTest, |
| start_operations.AppendMatrix(start_scale); |
| TransformOperations end_operations; |
| end_operations.AppendMatrix(end_scale); |
| - AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), |
| - 1.0, start_operations, end_operations); |
| + SetElementIdsForTesting(); |
| + |
| + AddAnimatedTransformToElementWithPlayer(animated_layer->element_id(), |
| + timeline_impl(), 1.0, |
| + start_operations, end_operations); |
| gfx::Vector2dF scroll_delta(5.f, 9.f); |
| SetScrollOffsetDelta(scroller, scroll_delta); |
| @@ -7191,8 +7210,10 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| host_impl.animation_host()->AddAnimationTimeline(timeline); |
| - AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
| - TransformOperations(), translation); |
| + host_impl.active_tree()->SetElementIdsForTesting(); |
| + AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| + 1.0, TransformOperations(), |
| + translation); |
| // No layers have scale-affecting animations. |
| EXPECT_EQ( |
| @@ -7218,8 +7239,8 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| TransformOperations scale; |
| scale.AppendScale(5.f, 4.f, 3.f); |
| - AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, |
| - TransformOperations(), scale); |
| + AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| + 1.0, TransformOperations(), scale); |
| child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(grand_parent_raw); |
| @@ -7244,8 +7265,9 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 1.f, |
| grand_child_raw->draw_properties().starting_animation_contents_scale); |
| - AddAnimatedTransformToLayerWithPlayer(grand_parent_raw->id(), timeline, 1.0, |
| - TransformOperations(), scale); |
| + AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(), |
| + timeline, 1.0, TransformOperations(), |
| + scale); |
| grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(grand_parent_raw); |
| @@ -7272,8 +7294,8 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 0.f, |
| grand_child_raw->draw_properties().starting_animation_contents_scale); |
| - AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
| - TransformOperations(), scale); |
| + AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| + 1.0, TransformOperations(), scale); |
| parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(grand_parent_raw); |
| @@ -7298,18 +7320,19 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 0.f, |
| grand_child_raw->draw_properties().starting_animation_contents_scale); |
| - AbortAnimationsOnLayerWithPlayer(grand_parent_raw->id(), timeline, |
| - TargetProperty::TRANSFORM); |
| - AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, |
| - TargetProperty::TRANSFORM); |
| - AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
| - TargetProperty::TRANSFORM); |
| + AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline, |
| + TargetProperty::TRANSFORM); |
| + AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline, |
| + TargetProperty::TRANSFORM); |
| + AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| + TargetProperty::TRANSFORM); |
| TransformOperations perspective; |
| perspective.AppendPerspective(10.f); |
| - AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, |
| - TransformOperations(), perspective); |
| + AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| + 1.0, TransformOperations(), |
| + perspective); |
| child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(grand_parent_raw); |
| @@ -7335,16 +7358,16 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 0.f, |
| grand_child_raw->draw_properties().starting_animation_contents_scale); |
| - AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
| - TargetProperty::TRANSFORM); |
| + AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| + TargetProperty::TRANSFORM); |
| gfx::Transform scale_matrix; |
| scale_matrix.Scale(1.f, 2.f); |
| grand_parent_raw->SetTransform(scale_matrix); |
| parent_raw->SetTransform(scale_matrix); |
| grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| - AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
| - TransformOperations(), scale); |
| + AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| + 1.0, TransformOperations(), scale); |
| ExecuteCalculateDrawProperties(grand_parent_raw); |
| // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale |
| @@ -7747,6 +7770,8 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
| root->SetDrawsContent(true); |
| host_impl.active_tree()->SetRootLayer(std::move(root)); |
| + host_impl.active_tree()->SetElementIdsForTesting(); |
| + |
| gfx::Transform identity_matrix, scale_transform_child1, |
| scale_transform_child2; |
| scale_transform_child1.Scale(2, 3); |
| @@ -7777,14 +7802,14 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
| AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| host_impl.animation_host()->AddAnimationTimeline(timeline); |
| - AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0, |
| - TransformOperations(), scale); |
| - |
| SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, |
| gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| true, false, false); |
| child2_layer->SetDrawsContent(true); |
| + AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline, |
| + 1.0, TransformOperations(), scale); |
| + |
| root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| ExecuteCalculateDrawProperties(root_layer); |
| @@ -8052,6 +8077,8 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| host()->SetRootLayer(root); |
| + host()->SetElementIdsForTesting(); |
| + |
| SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(100, 100), true, false); |
| SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| @@ -8061,8 +8088,9 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| root->SetForceRenderSurfaceForTesting(true); |
| animated->SetOpacity(0.f); |
| - AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, |
| - 1.f, false); |
| + SetElementIdsForTesting(); |
|
ajuma
2016/06/01 23:53:42
This adds ids to the the LTHI's active tree, right
Ian Vollick
2016/06/02 19:03:11
Nope, removed.
|
| + AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(), |
| + 10.0, 0.f, 1.f, false); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); |
| @@ -8090,6 +8118,8 @@ TEST_F(LayerTreeHostCommonTest, |
| host()->SetRootLayer(root); |
| + host()->SetElementIdsForTesting(); |
| + |
| gfx::Transform uninvertible_matrix; |
| uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); |
| @@ -8110,9 +8140,10 @@ TEST_F(LayerTreeHostCommonTest, |
| start_transform_operations.AppendMatrix(uninvertible_matrix); |
| TransformOperations end_transform_operations; |
| - AddAnimatedTransformToLayerWithPlayer(animated->id(), timeline(), 10.0, |
| - start_transform_operations, |
| - end_transform_operations); |
| + SetElementIdsForTesting(); |
| + AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(), |
| + 10.0, start_transform_operations, |
| + end_transform_operations); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| // The animated layer has a singular transform and maps to a non-empty rect in |
| @@ -8159,8 +8190,9 @@ TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(50, 50), true, false); |
| - AddAnimatedFilterToLayerWithPlayer(child->id(), timeline_impl(), 10.0, 0.1f, |
| - 0.2f); |
| + SetElementIdsForTesting(); |
| + AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(), |
| + 10.0, 0.1f, 0.2f); |
| ExecuteCalculateDrawProperties(root); |
| EXPECT_TRUE(root->has_render_surface()); |
| @@ -8191,6 +8223,8 @@ TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
| SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(50, 50), true, false); |
| + SetElementIdsForTesting(); |
| + |
| std::unique_ptr<KeyframedFilterAnimationCurve> curve( |
| KeyframedFilterAnimationCurve::Create()); |
| FilterOperations start_filters; |
| @@ -8206,8 +8240,8 @@ TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
| animation->set_fill_mode(Animation::FillMode::NONE); |
| animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| - AddAnimationToLayerWithPlayer(child->id(), timeline_impl(), |
| - std::move(animation)); |
| + AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(), |
| + std::move(animation)); |
| ExecuteCalculateDrawProperties(root); |
| EXPECT_TRUE(root->has_render_surface()); |
| @@ -8569,6 +8603,8 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| host()->SetRootLayer(root); |
| + host()->SetElementIdsForTesting(); |
| + |
| // Check the non-skipped case. |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| @@ -8595,6 +8631,8 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| zero_z_scale.Scale3d(1, 1, 0); |
| child->SetTransform(zero_z_scale); |
| + SetElementIdsForTesting(); |
|
ajuma
2016/06/01 23:53:42
Is this needed? (this test only has Layers, not La
Ian Vollick
2016/06/02 19:03:11
Whoops, removed. I clearly added the host()->SetEl
|
| + |
| // Add a transform animation with a start delay. Now, even though |child| has |
| // a singular transform, the subtree should still get processed. |
| int animation_id = 0; |
| @@ -8603,13 +8641,14 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| animation_id, 1, TargetProperty::TRANSFORM); |
| animation->set_fill_mode(Animation::FillMode::NONE); |
| animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| - AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); |
| + AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
| + std::move(animation)); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| grandchild->set_visible_layer_rect(gfx::Rect()); |
| - RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), |
| - animation_id); |
| + RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
| + animation_id); |
| child->SetTransform(identity); |
| child->SetOpacity(0.f); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| @@ -8631,8 +8670,8 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| animation_id, 1, TargetProperty::OPACITY); |
| animation->set_fill_mode(Animation::FillMode::NONE); |
| animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| - AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), |
| - std::move(animation)); |
| + AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
| + std::move(animation)); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| } |
| @@ -8677,6 +8716,8 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| root->AddChild(std::move(child)); |
| host_impl.active_tree()->SetRootLayer(std::move(root)); |
| + host_impl.active_tree()->SetElementIdsForTesting(); |
| + |
| // Check the non-skipped case. |
| // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| @@ -8772,10 +8813,10 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| - root_ptr->id(), player.get()); |
| + root_ptr->element_id(), player.get()); |
| host_impl.active_tree() |
| ->animation_host() |
| - ->GetElementAnimationsForElementId(root_ptr->id()) |
| + ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| ->AddAnimation(std::move(transform_animation)); |
| grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| child_ptr->SetScrollClipLayer(root_ptr->id()); |
| @@ -8786,7 +8827,7 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| - root_ptr->id(), player.get()); |
| + root_ptr->element_id(), player.get()); |
| } |
| TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| @@ -8802,6 +8843,7 @@ TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(10, 10), true, false, |
| false); |
| + SetElementIdsForTesting(); |
| gfx::Transform singular; |
| singular.matrix().set(0, 0, 0); |
| @@ -8827,11 +8869,11 @@ TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( |
| - grand_child->id(), player.get()); |
| + grand_child->element_id(), player.get()); |
| host_impl() |
| ->active_tree() |
| ->animation_host() |
| - ->GetElementAnimationsForElementId(grand_child->id()) |
| + ->GetElementAnimationsForElementId(grand_child->element_id()) |
| ->AddAnimation(std::move(transform_animation)); |
| ExecuteCalculateDrawProperties(root); |
| @@ -8839,7 +8881,7 @@ TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( |
| - grand_child->id(), player.get()); |
| + grand_child->element_id(), player.get()); |
| } |
| TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| @@ -8882,6 +8924,7 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| root->AddChild(std::move(child)); |
| host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| + host_impl.pending_tree()->SetElementIdsForTesting(); |
| // Check the non-skipped case. |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| @@ -8898,10 +8941,10 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
| scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| - root_ptr->id(), player.get()); |
| + root_ptr->element_id(), player.get()); |
| host_impl.active_tree() |
| ->animation_host() |
| - ->GetElementAnimationsForElementId(root_ptr->id()) |
| + ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| ->AddAnimation(std::move(animation)); |
| root_ptr->test_properties()->opacity = 0.f; |
| grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| @@ -8910,7 +8953,7 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| - root_ptr->id(), player.get()); |
| + root_ptr->element_id(), player.get()); |
| } |
| TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| @@ -9761,6 +9804,8 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| host()->SetRootLayer(root); |
| + host()->SetElementIdsForTesting(); |
| + |
| SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(100, 100), true, false); |
| SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| @@ -9772,7 +9817,8 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| scoped_refptr<AnimationPlayer> player = |
| AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| timeline()->AttachPlayer(player); |
| - player->AttachElement(animated->id()); |
| + |
| + player->AttachElement(animated->element_id()); |
| int animation_id = 0; |
| std::unique_ptr<Animation> animation = Animation::Create( |
| @@ -9781,8 +9827,8 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| 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)); |
| + AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| + std::move(animation)); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| @@ -9813,6 +9859,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
| host()->SetRootLayer(root); |
| + host()->SetElementIdsForTesting(); |
| + |
| SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| gfx::PointF(), gfx::Size(100, 100), true, false); |
| SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| @@ -9823,7 +9871,7 @@ TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
| scoped_refptr<AnimationPlayer> player = |
| AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| timeline()->AttachPlayer(player); |
| - player->AttachElement(animated->id()); |
| + player->AttachElement(animated->element_id()); |
| std::unique_ptr<KeyframedTransformAnimationCurve> curve( |
| KeyframedTransformAnimationCurve::Create()); |
| @@ -9842,8 +9890,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
| 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)); |
| + AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| + std::move(animation)); |
| ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |