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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reviewer feedback 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2594 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2595 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2595 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2596 SetLayerPropertiesForTesting( 2596 SetLayerPropertiesForTesting(
2597 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2597 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2598 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2598 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2599 SetLayerPropertiesForTesting( 2599 SetLayerPropertiesForTesting(
2600 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2600 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2601 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2601 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2602 2602
2603 parent->layer_tree_impl()->BuildPropertyTreesForTesting(); 2603 parent->layer_tree_impl()->BuildPropertyTreesForTesting();
2604 SetElementIdsForTesting();
2604 2605
2605 // Put an animated opacity on the render surface. 2606 // Put an animated opacity on the render surface.
2606 AddOpacityTransitionToLayerWithPlayer(render_surface1->id(), timeline_impl(), 2607 AddOpacityTransitionToElementWithPlayer(
2607 10.0, 1.f, 0.f, false); 2608 render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false);
2608 2609
2609 // Also put an animated opacity on a layer without descendants. 2610 // Also put an animated opacity on a layer without descendants.
2610 AddOpacityTransitionToLayerWithPlayer(grand_child_of_root->id(), 2611 AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(),
2611 timeline_impl(), 10.0, 1.f, 0.f, false); 2612 timeline_impl(), 10.0, 1.f, 0.f,
2613 false);
2612 2614
2613 // Put a transform animation on the render surface. 2615 // Put a transform animation on the render surface.
2614 AddAnimatedTransformToLayerWithPlayer(render_surface2->id(), timeline_impl(), 2616 AddAnimatedTransformToElementWithPlayer(render_surface2->element_id(),
2615 10.0, 30, 0); 2617 timeline_impl(), 10.0, 30, 0);
2616 2618
2617 // Also put transform animations on grand_child_of_root, and 2619 // Also put transform animations on grand_child_of_root, and
2618 // grand_child_of_rs2 2620 // grand_child_of_rs2
2619 AddAnimatedTransformToLayerWithPlayer(grand_child_of_root->id(), 2621 AddAnimatedTransformToElementWithPlayer(grand_child_of_root->element_id(),
2620 timeline_impl(), 10.0, 30, 0); 2622 timeline_impl(), 10.0, 30, 0);
2621 AddAnimatedTransformToLayerWithPlayer(grand_child_of_rs2->id(), 2623 AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(),
2622 timeline_impl(), 10.0, 30, 0); 2624 timeline_impl(), 10.0, 30, 0);
2623 2625
2624 parent->layer_tree_impl()->property_trees()->needs_rebuild = true; 2626 parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
2625 ExecuteCalculateDrawProperties(parent); 2627 ExecuteCalculateDrawProperties(parent);
2626 2628
2627 // Only layers that are associated with render surfaces should have an actual 2629 // Only layers that are associated with render surfaces should have an actual
2628 // RenderSurface() value. 2630 // RenderSurface() value.
2629 ASSERT_TRUE(parent->render_surface()); 2631 ASSERT_TRUE(parent->render_surface());
2630 ASSERT_FALSE(child_of_root->render_surface()); 2632 ASSERT_FALSE(child_of_root->render_surface());
2631 ASSERT_FALSE(grand_child_of_root->render_surface()); 2633 ASSERT_FALSE(grand_child_of_root->render_surface());
2632 2634
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 gfx::Size(10, 10), true, false, true); 2733 gfx::Size(10, 10), true, false, true);
2732 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 2734 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
2733 gfx::Size(10, 10), true, false, false); 2735 gfx::Size(10, 10), true, false, false);
2734 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), 2736 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
2735 gfx::PointF(), gfx::Size(10, 10), true, false, 2737 gfx::PointF(), gfx::Size(10, 10), true, false,
2736 false); 2738 false);
2737 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), 2739 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(),
2738 gfx::PointF(), gfx::Size(10, 10), true, false, 2740 gfx::PointF(), gfx::Size(10, 10), true, false,
2739 false); 2741 false);
2740 2742
2743 SetElementIdsForTesting();
2744
2741 // Add a transform animation with a start delay to |grand_child|. 2745 // Add a transform animation with a start delay to |grand_child|.
2742 std::unique_ptr<Animation> animation = Animation::Create( 2746 std::unique_ptr<Animation> animation = Animation::Create(
2743 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, 2747 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1,
2744 TargetProperty::TRANSFORM); 2748 TargetProperty::TRANSFORM);
2745 animation->set_fill_mode(Animation::FillMode::NONE); 2749 animation->set_fill_mode(Animation::FillMode::NONE);
2746 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 2750 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
2747 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), 2751 AddAnimationToElementWithPlayer(grand_child->element_id(), timeline_impl(),
2748 std::move(animation)); 2752 std::move(animation));
2749 ExecuteCalculateDrawProperties(parent); 2753 ExecuteCalculateDrawProperties(parent);
2750 2754
2751 EXPECT_FALSE(parent->screen_space_transform_is_animating()); 2755 EXPECT_FALSE(parent->screen_space_transform_is_animating());
2752 EXPECT_FALSE(child->screen_space_transform_is_animating()); 2756 EXPECT_FALSE(child->screen_space_transform_is_animating());
2753 2757
2754 EXPECT_FALSE(grand_child->TransformIsAnimating()); 2758 EXPECT_FALSE(grand_child->TransformIsAnimating());
2755 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); 2759 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation());
2756 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); 2760 EXPECT_TRUE(grand_child->screen_space_transform_is_animating());
2757 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); 2761 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating());
2758 } 2762 }
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
4459 child2->SetDrawsContent(true); 4463 child2->SetDrawsContent(true);
4460 animating_surface->SetDrawsContent(true); 4464 animating_surface->SetDrawsContent(true);
4461 child_of_animating_surface->SetDrawsContent(true); 4465 child_of_animating_surface->SetDrawsContent(true);
4462 animating_child->SetDrawsContent(true); 4466 animating_child->SetDrawsContent(true);
4463 4467
4464 gfx::Transform backface_matrix; 4468 gfx::Transform backface_matrix;
4465 backface_matrix.Translate(50.0, 50.0); 4469 backface_matrix.Translate(50.0, 50.0);
4466 backface_matrix.RotateAboutYAxis(180.0); 4470 backface_matrix.RotateAboutYAxis(180.0);
4467 backface_matrix.Translate(-50.0, -50.0); 4471 backface_matrix.Translate(-50.0, -50.0);
4468 4472
4473 SetElementIdsForTesting();
4474
4469 // Animate the transform on the render surface. 4475 // Animate the transform on the render surface.
4470 AddAnimatedTransformToLayerWithPlayer(animating_surface->id(), 4476 AddAnimatedTransformToElementWithPlayer(animating_surface->element_id(),
4471 timeline_impl(), 10.0, 30, 0); 4477 timeline_impl(), 10.0, 30, 0);
4472 // This is just an animating layer, not a surface. 4478 // This is just an animating layer, not a surface.
4473 AddAnimatedTransformToLayerWithPlayer(animating_child->id(), timeline_impl(), 4479 AddAnimatedTransformToElementWithPlayer(animating_child->element_id(),
4474 10.0, 30, 0); 4480 timeline_impl(), 10.0, 30, 0);
4475 4481
4476 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), 4482 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
4477 gfx::PointF(), gfx::Size(100, 100), true, false); 4483 gfx::PointF(), gfx::Size(100, 100), true, false);
4478 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(), 4484 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(),
4479 gfx::PointF(), gfx::Size(100, 100), true, false); 4485 gfx::PointF(), gfx::Size(100, 100), true, false);
4480 SetLayerPropertiesForTesting(animating_surface, backface_matrix, 4486 SetLayerPropertiesForTesting(animating_surface, backface_matrix,
4481 gfx::Point3F(), gfx::PointF(), 4487 gfx::Point3F(), gfx::PointF(),
4482 gfx::Size(100, 100), true, false, true); 4488 gfx::Size(100, 100), true, false, true);
4483 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix, 4489 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix,
4484 gfx::Point3F(), gfx::PointF(), 4490 gfx::Point3F(), gfx::PointF(),
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 false); 5082 false);
5077 child->SetDrawsContent(true); 5083 child->SetDrawsContent(true);
5078 child->test_properties()->opacity = 0.0f; 5084 child->test_properties()->opacity = 0.0f;
5079 5085
5080 const int child_id = child->id(); 5086 const int child_id = child->id();
5081 root->AddChild(std::move(child)); 5087 root->AddChild(std::move(child));
5082 root->SetHasRenderSurface(true); 5088 root->SetHasRenderSurface(true);
5083 LayerImpl* root_layer = root.get(); 5089 LayerImpl* root_layer = root.get();
5084 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5090 host_impl.pending_tree()->SetRootLayer(std::move(root));
5085 host_impl.pending_tree()->BuildPropertyTreesForTesting(); 5091 host_impl.pending_tree()->BuildPropertyTreesForTesting();
5092
5086 // Add opacity animation. 5093 // Add opacity animation.
5087 scoped_refptr<AnimationTimeline> timeline = 5094 scoped_refptr<AnimationTimeline> timeline =
5088 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5095 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5089 host_impl.animation_host()->AddAnimationTimeline(timeline); 5096 host_impl.animation_host()->AddAnimationTimeline(timeline);
5097 host_impl.pending_tree()->SetElementIdsForTesting();
5090 5098
5091 AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f, 5099 ElementId child_element_id =
5092 false); 5100 host_impl.pending_tree()->LayerById(child_id)->element_id();
5101
5102 AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0,
5103 0.0f, 1.0f, false);
5093 5104
5094 LayerImplList render_surface_layer_list; 5105 LayerImplList render_surface_layer_list;
5095 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5106 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5096 root_layer, root_layer->bounds(), &render_surface_layer_list); 5107 root_layer, root_layer->bounds(), &render_surface_layer_list);
5097 inputs.can_adjust_raster_scales = true; 5108 inputs.can_adjust_raster_scales = true;
5098 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5109 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5099 5110
5100 // We should have one render surface and two layers. The child 5111 // We should have one render surface and two layers. The child
5101 // layer should be included even though it is transparent. 5112 // layer should be included even though it is transparent.
5102 ASSERT_EQ(1u, render_surface_layer_list.size()); 5113 ASSERT_EQ(1u, render_surface_layer_list.size());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
5194 5205
5195 // Stash raw pointers to look at later. 5206 // Stash raw pointers to look at later.
5196 root_ = root_ptr.get(); 5207 root_ = root_ptr.get();
5197 child_ = child_ptr.get(); 5208 child_ = child_ptr.get();
5198 grand_child_ = grand_child_ptr.get(); 5209 grand_child_ = grand_child_ptr.get();
5199 5210
5200 child_->AddChild(std::move(grand_child_ptr)); 5211 child_->AddChild(std::move(grand_child_ptr));
5201 root_->AddChild(std::move(child_ptr)); 5212 root_->AddChild(std::move(child_ptr));
5202 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); 5213 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr));
5203 5214
5215 host_impl_.active_tree()->SetElementIdsForTesting();
5216
5204 root_->SetContentsOpaque(true); 5217 root_->SetContentsOpaque(true);
5205 child_->SetContentsOpaque(true); 5218 child_->SetContentsOpaque(true);
5206 grand_child_->SetContentsOpaque(true); 5219 grand_child_->SetContentsOpaque(true);
5207 5220
5208 root_->SetDrawsContent(true); 5221 root_->SetDrawsContent(true);
5209 child_->SetDrawsContent(true); 5222 child_->SetDrawsContent(true);
5210 grand_child_->SetDrawsContent(true); 5223 grand_child_->SetDrawsContent(true);
5211 5224
5212 gfx::Transform identity_matrix; 5225 gfx::Transform identity_matrix;
5213 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(), 5226 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5335 5348
5336 // Sanity check: Make sure can_use_lcd_text_ is set on each node. 5349 // Sanity check: Make sure can_use_lcd_text_ is set on each node.
5337 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5350 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5338 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5351 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5339 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); 5352 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText());
5340 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5353 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5341 5354
5342 // Add opacity animation. 5355 // Add opacity animation.
5343 child_->test_properties()->opacity = 0.9f; 5356 child_->test_properties()->opacity = 0.9f;
5344 child_->layer_tree_impl()->property_trees()->needs_rebuild = true; 5357 child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
5345 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, 5358
5346 0.1f, false); 5359 SetElementIdsForTesting();
5360
5361 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(),
5362 10.0, 0.9f, 0.1f, false);
5347 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5363 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5348 // Text LCD should be adjusted while animation is active. 5364 // Text LCD should be adjusted while animation is active.
5349 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5365 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5350 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); 5366 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText());
5351 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText()); 5367 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText());
5352 } 5368 }
5353 5369
5354 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { 5370 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
5355 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; 5371 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
5356 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; 5372 bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
5357 5373
5358 // Sanity check: Make sure can_use_lcd_text_ is set on each node. 5374 // Sanity check: Make sure can_use_lcd_text_ is set on each node.
5359 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5375 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5360 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5376 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5361 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); 5377 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText());
5362 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5378 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5379 SetElementIdsForTesting();
5363 5380
5364 // Mark contents non-opaque within the first animation frame. 5381 // Mark contents non-opaque within the first animation frame.
5365 child_->SetContentsOpaque(false); 5382 child_->SetContentsOpaque(false);
5366 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, 5383 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(),
5367 0.1f, false); 5384 10.0, 0.9f, 0.1f, false);
5368 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5385 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5369 // LCD text should be disabled for non-opaque layers even during animations. 5386 // LCD text should be disabled for non-opaque layers even during animations.
5370 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5387 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5371 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); 5388 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText());
5372 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5389 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5373 } 5390 }
5374 5391
5375 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 5392 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
5376 LCDTextTest, 5393 LCDTextTest,
5377 testing::Combine(testing::Bool(), 5394 testing::Combine(testing::Bool(),
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
7122 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(), 7139 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(),
7123 gfx::PointF(), gfx::Size(100, 100), true, false, 7140 gfx::PointF(), gfx::Size(100, 100), true, false,
7124 false); 7141 false);
7125 7142
7126 gfx::Transform end_scale; 7143 gfx::Transform end_scale;
7127 end_scale.Scale(2.f, 2.f); 7144 end_scale.Scale(2.f, 2.f);
7128 TransformOperations start_operations; 7145 TransformOperations start_operations;
7129 start_operations.AppendMatrix(start_scale); 7146 start_operations.AppendMatrix(start_scale);
7130 TransformOperations end_operations; 7147 TransformOperations end_operations;
7131 end_operations.AppendMatrix(end_scale); 7148 end_operations.AppendMatrix(end_scale);
7132 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), 7149 SetElementIdsForTesting();
7133 1.0, start_operations, end_operations); 7150
7151 AddAnimatedTransformToElementWithPlayer(animated_layer->element_id(),
7152 timeline_impl(), 1.0,
7153 start_operations, end_operations);
7134 gfx::Vector2dF scroll_delta(5.f, 9.f); 7154 gfx::Vector2dF scroll_delta(5.f, 9.f);
7135 SetScrollOffsetDelta(scroller, scroll_delta); 7155 SetScrollOffsetDelta(scroller, scroll_delta);
7136 7156
7137 ExecuteCalculateDrawProperties(root); 7157 ExecuteCalculateDrawProperties(root);
7138 7158
7139 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); 7159 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f);
7140 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, 7160 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation,
7141 scroller->DrawTransform().To2dTranslation()); 7161 scroller->DrawTransform().To2dTranslation());
7142 } 7162 }
7143 7163
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
7226 0.f, 7246 0.f,
7227 grand_child_raw->draw_properties().starting_animation_contents_scale); 7247 grand_child_raw->draw_properties().starting_animation_contents_scale);
7228 7248
7229 TransformOperations translation; 7249 TransformOperations translation;
7230 translation.AppendTranslate(1.f, 2.f, 3.f); 7250 translation.AppendTranslate(1.f, 2.f, 3.f);
7231 7251
7232 scoped_refptr<AnimationTimeline> timeline; 7252 scoped_refptr<AnimationTimeline> timeline;
7233 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 7253 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
7234 host_impl.animation_host()->AddAnimationTimeline(timeline); 7254 host_impl.animation_host()->AddAnimationTimeline(timeline);
7235 7255
7236 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7256 host_impl.active_tree()->SetElementIdsForTesting();
7237 TransformOperations(), translation); 7257 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7258 1.0, TransformOperations(),
7259 translation);
7238 7260
7239 // No layers have scale-affecting animations. 7261 // No layers have scale-affecting animations.
7240 EXPECT_EQ( 7262 EXPECT_EQ(
7241 0.f, 7263 0.f,
7242 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7264 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7243 EXPECT_EQ(0.f, 7265 EXPECT_EQ(0.f,
7244 parent_raw->draw_properties().maximum_animation_contents_scale); 7266 parent_raw->draw_properties().maximum_animation_contents_scale);
7245 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7267 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7246 EXPECT_EQ( 7268 EXPECT_EQ(
7247 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7269 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7248 7270
7249 EXPECT_EQ( 7271 EXPECT_EQ(
7250 0.f, 7272 0.f,
7251 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7273 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7252 EXPECT_EQ(0.f, 7274 EXPECT_EQ(0.f,
7253 parent_raw->draw_properties().starting_animation_contents_scale); 7275 parent_raw->draw_properties().starting_animation_contents_scale);
7254 EXPECT_EQ(0.f, 7276 EXPECT_EQ(0.f,
7255 child_raw->draw_properties().starting_animation_contents_scale); 7277 child_raw->draw_properties().starting_animation_contents_scale);
7256 EXPECT_EQ( 7278 EXPECT_EQ(
7257 0.f, 7279 0.f,
7258 grand_child_raw->draw_properties().starting_animation_contents_scale); 7280 grand_child_raw->draw_properties().starting_animation_contents_scale);
7259 7281
7260 TransformOperations scale; 7282 TransformOperations scale;
7261 scale.AppendScale(5.f, 4.f, 3.f); 7283 scale.AppendScale(5.f, 4.f, 3.f);
7262 7284
7263 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, 7285 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline,
7264 TransformOperations(), scale); 7286 1.0, TransformOperations(), scale);
7265 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7287 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7266 ExecuteCalculateDrawProperties(grand_parent_raw); 7288 ExecuteCalculateDrawProperties(grand_parent_raw);
7267 7289
7268 // Only |child| has a scale-affecting animation. 7290 // Only |child| has a scale-affecting animation.
7269 EXPECT_EQ( 7291 EXPECT_EQ(
7270 0.f, 7292 0.f,
7271 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7293 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7272 EXPECT_EQ(0.f, 7294 EXPECT_EQ(0.f,
7273 parent_raw->draw_properties().maximum_animation_contents_scale); 7295 parent_raw->draw_properties().maximum_animation_contents_scale);
7274 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale); 7296 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale);
7275 EXPECT_EQ( 7297 EXPECT_EQ(
7276 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7298 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7277 7299
7278 EXPECT_EQ( 7300 EXPECT_EQ(
7279 0.f, 7301 0.f,
7280 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7302 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7281 EXPECT_EQ(0.f, 7303 EXPECT_EQ(0.f,
7282 parent_raw->draw_properties().starting_animation_contents_scale); 7304 parent_raw->draw_properties().starting_animation_contents_scale);
7283 EXPECT_EQ(1.f, 7305 EXPECT_EQ(1.f,
7284 child_raw->draw_properties().starting_animation_contents_scale); 7306 child_raw->draw_properties().starting_animation_contents_scale);
7285 EXPECT_EQ( 7307 EXPECT_EQ(
7286 1.f, 7308 1.f,
7287 grand_child_raw->draw_properties().starting_animation_contents_scale); 7309 grand_child_raw->draw_properties().starting_animation_contents_scale);
7288 7310
7289 AddAnimatedTransformToLayerWithPlayer(grand_parent_raw->id(), timeline, 1.0, 7311 AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(),
7290 TransformOperations(), scale); 7312 timeline, 1.0, TransformOperations(),
7313 scale);
7291 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7314 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7292 ExecuteCalculateDrawProperties(grand_parent_raw); 7315 ExecuteCalculateDrawProperties(grand_parent_raw);
7293 7316
7294 // |grand_parent| and |child| have scale-affecting animations. 7317 // |grand_parent| and |child| have scale-affecting animations.
7295 EXPECT_EQ( 7318 EXPECT_EQ(
7296 5.f, 7319 5.f,
7297 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7320 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7298 EXPECT_EQ(5.f, 7321 EXPECT_EQ(5.f,
7299 parent_raw->draw_properties().maximum_animation_contents_scale); 7322 parent_raw->draw_properties().maximum_animation_contents_scale);
7300 // We don't support combining animated scales from two nodes; 0.f means 7323 // We don't support combining animated scales from two nodes; 0.f means
7301 // that the maximum scale could not be computed. 7324 // that the maximum scale could not be computed.
7302 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7325 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7303 EXPECT_EQ( 7326 EXPECT_EQ(
7304 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7327 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7305 7328
7306 EXPECT_EQ( 7329 EXPECT_EQ(
7307 1.f, 7330 1.f,
7308 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7331 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7309 EXPECT_EQ(1.f, 7332 EXPECT_EQ(1.f,
7310 parent_raw->draw_properties().starting_animation_contents_scale); 7333 parent_raw->draw_properties().starting_animation_contents_scale);
7311 EXPECT_EQ(0.f, 7334 EXPECT_EQ(0.f,
7312 child_raw->draw_properties().starting_animation_contents_scale); 7335 child_raw->draw_properties().starting_animation_contents_scale);
7313 EXPECT_EQ( 7336 EXPECT_EQ(
7314 0.f, 7337 0.f,
7315 grand_child_raw->draw_properties().starting_animation_contents_scale); 7338 grand_child_raw->draw_properties().starting_animation_contents_scale);
7316 7339
7317 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7340 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7318 TransformOperations(), scale); 7341 1.0, TransformOperations(), scale);
7319 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7342 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7320 ExecuteCalculateDrawProperties(grand_parent_raw); 7343 ExecuteCalculateDrawProperties(grand_parent_raw);
7321 7344
7322 // |grand_parent|, |parent|, and |child| have scale-affecting animations. 7345 // |grand_parent|, |parent|, and |child| have scale-affecting animations.
7323 EXPECT_EQ( 7346 EXPECT_EQ(
7324 5.f, 7347 5.f,
7325 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7348 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7326 EXPECT_EQ(0.f, 7349 EXPECT_EQ(0.f,
7327 parent_raw->draw_properties().maximum_animation_contents_scale); 7350 parent_raw->draw_properties().maximum_animation_contents_scale);
7328 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7351 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7329 EXPECT_EQ( 7352 EXPECT_EQ(
7330 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7353 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7331 7354
7332 EXPECT_EQ( 7355 EXPECT_EQ(
7333 1.f, 7356 1.f,
7334 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7357 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7335 EXPECT_EQ(0.f, 7358 EXPECT_EQ(0.f,
7336 parent_raw->draw_properties().starting_animation_contents_scale); 7359 parent_raw->draw_properties().starting_animation_contents_scale);
7337 EXPECT_EQ(0.f, 7360 EXPECT_EQ(0.f,
7338 child_raw->draw_properties().starting_animation_contents_scale); 7361 child_raw->draw_properties().starting_animation_contents_scale);
7339 EXPECT_EQ( 7362 EXPECT_EQ(
7340 0.f, 7363 0.f,
7341 grand_child_raw->draw_properties().starting_animation_contents_scale); 7364 grand_child_raw->draw_properties().starting_animation_contents_scale);
7342 7365
7343 AbortAnimationsOnLayerWithPlayer(grand_parent_raw->id(), timeline, 7366 AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline,
7344 TargetProperty::TRANSFORM); 7367 TargetProperty::TRANSFORM);
7345 AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, 7368 AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline,
7346 TargetProperty::TRANSFORM); 7369 TargetProperty::TRANSFORM);
7347 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, 7370 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline,
7348 TargetProperty::TRANSFORM); 7371 TargetProperty::TRANSFORM);
7349 7372
7350 TransformOperations perspective; 7373 TransformOperations perspective;
7351 perspective.AppendPerspective(10.f); 7374 perspective.AppendPerspective(10.f);
7352 7375
7353 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, 7376 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline,
7354 TransformOperations(), perspective); 7377 1.0, TransformOperations(),
7378 perspective);
7355 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7379 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7356 ExecuteCalculateDrawProperties(grand_parent_raw); 7380 ExecuteCalculateDrawProperties(grand_parent_raw);
7357 7381
7358 // |child| has a scale-affecting animation but computing the maximum of this 7382 // |child| has a scale-affecting animation but computing the maximum of this
7359 // animation is not supported. 7383 // animation is not supported.
7360 EXPECT_EQ( 7384 EXPECT_EQ(
7361 0.f, 7385 0.f,
7362 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7386 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7363 EXPECT_EQ(0.f, 7387 EXPECT_EQ(0.f,
7364 parent_raw->draw_properties().maximum_animation_contents_scale); 7388 parent_raw->draw_properties().maximum_animation_contents_scale);
7365 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7389 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7366 EXPECT_EQ( 7390 EXPECT_EQ(
7367 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7391 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7368 7392
7369 EXPECT_EQ( 7393 EXPECT_EQ(
7370 0.f, 7394 0.f,
7371 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7395 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7372 EXPECT_EQ(0.f, 7396 EXPECT_EQ(0.f,
7373 parent_raw->draw_properties().starting_animation_contents_scale); 7397 parent_raw->draw_properties().starting_animation_contents_scale);
7374 EXPECT_EQ(0.f, 7398 EXPECT_EQ(0.f,
7375 child_raw->draw_properties().starting_animation_contents_scale); 7399 child_raw->draw_properties().starting_animation_contents_scale);
7376 EXPECT_EQ( 7400 EXPECT_EQ(
7377 0.f, 7401 0.f,
7378 grand_child_raw->draw_properties().starting_animation_contents_scale); 7402 grand_child_raw->draw_properties().starting_animation_contents_scale);
7379 7403
7380 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, 7404 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline,
7381 TargetProperty::TRANSFORM); 7405 TargetProperty::TRANSFORM);
7382 gfx::Transform scale_matrix; 7406 gfx::Transform scale_matrix;
7383 scale_matrix.Scale(1.f, 2.f); 7407 scale_matrix.Scale(1.f, 2.f);
7384 grand_parent_raw->SetTransform(scale_matrix); 7408 grand_parent_raw->SetTransform(scale_matrix);
7385 parent_raw->SetTransform(scale_matrix); 7409 parent_raw->SetTransform(scale_matrix);
7386 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7410 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7387 7411
7388 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7412 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7389 TransformOperations(), scale); 7413 1.0, TransformOperations(), scale);
7390 ExecuteCalculateDrawProperties(grand_parent_raw); 7414 ExecuteCalculateDrawProperties(grand_parent_raw);
7391 7415
7392 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale 7416 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale
7393 // animation with maximum scale 5.f. 7417 // animation with maximum scale 5.f.
7394 EXPECT_EQ( 7418 EXPECT_EQ(
7395 0.f, 7419 0.f,
7396 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7420 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7397 EXPECT_EQ(10.f, 7421 EXPECT_EQ(10.f,
7398 parent_raw->draw_properties().maximum_animation_contents_scale); 7422 parent_raw->draw_properties().maximum_animation_contents_scale);
7399 EXPECT_EQ(10.f, 7423 EXPECT_EQ(10.f,
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
7782 std::unique_ptr<LayerImpl> child2 = 7806 std::unique_ptr<LayerImpl> child2 =
7783 LayerImpl::Create(host_impl.active_tree(), 3); 7807 LayerImpl::Create(host_impl.active_tree(), 3);
7784 LayerImpl* child2_layer = child2.get(); 7808 LayerImpl* child2_layer = child2.get();
7785 7809
7786 root->AddChild(std::move(child1)); 7810 root->AddChild(std::move(child1));
7787 root->AddChild(std::move(child2)); 7811 root->AddChild(std::move(child2));
7788 root->test_properties()->force_render_surface = true; 7812 root->test_properties()->force_render_surface = true;
7789 root->SetDrawsContent(true); 7813 root->SetDrawsContent(true);
7790 host_impl.active_tree()->SetRootLayer(std::move(root)); 7814 host_impl.active_tree()->SetRootLayer(std::move(root));
7791 7815
7816 host_impl.active_tree()->SetElementIdsForTesting();
7817
7792 gfx::Transform identity_matrix, scale_transform_child1, 7818 gfx::Transform identity_matrix, scale_transform_child1,
7793 scale_transform_child2; 7819 scale_transform_child2;
7794 scale_transform_child1.Scale(2, 3); 7820 scale_transform_child1.Scale(2, 3);
7795 scale_transform_child2.Scale(4, 5); 7821 scale_transform_child2.Scale(4, 5);
7796 7822
7797 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), 7823 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
7798 gfx::PointF(), gfx::Size(1, 1), true, false, 7824 gfx::PointF(), gfx::Size(1, 1), true, false,
7799 true); 7825 true);
7800 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, 7826 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1,
7801 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7827 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
(...skipping 10 matching lines...) Expand all
7812 7838
7813 ExecuteCalculateDrawProperties(root_layer); 7839 ExecuteCalculateDrawProperties(root_layer);
7814 7840
7815 TransformOperations scale; 7841 TransformOperations scale;
7816 scale.AppendScale(5.f, 8.f, 3.f); 7842 scale.AppendScale(5.f, 8.f, 3.f);
7817 7843
7818 scoped_refptr<AnimationTimeline> timeline = 7844 scoped_refptr<AnimationTimeline> timeline =
7819 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 7845 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
7820 host_impl.animation_host()->AddAnimationTimeline(timeline); 7846 host_impl.animation_host()->AddAnimationTimeline(timeline);
7821 7847
7822 AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0,
7823 TransformOperations(), scale);
7824
7825 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, 7848 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2,
7826 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7849 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
7827 true, false, false); 7850 true, false, false);
7828 child2_layer->SetDrawsContent(true); 7851 child2_layer->SetDrawsContent(true);
7829 7852
7853 AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline,
7854 1.0, TransformOperations(), scale);
7855
7830 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; 7856 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
7831 ExecuteCalculateDrawProperties(root_layer); 7857 ExecuteCalculateDrawProperties(root_layer);
7832 7858
7833 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); 7859 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale());
7834 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); 7860 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale());
7835 EXPECT_FLOAT_EQ(3.f, child1_layer->mask_layer()->GetIdealContentsScale()); 7861 EXPECT_FLOAT_EQ(3.f, child1_layer->mask_layer()->GetIdealContentsScale());
7836 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); 7862 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale());
7837 7863
7838 EXPECT_FLOAT_EQ( 7864 EXPECT_FLOAT_EQ(
7839 0.f, root_layer->draw_properties().maximum_animation_contents_scale); 7865 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
8087 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { 8113 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) {
8088 const gfx::Transform identity_matrix; 8114 const gfx::Transform identity_matrix;
8089 scoped_refptr<Layer> root = Layer::Create(); 8115 scoped_refptr<Layer> root = Layer::Create();
8090 scoped_refptr<LayerWithForcedDrawsContent> animated = 8116 scoped_refptr<LayerWithForcedDrawsContent> animated =
8091 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8117 make_scoped_refptr(new LayerWithForcedDrawsContent());
8092 8118
8093 root->AddChild(animated); 8119 root->AddChild(animated);
8094 8120
8095 host()->SetRootLayer(root); 8121 host()->SetRootLayer(root);
8096 8122
8123 host()->SetElementIdsForTesting();
8124
8097 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 8125 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
8098 gfx::PointF(), gfx::Size(100, 100), true, false); 8126 gfx::PointF(), gfx::Size(100, 100), true, false);
8099 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 8127 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
8100 gfx::PointF(), gfx::Size(20, 20), true, false); 8128 gfx::PointF(), gfx::Size(20, 20), true, false);
8101 8129
8102 root->SetMasksToBounds(true); 8130 root->SetMasksToBounds(true);
8103 root->SetForceRenderSurfaceForTesting(true); 8131 root->SetForceRenderSurfaceForTesting(true);
8104 animated->SetOpacity(0.f); 8132 animated->SetOpacity(0.f);
8105 8133
8106 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, 8134 AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(),
8107 1.f, false); 8135 10.0, 0.f, 1.f, false);
8108 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8136 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8109 8137
8110 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); 8138 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty());
8111 } 8139 }
8112 8140
8113 TEST_F(LayerTreeHostCommonTest, 8141 TEST_F(LayerTreeHostCommonTest,
8114 VisibleContentRectForAnimatedLayerWithSingularTransform) { 8142 VisibleContentRectForAnimatedLayerWithSingularTransform) {
8115 const gfx::Transform identity_matrix; 8143 const gfx::Transform identity_matrix;
8116 scoped_refptr<Layer> root = Layer::Create(); 8144 scoped_refptr<Layer> root = Layer::Create();
8117 scoped_refptr<Layer> clip = Layer::Create(); 8145 scoped_refptr<Layer> clip = Layer::Create();
8118 scoped_refptr<LayerWithForcedDrawsContent> animated = 8146 scoped_refptr<LayerWithForcedDrawsContent> animated =
8119 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8147 make_scoped_refptr(new LayerWithForcedDrawsContent());
8120 scoped_refptr<LayerWithForcedDrawsContent> surface = 8148 scoped_refptr<LayerWithForcedDrawsContent> surface =
8121 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8149 make_scoped_refptr(new LayerWithForcedDrawsContent());
8122 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = 8150 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation =
8123 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8151 make_scoped_refptr(new LayerWithForcedDrawsContent());
8124 8152
8125 root->AddChild(clip); 8153 root->AddChild(clip);
8126 clip->AddChild(animated); 8154 clip->AddChild(animated);
8127 animated->AddChild(surface); 8155 animated->AddChild(surface);
8128 surface->AddChild(descendant_of_animation); 8156 surface->AddChild(descendant_of_animation);
8129 8157
8130 clip->SetMasksToBounds(true); 8158 clip->SetMasksToBounds(true);
8131 surface->SetForceRenderSurfaceForTesting(true); 8159 surface->SetForceRenderSurfaceForTesting(true);
8132 8160
8133 host()->SetRootLayer(root); 8161 host()->SetRootLayer(root);
8134 8162
8163 host()->SetElementIdsForTesting();
8164
8135 gfx::Transform uninvertible_matrix; 8165 gfx::Transform uninvertible_matrix;
8136 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); 8166 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f);
8137 8167
8138 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 8168 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
8139 gfx::PointF(), gfx::Size(100, 100), true, false); 8169 gfx::PointF(), gfx::Size(100, 100), true, false);
8140 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(), 8170 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(),
8141 gfx::PointF(), gfx::Size(10, 10), true, false); 8171 gfx::PointF(), gfx::Size(10, 10), true, false);
8142 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix, 8172 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix,
8143 gfx::Point3F(), gfx::PointF(), 8173 gfx::Point3F(), gfx::PointF(),
8144 gfx::Size(120, 120), true, false); 8174 gfx::Size(120, 120), true, false);
8145 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), 8175 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(),
8146 gfx::PointF(), gfx::Size(100, 100), true, false); 8176 gfx::PointF(), gfx::Size(100, 100), true, false);
8147 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix, 8177 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix,
8148 gfx::Point3F(), gfx::PointF(), 8178 gfx::Point3F(), gfx::PointF(),
8149 gfx::Size(200, 200), true, false); 8179 gfx::Size(200, 200), true, false);
8150 8180
8151 TransformOperations start_transform_operations; 8181 TransformOperations start_transform_operations;
8152 start_transform_operations.AppendMatrix(uninvertible_matrix); 8182 start_transform_operations.AppendMatrix(uninvertible_matrix);
8153 TransformOperations end_transform_operations; 8183 TransformOperations end_transform_operations;
8154 8184
8155 AddAnimatedTransformToLayerWithPlayer(animated->id(), timeline(), 10.0, 8185 SetElementIdsForTesting();
8156 start_transform_operations, 8186 AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(),
8157 end_transform_operations); 8187 10.0, start_transform_operations,
8188 end_transform_operations);
8158 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8189 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8159 8190
8160 // The animated layer has a singular transform and maps to a non-empty rect in 8191 // The animated layer has a singular transform and maps to a non-empty rect in
8161 // clipped target space, so is treated as fully visible. 8192 // clipped target space, so is treated as fully visible.
8162 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); 8193 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing());
8163 8194
8164 // The singular transform on |animated| is flattened when inherited by 8195 // The singular transform on |animated| is flattened when inherited by
8165 // |surface|, and this happens to make it invertible. 8196 // |surface|, and this happens to make it invertible.
8166 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); 8197 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing());
8167 EXPECT_EQ(gfx::Rect(2, 2), 8198 EXPECT_EQ(gfx::Rect(2, 2),
(...skipping 26 matching lines...) Expand all
8194 LayerImpl* grandchild = AddChild<LayerImpl>(child); 8225 LayerImpl* grandchild = AddChild<LayerImpl>(child);
8195 8226
8196 gfx::Transform identity_transform; 8227 gfx::Transform identity_transform;
8197 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 8228 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
8198 gfx::PointF(), gfx::Size(50, 50), true, false); 8229 gfx::PointF(), gfx::Size(50, 50), true, false);
8199 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), 8230 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(),
8200 gfx::PointF(), gfx::Size(50, 50), true, false); 8231 gfx::PointF(), gfx::Size(50, 50), true, false);
8201 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), 8232 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(),
8202 gfx::PointF(), gfx::Size(50, 50), true, false); 8233 gfx::PointF(), gfx::Size(50, 50), true, false);
8203 8234
8204 AddAnimatedFilterToLayerWithPlayer(child->id(), timeline_impl(), 10.0, 0.1f, 8235 SetElementIdsForTesting();
8205 0.2f); 8236 AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(),
8237 10.0, 0.1f, 0.2f);
8206 ExecuteCalculateDrawProperties(root); 8238 ExecuteCalculateDrawProperties(root);
8207 8239
8208 EXPECT_TRUE(root->has_render_surface()); 8240 EXPECT_TRUE(root->has_render_surface());
8209 EXPECT_TRUE(child->has_render_surface()); 8241 EXPECT_TRUE(child->has_render_surface());
8210 EXPECT_FALSE(grandchild->has_render_surface()); 8242 EXPECT_FALSE(grandchild->has_render_surface());
8211 8243
8212 EXPECT_TRUE(root->filters().IsEmpty()); 8244 EXPECT_TRUE(root->filters().IsEmpty());
8213 EXPECT_TRUE(child->filters().IsEmpty()); 8245 EXPECT_TRUE(child->filters().IsEmpty());
8214 EXPECT_TRUE(grandchild->filters().IsEmpty()); 8246 EXPECT_TRUE(grandchild->filters().IsEmpty());
8215 8247
(...skipping 10 matching lines...) Expand all
8226 LayerImpl* grandchild = AddChild<LayerImpl>(child); 8258 LayerImpl* grandchild = AddChild<LayerImpl>(child);
8227 8259
8228 gfx::Transform identity_transform; 8260 gfx::Transform identity_transform;
8229 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 8261 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
8230 gfx::PointF(), gfx::Size(50, 50), true, false); 8262 gfx::PointF(), gfx::Size(50, 50), true, false);
8231 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), 8263 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(),
8232 gfx::PointF(), gfx::Size(50, 50), true, false); 8264 gfx::PointF(), gfx::Size(50, 50), true, false);
8233 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), 8265 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(),
8234 gfx::PointF(), gfx::Size(50, 50), true, false); 8266 gfx::PointF(), gfx::Size(50, 50), true, false);
8235 8267
8268 SetElementIdsForTesting();
8269
8236 std::unique_ptr<KeyframedFilterAnimationCurve> curve( 8270 std::unique_ptr<KeyframedFilterAnimationCurve> curve(
8237 KeyframedFilterAnimationCurve::Create()); 8271 KeyframedFilterAnimationCurve::Create());
8238 FilterOperations start_filters; 8272 FilterOperations start_filters;
8239 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); 8273 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f));
8240 FilterOperations end_filters; 8274 FilterOperations end_filters;
8241 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); 8275 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f));
8242 curve->AddKeyframe( 8276 curve->AddKeyframe(
8243 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); 8277 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
8244 curve->AddKeyframe(FilterKeyframe::Create( 8278 curve->AddKeyframe(FilterKeyframe::Create(
8245 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); 8279 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr));
8246 std::unique_ptr<Animation> animation = 8280 std::unique_ptr<Animation> animation =
8247 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); 8281 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER);
8248 animation->set_fill_mode(Animation::FillMode::NONE); 8282 animation->set_fill_mode(Animation::FillMode::NONE);
8249 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8283 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8250 8284
8251 AddAnimationToLayerWithPlayer(child->id(), timeline_impl(), 8285 AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(),
8252 std::move(animation)); 8286 std::move(animation));
8253 ExecuteCalculateDrawProperties(root); 8287 ExecuteCalculateDrawProperties(root);
8254 8288
8255 EXPECT_TRUE(root->has_render_surface()); 8289 EXPECT_TRUE(root->has_render_surface());
8256 EXPECT_TRUE(child->has_render_surface()); 8290 EXPECT_TRUE(child->has_render_surface());
8257 EXPECT_FALSE(grandchild->has_render_surface()); 8291 EXPECT_FALSE(grandchild->has_render_surface());
8258 8292
8259 EXPECT_TRUE(root->filters().IsEmpty()); 8293 EXPECT_TRUE(root->filters().IsEmpty());
8260 EXPECT_TRUE(child->filters().IsEmpty()); 8294 EXPECT_TRUE(child->filters().IsEmpty());
8261 EXPECT_TRUE(grandchild->filters().IsEmpty()); 8295 EXPECT_TRUE(grandchild->filters().IsEmpty());
8262 8296
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
8604 gfx::PointF(), gfx::Size(10, 10), true, false); 8638 gfx::PointF(), gfx::Size(10, 10), true, false);
8605 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), 8639 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(),
8606 gfx::PointF(), gfx::Size(10, 10), true, false); 8640 gfx::PointF(), gfx::Size(10, 10), true, false);
8607 8641
8608 root->AddChild(child); 8642 root->AddChild(child);
8609 child->AddChild(grandchild); 8643 child->AddChild(grandchild);
8610 grandchild->AddChild(greatgrandchild); 8644 grandchild->AddChild(greatgrandchild);
8611 8645
8612 host()->SetRootLayer(root); 8646 host()->SetRootLayer(root);
8613 8647
8648 host()->SetElementIdsForTesting();
8649
8614 // Check the non-skipped case. 8650 // Check the non-skipped case.
8615 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8651 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8616 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8652 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8617 8653
8618 // Now we will reset the visible rect from property trees for the grandchild, 8654 // Now we will reset the visible rect from property trees for the grandchild,
8619 // and we will configure |child| in several ways that should force the subtree 8655 // and we will configure |child| in several ways that should force the subtree
8620 // to be skipped. The visible content rect for |grandchild| should, therefore, 8656 // to be skipped. The visible content rect for |grandchild| should, therefore,
8621 // remain empty. 8657 // remain empty.
8622 grandchild->set_visible_layer_rect(gfx::Rect()); 8658 grandchild->set_visible_layer_rect(gfx::Rect());
8623 gfx::Transform singular; 8659 gfx::Transform singular;
(...skipping 14 matching lines...) Expand all
8638 child->SetTransform(zero_z_scale); 8674 child->SetTransform(zero_z_scale);
8639 8675
8640 // Add a transform animation with a start delay. Now, even though |child| has 8676 // Add a transform animation with a start delay. Now, even though |child| has
8641 // a singular transform, the subtree should still get processed. 8677 // a singular transform, the subtree should still get processed.
8642 int animation_id = 0; 8678 int animation_id = 0;
8643 std::unique_ptr<Animation> animation = Animation::Create( 8679 std::unique_ptr<Animation> animation = Animation::Create(
8644 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 8680 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)),
8645 animation_id, 1, TargetProperty::TRANSFORM); 8681 animation_id, 1, TargetProperty::TRANSFORM);
8646 animation->set_fill_mode(Animation::FillMode::NONE); 8682 animation->set_fill_mode(Animation::FillMode::NONE);
8647 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8683 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8648 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); 8684 AddAnimationToElementWithPlayer(child->element_id(), timeline(),
8685 std::move(animation));
8649 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8686 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8650 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8687 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8651 grandchild->set_visible_layer_rect(gfx::Rect()); 8688 grandchild->set_visible_layer_rect(gfx::Rect());
8652 8689
8653 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), 8690 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(),
8654 animation_id); 8691 animation_id);
8655 child->SetTransform(identity); 8692 child->SetTransform(identity);
8656 child->SetOpacity(0.f); 8693 child->SetOpacity(0.f);
8657 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8694 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8658 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8695 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing());
8659 8696
8660 // Now, even though child has zero opacity, we will configure |grandchild| and 8697 // Now, even though child has zero opacity, we will configure |grandchild| and
8661 // |greatgrandchild| in several ways that should force the subtree to be 8698 // |greatgrandchild| in several ways that should force the subtree to be
8662 // processed anyhow. 8699 // processed anyhow.
8663 grandchild->RequestCopyOfOutput( 8700 grandchild->RequestCopyOfOutput(
8664 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); 8701 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback)));
8665 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8702 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8666 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8703 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8667 greatgrandchild->set_visible_layer_rect(gfx::Rect()); 8704 greatgrandchild->set_visible_layer_rect(gfx::Rect());
8668 8705
8669 // Add an opacity animation with a start delay. 8706 // Add an opacity animation with a start delay.
8670 animation_id = 1; 8707 animation_id = 1;
8671 animation = Animation::Create( 8708 animation = Animation::Create(
8672 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 8709 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
8673 animation_id, 1, TargetProperty::OPACITY); 8710 animation_id, 1, TargetProperty::OPACITY);
8674 animation->set_fill_mode(Animation::FillMode::NONE); 8711 animation->set_fill_mode(Animation::FillMode::NONE);
8675 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8712 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8676 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), 8713 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(),
8677 std::move(animation)); 8714 std::move(animation));
8678 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8715 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8679 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8716 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8680 } 8717 }
8681 8718
8682 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { 8719 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) {
8683 FakeImplTaskRunnerProvider task_runner_provider; 8720 FakeImplTaskRunnerProvider task_runner_provider;
8684 TestSharedBitmapManager shared_bitmap_manager; 8721 TestSharedBitmapManager shared_bitmap_manager;
8685 TestTaskGraphRunner task_graph_runner; 8722 TestTaskGraphRunner task_graph_runner;
8686 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8723 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8687 &task_graph_runner); 8724 &task_graph_runner);
(...skipping 24 matching lines...) Expand all
8712 false); 8749 false);
8713 8750
8714 LayerImpl* root_ptr = root.get(); 8751 LayerImpl* root_ptr = root.get();
8715 LayerImpl* child_ptr = child.get(); 8752 LayerImpl* child_ptr = child.get();
8716 LayerImpl* grandchild_ptr = grandchild.get(); 8753 LayerImpl* grandchild_ptr = grandchild.get();
8717 8754
8718 child->AddChild(std::move(grandchild)); 8755 child->AddChild(std::move(grandchild));
8719 root->AddChild(std::move(child)); 8756 root->AddChild(std::move(child));
8720 host_impl.active_tree()->SetRootLayer(std::move(root)); 8757 host_impl.active_tree()->SetRootLayer(std::move(root));
8721 8758
8759 host_impl.active_tree()->SetElementIdsForTesting();
8760
8722 // Check the non-skipped case. 8761 // Check the non-skipped case.
8723 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8762 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8724 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8763 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8725 8764
8726 // Now we will reset the visible rect from property trees for the grandchild, 8765 // Now we will reset the visible rect from property trees for the grandchild,
8727 // and we will configure |child| in several ways that should force the subtree 8766 // and we will configure |child| in several ways that should force the subtree
8728 // to be skipped. The visible content rect for |grandchild| should, therefore, 8767 // to be skipped. The visible content rect for |grandchild| should, therefore,
8729 // remain empty. 8768 // remain empty.
8730 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8769 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8731 8770
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
8807 TransformOperations operation; 8846 TransformOperations operation;
8808 operation.AppendMatrix(transform); 8847 operation.AppendMatrix(transform);
8809 curve->AddKeyframe( 8848 curve->AddKeyframe(
8810 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8849 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8811 curve->AddKeyframe(TransformKeyframe::Create( 8850 curve->AddKeyframe(TransformKeyframe::Create(
8812 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8851 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8813 std::unique_ptr<Animation> transform_animation( 8852 std::unique_ptr<Animation> transform_animation(
8814 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8853 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8815 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8854 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8816 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( 8855 host_impl.active_tree()->animation_host()->RegisterPlayerForElement(
8817 root_ptr->id(), player.get()); 8856 root_ptr->element_id(), player.get());
8818 host_impl.active_tree() 8857 host_impl.active_tree()
8819 ->animation_host() 8858 ->animation_host()
8820 ->GetElementAnimationsForElementId(root_ptr->id()) 8859 ->GetElementAnimationsForElementId(root_ptr->element_id())
8821 ->AddAnimation(std::move(transform_animation)); 8860 ->AddAnimation(std::move(transform_animation));
8822 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8861 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8823 child_ptr->SetScrollClipLayer(root_ptr->id()); 8862 child_ptr->SetScrollClipLayer(root_ptr->id());
8824 root_ptr->SetTransform(singular); 8863 root_ptr->SetTransform(singular);
8825 child_ptr->SetTransform(singular); 8864 child_ptr->SetTransform(singular);
8826 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8865 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8827 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8866 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8828 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8867 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8829 8868
8830 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( 8869 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement(
8831 root_ptr->id(), player.get()); 8870 root_ptr->element_id(), player.get());
8832 } 8871 }
8833 8872
8834 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { 8873 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) {
8835 LayerImpl* root = root_layer(); 8874 LayerImpl* root = root_layer();
8836 LayerImpl* child = AddChild<LayerImpl>(root); 8875 LayerImpl* child = AddChild<LayerImpl>(root);
8837 LayerImpl* grand_child = AddChild<LayerImpl>(child); 8876 LayerImpl* grand_child = AddChild<LayerImpl>(child);
8838 8877
8839 gfx::Transform identity; 8878 gfx::Transform identity;
8840 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 8879 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8841 gfx::Size(10, 10), true, false, true); 8880 gfx::Size(10, 10), true, false, true);
8842 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 8881 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
8843 gfx::Size(10, 10), true, false, false); 8882 gfx::Size(10, 10), true, false, false);
8844 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), 8883 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
8845 gfx::PointF(), gfx::Size(10, 10), true, false, 8884 gfx::PointF(), gfx::Size(10, 10), true, false,
8846 false); 8885 false);
8886 SetElementIdsForTesting();
8847 8887
8848 gfx::Transform singular; 8888 gfx::Transform singular;
8849 singular.matrix().set(0, 0, 0); 8889 singular.matrix().set(0, 0, 0);
8850 singular.matrix().set(0, 1, 1); 8890 singular.matrix().set(0, 1, 1);
8851 8891
8852 child->SetTransform(singular); 8892 child->SetTransform(singular);
8853 child->SetDrawsContent(true); 8893 child->SetDrawsContent(true);
8854 grand_child->SetDrawsContent(true); 8894 grand_child->SetDrawsContent(true);
8855 8895
8856 std::unique_ptr<KeyframedTransformAnimationCurve> curve( 8896 std::unique_ptr<KeyframedTransformAnimationCurve> curve(
8857 KeyframedTransformAnimationCurve::Create()); 8897 KeyframedTransformAnimationCurve::Create());
8858 TransformOperations start; 8898 TransformOperations start;
8859 start.AppendTranslate(1.f, 2.f, 3.f); 8899 start.AppendTranslate(1.f, 2.f, 3.f);
8860 gfx::Transform transform; 8900 gfx::Transform transform;
8861 transform.Scale3d(1.0, 2.0, 3.0); 8901 transform.Scale3d(1.0, 2.0, 3.0);
8862 TransformOperations operation; 8902 TransformOperations operation;
8863 operation.AppendMatrix(transform); 8903 operation.AppendMatrix(transform);
8864 curve->AddKeyframe( 8904 curve->AddKeyframe(
8865 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8905 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8866 curve->AddKeyframe(TransformKeyframe::Create( 8906 curve->AddKeyframe(TransformKeyframe::Create(
8867 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8907 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8868 std::unique_ptr<Animation> transform_animation( 8908 std::unique_ptr<Animation> transform_animation(
8869 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8909 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8870 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8910 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8871 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( 8911 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement(
8872 grand_child->id(), player.get()); 8912 grand_child->element_id(), player.get());
8873 host_impl() 8913 host_impl()
8874 ->active_tree() 8914 ->active_tree()
8875 ->animation_host() 8915 ->animation_host()
8876 ->GetElementAnimationsForElementId(grand_child->id()) 8916 ->GetElementAnimationsForElementId(grand_child->element_id())
8877 ->AddAnimation(std::move(transform_animation)); 8917 ->AddAnimation(std::move(transform_animation));
8878 8918
8879 ExecuteCalculateDrawProperties(root); 8919 ExecuteCalculateDrawProperties(root);
8880 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); 8920 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect());
8881 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 8921 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
8882 8922
8883 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( 8923 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement(
8884 grand_child->id(), player.get()); 8924 grand_child->element_id(), player.get());
8885 } 8925 }
8886 8926
8887 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { 8927 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) {
8888 FakeImplTaskRunnerProvider task_runner_provider; 8928 FakeImplTaskRunnerProvider task_runner_provider;
8889 TestSharedBitmapManager shared_bitmap_manager; 8929 TestSharedBitmapManager shared_bitmap_manager;
8890 TestTaskGraphRunner task_graph_runner; 8930 TestTaskGraphRunner task_graph_runner;
8891 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8931 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8892 &task_graph_runner); 8932 &task_graph_runner);
8893 8933
8894 gfx::Transform identity; 8934 gfx::Transform identity;
(...skipping 22 matching lines...) Expand all
8917 gfx::PointF(), gfx::Size(10, 10), true, false, 8957 gfx::PointF(), gfx::Size(10, 10), true, false,
8918 false); 8958 false);
8919 8959
8920 LayerImpl* root_ptr = root.get(); 8960 LayerImpl* root_ptr = root.get();
8921 LayerImpl* grandchild_ptr = grandchild.get(); 8961 LayerImpl* grandchild_ptr = grandchild.get();
8922 8962
8923 child->AddChild(std::move(grandchild)); 8963 child->AddChild(std::move(grandchild));
8924 root->AddChild(std::move(child)); 8964 root->AddChild(std::move(child));
8925 8965
8926 host_impl.pending_tree()->SetRootLayer(std::move(root)); 8966 host_impl.pending_tree()->SetRootLayer(std::move(root));
8967 host_impl.pending_tree()->SetElementIdsForTesting();
8927 8968
8928 // Check the non-skipped case. 8969 // Check the non-skipped case.
8929 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8970 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8930 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8971 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8931 8972
8932 std::unique_ptr<KeyframedFloatAnimationCurve> curve( 8973 std::unique_ptr<KeyframedFloatAnimationCurve> curve(
8933 KeyframedFloatAnimationCurve::Create()); 8974 KeyframedFloatAnimationCurve::Create());
8934 std::unique_ptr<TimingFunction> func = 8975 std::unique_ptr<TimingFunction> func =
8935 CubicBezierTimingFunction::CreatePreset( 8976 CubicBezierTimingFunction::CreatePreset(
8936 CubicBezierTimingFunction::EaseType::EASE); 8977 CubicBezierTimingFunction::EaseType::EASE);
8937 curve->AddKeyframe( 8978 curve->AddKeyframe(
8938 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); 8979 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func)));
8939 curve->AddKeyframe( 8980 curve->AddKeyframe(
8940 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); 8981 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr));
8941 std::unique_ptr<Animation> animation( 8982 std::unique_ptr<Animation> animation(
8942 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); 8983 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY));
8943 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8984 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8944 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( 8985 host_impl.active_tree()->animation_host()->RegisterPlayerForElement(
8945 root_ptr->id(), player.get()); 8986 root_ptr->element_id(), player.get());
8946 host_impl.active_tree() 8987 host_impl.active_tree()
8947 ->animation_host() 8988 ->animation_host()
8948 ->GetElementAnimationsForElementId(root_ptr->id()) 8989 ->GetElementAnimationsForElementId(root_ptr->element_id())
8949 ->AddAnimation(std::move(animation)); 8990 ->AddAnimation(std::move(animation));
8950 root_ptr->test_properties()->opacity = 0.f; 8991 root_ptr->test_properties()->opacity = 0.f;
8951 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8992 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8952 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8993 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8953 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8994 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8954 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8995 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8955 8996
8956 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( 8997 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement(
8957 root_ptr->id(), player.get()); 8998 root_ptr->element_id(), player.get());
8958 } 8999 }
8959 9000
8960 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { 9001 TEST_F(LayerTreeHostCommonTest, SkippingLayer) {
8961 gfx::Transform identity; 9002 gfx::Transform identity;
8962 LayerImpl* root = root_layer(); 9003 LayerImpl* root = root_layer();
8963 LayerImpl* child = AddChild<LayerImpl>(root); 9004 LayerImpl* child = AddChild<LayerImpl>(root);
8964 9005
8965 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 9006 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8966 gfx::Size(100, 100), true, false, true); 9007 gfx::Size(100, 100), true, false, true);
8967 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 9008 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
9798 9839
9799 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { 9840 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) {
9800 const gfx::Transform identity_matrix; 9841 const gfx::Transform identity_matrix;
9801 scoped_refptr<Layer> root = Layer::Create(); 9842 scoped_refptr<Layer> root = Layer::Create();
9802 scoped_refptr<LayerWithForcedDrawsContent> animated = 9843 scoped_refptr<LayerWithForcedDrawsContent> animated =
9803 make_scoped_refptr(new LayerWithForcedDrawsContent()); 9844 make_scoped_refptr(new LayerWithForcedDrawsContent());
9804 root->AddChild(animated); 9845 root->AddChild(animated);
9805 9846
9806 host()->SetRootLayer(root); 9847 host()->SetRootLayer(root);
9807 9848
9849 host()->SetElementIdsForTesting();
9850
9808 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 9851 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
9809 gfx::PointF(), gfx::Size(100, 100), true, false); 9852 gfx::PointF(), gfx::Size(100, 100), true, false);
9810 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 9853 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
9811 gfx::PointF(), gfx::Size(20, 20), true, false); 9854 gfx::PointF(), gfx::Size(20, 20), true, false);
9812 9855
9813 root->SetForceRenderSurfaceForTesting(true); 9856 root->SetForceRenderSurfaceForTesting(true);
9814 animated->SetOpacity(0.f); 9857 animated->SetOpacity(0.f);
9815 9858
9816 scoped_refptr<AnimationPlayer> player = 9859 scoped_refptr<AnimationPlayer> player =
9817 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 9860 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
9818 timeline()->AttachPlayer(player); 9861 timeline()->AttachPlayer(player);
9819 player->AttachElement(animated->id()); 9862
9863 player->AttachElement(animated->element_id());
9820 9864
9821 int animation_id = 0; 9865 int animation_id = 0;
9822 std::unique_ptr<Animation> animation = Animation::Create( 9866 std::unique_ptr<Animation> animation = Animation::Create(
9823 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 9867 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
9824 animation_id, 1, TargetProperty::OPACITY); 9868 animation_id, 1, TargetProperty::OPACITY);
9825 animation->set_fill_mode(Animation::FillMode::NONE); 9869 animation->set_fill_mode(Animation::FillMode::NONE);
9826 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 9870 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
9827 Animation* animation_ptr = animation.get(); 9871 Animation* animation_ptr = animation.get();
9828 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), 9872 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(),
9829 std::move(animation)); 9873 std::move(animation));
9830 9874
9831 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 9875 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9832 9876
9833 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; 9877 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree;
9834 EffectNode* node = tree.Node(animated->effect_tree_index()); 9878 EffectNode* node = tree.Node(animated->effect_tree_index());
9835 EXPECT_FALSE(node->data.is_currently_animating_opacity); 9879 EXPECT_FALSE(node->data.is_currently_animating_opacity);
9836 EXPECT_TRUE(node->data.has_potential_opacity_animation); 9880 EXPECT_TRUE(node->data.has_potential_opacity_animation);
9837 9881
9838 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); 9882 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0));
9839 root->layer_tree_host()->AnimateLayers( 9883 root->layer_tree_host()->AnimateLayers(
(...skipping 10 matching lines...) Expand all
9850 9894
9851 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { 9895 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) {
9852 const gfx::Transform identity_matrix; 9896 const gfx::Transform identity_matrix;
9853 scoped_refptr<Layer> root = Layer::Create(); 9897 scoped_refptr<Layer> root = Layer::Create();
9854 scoped_refptr<LayerWithForcedDrawsContent> animated = 9898 scoped_refptr<LayerWithForcedDrawsContent> animated =
9855 make_scoped_refptr(new LayerWithForcedDrawsContent()); 9899 make_scoped_refptr(new LayerWithForcedDrawsContent());
9856 root->AddChild(animated); 9900 root->AddChild(animated);
9857 9901
9858 host()->SetRootLayer(root); 9902 host()->SetRootLayer(root);
9859 9903
9904 host()->SetElementIdsForTesting();
9905
9860 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 9906 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
9861 gfx::PointF(), gfx::Size(100, 100), true, false); 9907 gfx::PointF(), gfx::Size(100, 100), true, false);
9862 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 9908 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
9863 gfx::PointF(), gfx::Size(20, 20), true, false); 9909 gfx::PointF(), gfx::Size(20, 20), true, false);
9864 9910
9865 root->SetForceRenderSurfaceForTesting(true); 9911 root->SetForceRenderSurfaceForTesting(true);
9866 9912
9867 scoped_refptr<AnimationPlayer> player = 9913 scoped_refptr<AnimationPlayer> player =
9868 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 9914 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
9869 timeline()->AttachPlayer(player); 9915 timeline()->AttachPlayer(player);
9870 player->AttachElement(animated->id()); 9916 player->AttachElement(animated->element_id());
9871 9917
9872 std::unique_ptr<KeyframedTransformAnimationCurve> curve( 9918 std::unique_ptr<KeyframedTransformAnimationCurve> curve(
9873 KeyframedTransformAnimationCurve::Create()); 9919 KeyframedTransformAnimationCurve::Create());
9874 TransformOperations start; 9920 TransformOperations start;
9875 start.AppendTranslate(1.f, 2.f, 3.f); 9921 start.AppendTranslate(1.f, 2.f, 3.f);
9876 gfx::Transform transform; 9922 gfx::Transform transform;
9877 transform.Scale3d(1.0, 2.0, 3.0); 9923 transform.Scale3d(1.0, 2.0, 3.0);
9878 TransformOperations operation; 9924 TransformOperations operation;
9879 operation.AppendMatrix(transform); 9925 operation.AppendMatrix(transform);
9880 curve->AddKeyframe( 9926 curve->AddKeyframe(
9881 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 9927 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
9882 curve->AddKeyframe(TransformKeyframe::Create( 9928 curve->AddKeyframe(TransformKeyframe::Create(
9883 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 9929 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
9884 std::unique_ptr<Animation> animation( 9930 std::unique_ptr<Animation> animation(
9885 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 9931 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
9886 animation->set_fill_mode(Animation::FillMode::NONE); 9932 animation->set_fill_mode(Animation::FillMode::NONE);
9887 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 9933 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
9888 Animation* animation_ptr = animation.get(); 9934 Animation* animation_ptr = animation.get();
9889 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), 9935 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(),
9890 std::move(animation)); 9936 std::move(animation));
9891 9937
9892 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 9938 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9893 9939
9894 TransformTree& tree = 9940 TransformTree& tree =
9895 root->layer_tree_host()->property_trees()->transform_tree; 9941 root->layer_tree_host()->property_trees()->transform_tree;
9896 TransformNode* node = tree.Node(animated->transform_tree_index()); 9942 TransformNode* node = tree.Node(animated->transform_tree_index());
9897 EXPECT_FALSE(node->data.is_currently_animating); 9943 EXPECT_FALSE(node->data.is_currently_animating);
9898 EXPECT_TRUE(node->data.has_potential_animation); 9944 EXPECT_TRUE(node->data.has_potential_animation);
9899 9945
9900 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); 9946 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
10136 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10182 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10137 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10183 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10138 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10184 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10139 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10185 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10140 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10186 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10141 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10187 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10142 } 10188 }
10143 10189
10144 } // namespace 10190 } // namespace
10145 } // namespace cc 10191 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698