| OLD | NEW |
| 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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2659 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), | 2659 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), |
| 2660 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); | 2660 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); |
| 2661 SetLayerPropertiesForTesting( | 2661 SetLayerPropertiesForTesting( |
| 2662 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), | 2662 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), |
| 2663 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); | 2663 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); |
| 2664 SetLayerPropertiesForTesting( | 2664 SetLayerPropertiesForTesting( |
| 2665 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), | 2665 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), |
| 2666 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); | 2666 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); |
| 2667 | 2667 |
| 2668 parent->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting(); | 2668 parent->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting(); |
| 2669 SetElementIdsForTesting(); |
| 2669 | 2670 |
| 2670 // Put an animated opacity on the render surface. | 2671 // Put an animated opacity on the render surface. |
| 2671 AddOpacityTransitionToLayerWithPlayer(render_surface1->id(), timeline_impl(), | 2672 AddOpacityTransitionToElementWithPlayer( |
| 2672 10.0, 1.f, 0.f, false); | 2673 render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); |
| 2673 | 2674 |
| 2674 // Also put an animated opacity on a layer without descendants. | 2675 // Also put an animated opacity on a layer without descendants. |
| 2675 AddOpacityTransitionToLayerWithPlayer(grand_child_of_root->id(), | 2676 AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(), |
| 2676 timeline_impl(), 10.0, 1.f, 0.f, false); | 2677 timeline_impl(), 10.0, 1.f, 0.f, |
| 2678 false); |
| 2677 | 2679 |
| 2678 // Put a transform animation on the render surface. | 2680 // Put a transform animation on the render surface. |
| 2679 AddAnimatedTransformToLayerWithPlayer(render_surface2->id(), timeline_impl(), | 2681 AddAnimatedTransformToElementWithPlayer(render_surface2->element_id(), |
| 2680 10.0, 30, 0); | 2682 timeline_impl(), 10.0, 30, 0); |
| 2681 | 2683 |
| 2682 // Also put transform animations on grand_child_of_root, and | 2684 // Also put transform animations on grand_child_of_root, and |
| 2683 // grand_child_of_rs2 | 2685 // grand_child_of_rs2 |
| 2684 AddAnimatedTransformToLayerWithPlayer(grand_child_of_root->id(), | 2686 AddAnimatedTransformToElementWithPlayer(grand_child_of_root->element_id(), |
| 2685 timeline_impl(), 10.0, 30, 0); | 2687 timeline_impl(), 10.0, 30, 0); |
| 2686 AddAnimatedTransformToLayerWithPlayer(grand_child_of_rs2->id(), | 2688 AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(), |
| 2687 timeline_impl(), 10.0, 30, 0); | 2689 timeline_impl(), 10.0, 30, 0); |
| 2688 | 2690 |
| 2689 parent->layer_tree_impl()->property_trees()->needs_rebuild = true; | 2691 parent->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 2690 ExecuteCalculateDrawProperties(parent); | 2692 ExecuteCalculateDrawProperties(parent); |
| 2691 | 2693 |
| 2692 // Only layers that are associated with render surfaces should have an actual | 2694 // Only layers that are associated with render surfaces should have an actual |
| 2693 // RenderSurface() value. | 2695 // RenderSurface() value. |
| 2694 ASSERT_TRUE(parent->render_surface()); | 2696 ASSERT_TRUE(parent->render_surface()); |
| 2695 ASSERT_FALSE(child_of_root->render_surface()); | 2697 ASSERT_FALSE(child_of_root->render_surface()); |
| 2696 ASSERT_FALSE(grand_child_of_root->render_surface()); | 2698 ASSERT_FALSE(grand_child_of_root->render_surface()); |
| 2697 | 2699 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 gfx::Size(10, 10), true, false, true); | 2798 gfx::Size(10, 10), true, false, true); |
| 2797 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 2799 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
| 2798 gfx::Size(10, 10), true, false, false); | 2800 gfx::Size(10, 10), true, false, false); |
| 2799 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), | 2801 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), |
| 2800 gfx::PointF(), gfx::Size(10, 10), true, false, | 2802 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 2801 false); | 2803 false); |
| 2802 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), | 2804 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), |
| 2803 gfx::PointF(), gfx::Size(10, 10), true, false, | 2805 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 2804 false); | 2806 false); |
| 2805 | 2807 |
| 2808 SetElementIdsForTesting(); |
| 2809 |
| 2806 // Add a transform animation with a start delay to |grand_child|. | 2810 // Add a transform animation with a start delay to |grand_child|. |
| 2807 std::unique_ptr<Animation> animation = Animation::Create( | 2811 std::unique_ptr<Animation> animation = Animation::Create( |
| 2808 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, | 2812 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, |
| 2809 TargetProperty::TRANSFORM); | 2813 TargetProperty::TRANSFORM); |
| 2810 animation->set_fill_mode(Animation::FillMode::NONE); | 2814 animation->set_fill_mode(Animation::FillMode::NONE); |
| 2811 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 2815 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 2812 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), | 2816 AddAnimationToElementWithPlayer(grand_child->element_id(), timeline_impl(), |
| 2813 std::move(animation)); | 2817 std::move(animation)); |
| 2814 ExecuteCalculateDrawProperties(parent); | 2818 ExecuteCalculateDrawProperties(parent); |
| 2815 | 2819 |
| 2816 EXPECT_FALSE(parent->screen_space_transform_is_animating()); | 2820 EXPECT_FALSE(parent->screen_space_transform_is_animating()); |
| 2817 EXPECT_FALSE(child->screen_space_transform_is_animating()); | 2821 EXPECT_FALSE(child->screen_space_transform_is_animating()); |
| 2818 | 2822 |
| 2819 EXPECT_FALSE(grand_child->TransformIsAnimating()); | 2823 EXPECT_FALSE(grand_child->TransformIsAnimating()); |
| 2820 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); | 2824 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); |
| 2821 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); | 2825 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); |
| 2822 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); | 2826 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); |
| 2823 } | 2827 } |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4524 child2->SetDrawsContent(true); | 4528 child2->SetDrawsContent(true); |
| 4525 animating_surface->SetDrawsContent(true); | 4529 animating_surface->SetDrawsContent(true); |
| 4526 child_of_animating_surface->SetDrawsContent(true); | 4530 child_of_animating_surface->SetDrawsContent(true); |
| 4527 animating_child->SetDrawsContent(true); | 4531 animating_child->SetDrawsContent(true); |
| 4528 | 4532 |
| 4529 gfx::Transform backface_matrix; | 4533 gfx::Transform backface_matrix; |
| 4530 backface_matrix.Translate(50.0, 50.0); | 4534 backface_matrix.Translate(50.0, 50.0); |
| 4531 backface_matrix.RotateAboutYAxis(180.0); | 4535 backface_matrix.RotateAboutYAxis(180.0); |
| 4532 backface_matrix.Translate(-50.0, -50.0); | 4536 backface_matrix.Translate(-50.0, -50.0); |
| 4533 | 4537 |
| 4538 SetElementIdsForTesting(); |
| 4539 |
| 4534 // Animate the transform on the render surface. | 4540 // Animate the transform on the render surface. |
| 4535 AddAnimatedTransformToLayerWithPlayer(animating_surface->id(), | 4541 AddAnimatedTransformToElementWithPlayer(animating_surface->element_id(), |
| 4536 timeline_impl(), 10.0, 30, 0); | 4542 timeline_impl(), 10.0, 30, 0); |
| 4537 // This is just an animating layer, not a surface. | 4543 // This is just an animating layer, not a surface. |
| 4538 AddAnimatedTransformToLayerWithPlayer(animating_child->id(), timeline_impl(), | 4544 AddAnimatedTransformToElementWithPlayer(animating_child->element_id(), |
| 4539 10.0, 30, 0); | 4545 timeline_impl(), 10.0, 30, 0); |
| 4540 | 4546 |
| 4541 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 4547 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 4542 gfx::PointF(), gfx::Size(100, 100), true, false); | 4548 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 4543 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(), | 4549 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(), |
| 4544 gfx::PointF(), gfx::Size(100, 100), true, false); | 4550 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 4545 SetLayerPropertiesForTesting(animating_surface, backface_matrix, | 4551 SetLayerPropertiesForTesting(animating_surface, backface_matrix, |
| 4546 gfx::Point3F(), gfx::PointF(), | 4552 gfx::Point3F(), gfx::PointF(), |
| 4547 gfx::Size(100, 100), true, false, true); | 4553 gfx::Size(100, 100), true, false, true); |
| 4548 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix, | 4554 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix, |
| 4549 gfx::Point3F(), gfx::PointF(), | 4555 gfx::Point3F(), gfx::PointF(), |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5141 false); | 5147 false); |
| 5142 child->SetDrawsContent(true); | 5148 child->SetDrawsContent(true); |
| 5143 child->test_properties()->opacity = 0.0f; | 5149 child->test_properties()->opacity = 0.0f; |
| 5144 | 5150 |
| 5145 const int child_id = child->id(); | 5151 const int child_id = child->id(); |
| 5146 root->test_properties()->AddChild(std::move(child)); | 5152 root->test_properties()->AddChild(std::move(child)); |
| 5147 root->SetHasRenderSurface(true); | 5153 root->SetHasRenderSurface(true); |
| 5148 LayerImpl* root_layer = root.get(); | 5154 LayerImpl* root_layer = root.get(); |
| 5149 host_impl.pending_tree()->SetRootLayer(std::move(root)); | 5155 host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| 5150 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); | 5156 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 5157 |
| 5151 // Add opacity animation. | 5158 // Add opacity animation. |
| 5152 scoped_refptr<AnimationTimeline> timeline = | 5159 scoped_refptr<AnimationTimeline> timeline = |
| 5153 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 5160 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 5154 host_impl.animation_host()->AddAnimationTimeline(timeline); | 5161 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 5162 host_impl.pending_tree()->SetElementIdsForTesting(); |
| 5155 | 5163 |
| 5156 AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f, | 5164 ElementId child_element_id = |
| 5157 false); | 5165 host_impl.pending_tree()->LayerById(child_id)->element_id(); |
| 5166 |
| 5167 AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0, |
| 5168 0.0f, 1.0f, false); |
| 5158 | 5169 |
| 5159 LayerImplList render_surface_layer_list; | 5170 LayerImplList render_surface_layer_list; |
| 5160 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5171 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5161 root_layer, root_layer->bounds(), &render_surface_layer_list); | 5172 root_layer, root_layer->bounds(), &render_surface_layer_list); |
| 5162 inputs.can_adjust_raster_scales = true; | 5173 inputs.can_adjust_raster_scales = true; |
| 5163 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 5174 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
| 5164 | 5175 |
| 5165 // We should have one render surface and two layers. The child | 5176 // We should have one render surface and two layers. The child |
| 5166 // layer should be included even though it is transparent. | 5177 // layer should be included even though it is transparent. |
| 5167 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5178 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5259 | 5270 |
| 5260 // Stash raw pointers to look at later. | 5271 // Stash raw pointers to look at later. |
| 5261 root_ = root_ptr.get(); | 5272 root_ = root_ptr.get(); |
| 5262 child_ = child_ptr.get(); | 5273 child_ = child_ptr.get(); |
| 5263 grand_child_ = grand_child_ptr.get(); | 5274 grand_child_ = grand_child_ptr.get(); |
| 5264 | 5275 |
| 5265 child_->test_properties()->AddChild(std::move(grand_child_ptr)); | 5276 child_->test_properties()->AddChild(std::move(grand_child_ptr)); |
| 5266 root_->test_properties()->AddChild(std::move(child_ptr)); | 5277 root_->test_properties()->AddChild(std::move(child_ptr)); |
| 5267 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); | 5278 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); |
| 5268 | 5279 |
| 5280 host_impl_.active_tree()->SetElementIdsForTesting(); |
| 5281 |
| 5269 root_->SetContentsOpaque(true); | 5282 root_->SetContentsOpaque(true); |
| 5270 child_->SetContentsOpaque(true); | 5283 child_->SetContentsOpaque(true); |
| 5271 grand_child_->SetContentsOpaque(true); | 5284 grand_child_->SetContentsOpaque(true); |
| 5272 | 5285 |
| 5273 root_->SetDrawsContent(true); | 5286 root_->SetDrawsContent(true); |
| 5274 child_->SetDrawsContent(true); | 5287 child_->SetDrawsContent(true); |
| 5275 grand_child_->SetDrawsContent(true); | 5288 grand_child_->SetDrawsContent(true); |
| 5276 | 5289 |
| 5277 gfx::Transform identity_matrix; | 5290 gfx::Transform identity_matrix; |
| 5278 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(), | 5291 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5400 | 5413 |
| 5401 // Sanity check: Make sure can_use_lcd_text_ is set on each node. | 5414 // Sanity check: Make sure can_use_lcd_text_ is set on each node. |
| 5402 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); | 5415 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); |
| 5403 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); | 5416 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); |
| 5404 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); | 5417 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); |
| 5405 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); | 5418 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); |
| 5406 | 5419 |
| 5407 // Add opacity animation. | 5420 // Add opacity animation. |
| 5408 child_->test_properties()->opacity = 0.9f; | 5421 child_->test_properties()->opacity = 0.9f; |
| 5409 child_->layer_tree_impl()->property_trees()->needs_rebuild = true; | 5422 child_->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 5410 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, | 5423 |
| 5411 0.1f, false); | 5424 SetElementIdsForTesting(); |
| 5425 |
| 5426 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
| 5427 10.0, 0.9f, 0.1f, false); |
| 5412 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); | 5428 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); |
| 5413 // Text LCD should be adjusted while animation is active. | 5429 // Text LCD should be adjusted while animation is active. |
| 5414 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); | 5430 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); |
| 5415 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); | 5431 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); |
| 5416 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText()); | 5432 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText()); |
| 5417 } | 5433 } |
| 5418 | 5434 |
| 5419 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { | 5435 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { |
| 5420 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; | 5436 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; |
| 5421 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; | 5437 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; |
| 5422 | 5438 |
| 5423 // Sanity check: Make sure can_use_lcd_text_ is set on each node. | 5439 // Sanity check: Make sure can_use_lcd_text_ is set on each node. |
| 5424 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); | 5440 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); |
| 5425 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); | 5441 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); |
| 5426 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); | 5442 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); |
| 5427 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); | 5443 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); |
| 5444 SetElementIdsForTesting(); |
| 5428 | 5445 |
| 5429 // Mark contents non-opaque within the first animation frame. | 5446 // Mark contents non-opaque within the first animation frame. |
| 5430 child_->SetContentsOpaque(false); | 5447 child_->SetContentsOpaque(false); |
| 5431 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, | 5448 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
| 5432 0.1f, false); | 5449 10.0, 0.9f, 0.1f, false); |
| 5433 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); | 5450 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); |
| 5434 // LCD text should be disabled for non-opaque layers even during animations. | 5451 // LCD text should be disabled for non-opaque layers even during animations. |
| 5435 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); | 5452 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); |
| 5436 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); | 5453 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); |
| 5437 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); | 5454 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); |
| 5438 } | 5455 } |
| 5439 | 5456 |
| 5440 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 5457 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 5441 LCDTextTest, | 5458 LCDTextTest, |
| 5442 testing::Combine(testing::Bool(), | 5459 testing::Combine(testing::Bool(), |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7251 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(), | 7268 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(), |
| 7252 gfx::PointF(), gfx::Size(100, 100), true, false, | 7269 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 7253 false); | 7270 false); |
| 7254 | 7271 |
| 7255 gfx::Transform end_scale; | 7272 gfx::Transform end_scale; |
| 7256 end_scale.Scale(2.f, 2.f); | 7273 end_scale.Scale(2.f, 2.f); |
| 7257 TransformOperations start_operations; | 7274 TransformOperations start_operations; |
| 7258 start_operations.AppendMatrix(start_scale); | 7275 start_operations.AppendMatrix(start_scale); |
| 7259 TransformOperations end_operations; | 7276 TransformOperations end_operations; |
| 7260 end_operations.AppendMatrix(end_scale); | 7277 end_operations.AppendMatrix(end_scale); |
| 7261 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), | 7278 SetElementIdsForTesting(); |
| 7262 1.0, start_operations, end_operations); | 7279 |
| 7280 AddAnimatedTransformToElementWithPlayer(animated_layer->element_id(), |
| 7281 timeline_impl(), 1.0, |
| 7282 start_operations, end_operations); |
| 7263 gfx::Vector2dF scroll_delta(5.f, 9.f); | 7283 gfx::Vector2dF scroll_delta(5.f, 9.f); |
| 7264 SetScrollOffsetDelta(scroller, scroll_delta); | 7284 SetScrollOffsetDelta(scroller, scroll_delta); |
| 7265 | 7285 |
| 7266 ExecuteCalculateDrawProperties(root); | 7286 ExecuteCalculateDrawProperties(root); |
| 7267 | 7287 |
| 7268 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); | 7288 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); |
| 7269 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, | 7289 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, |
| 7270 scroller->DrawTransform().To2dTranslation()); | 7290 scroller->DrawTransform().To2dTranslation()); |
| 7271 } | 7291 } |
| 7272 | 7292 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7355 0.f, | 7375 0.f, |
| 7356 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7376 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7357 | 7377 |
| 7358 TransformOperations translation; | 7378 TransformOperations translation; |
| 7359 translation.AppendTranslate(1.f, 2.f, 3.f); | 7379 translation.AppendTranslate(1.f, 2.f, 3.f); |
| 7360 | 7380 |
| 7361 scoped_refptr<AnimationTimeline> timeline; | 7381 scoped_refptr<AnimationTimeline> timeline; |
| 7362 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 7382 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 7363 host_impl.animation_host()->AddAnimationTimeline(timeline); | 7383 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 7364 | 7384 |
| 7365 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, | 7385 host_impl.active_tree()->SetElementIdsForTesting(); |
| 7366 TransformOperations(), translation); | 7386 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7387 1.0, TransformOperations(), |
| 7388 translation); |
| 7367 | 7389 |
| 7368 // No layers have scale-affecting animations. | 7390 // No layers have scale-affecting animations. |
| 7369 EXPECT_EQ( | 7391 EXPECT_EQ( |
| 7370 0.f, | 7392 0.f, |
| 7371 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7393 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7372 EXPECT_EQ(0.f, | 7394 EXPECT_EQ(0.f, |
| 7373 parent_raw->draw_properties().maximum_animation_contents_scale); | 7395 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7374 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7396 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| 7375 EXPECT_EQ( | 7397 EXPECT_EQ( |
| 7376 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7398 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
| 7377 | 7399 |
| 7378 EXPECT_EQ( | 7400 EXPECT_EQ( |
| 7379 0.f, | 7401 0.f, |
| 7380 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7402 grand_parent_raw->draw_properties().starting_animation_contents_scale); |
| 7381 EXPECT_EQ(0.f, | 7403 EXPECT_EQ(0.f, |
| 7382 parent_raw->draw_properties().starting_animation_contents_scale); | 7404 parent_raw->draw_properties().starting_animation_contents_scale); |
| 7383 EXPECT_EQ(0.f, | 7405 EXPECT_EQ(0.f, |
| 7384 child_raw->draw_properties().starting_animation_contents_scale); | 7406 child_raw->draw_properties().starting_animation_contents_scale); |
| 7385 EXPECT_EQ( | 7407 EXPECT_EQ( |
| 7386 0.f, | 7408 0.f, |
| 7387 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7409 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7388 | 7410 |
| 7389 TransformOperations scale; | 7411 TransformOperations scale; |
| 7390 scale.AppendScale(5.f, 4.f, 3.f); | 7412 scale.AppendScale(5.f, 4.f, 3.f); |
| 7391 | 7413 |
| 7392 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, | 7414 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| 7393 TransformOperations(), scale); | 7415 1.0, TransformOperations(), scale); |
| 7394 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7416 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7395 ExecuteCalculateDrawProperties(grand_parent_raw); | 7417 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7396 | 7418 |
| 7397 // Only |child| has a scale-affecting animation. | 7419 // Only |child| has a scale-affecting animation. |
| 7398 EXPECT_EQ( | 7420 EXPECT_EQ( |
| 7399 0.f, | 7421 0.f, |
| 7400 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7422 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7401 EXPECT_EQ(0.f, | 7423 EXPECT_EQ(0.f, |
| 7402 parent_raw->draw_properties().maximum_animation_contents_scale); | 7424 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7403 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7425 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| 7404 EXPECT_EQ( | 7426 EXPECT_EQ( |
| 7405 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7427 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
| 7406 | 7428 |
| 7407 EXPECT_EQ( | 7429 EXPECT_EQ( |
| 7408 0.f, | 7430 0.f, |
| 7409 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7431 grand_parent_raw->draw_properties().starting_animation_contents_scale); |
| 7410 EXPECT_EQ(0.f, | 7432 EXPECT_EQ(0.f, |
| 7411 parent_raw->draw_properties().starting_animation_contents_scale); | 7433 parent_raw->draw_properties().starting_animation_contents_scale); |
| 7412 EXPECT_EQ(1.f, | 7434 EXPECT_EQ(1.f, |
| 7413 child_raw->draw_properties().starting_animation_contents_scale); | 7435 child_raw->draw_properties().starting_animation_contents_scale); |
| 7414 EXPECT_EQ( | 7436 EXPECT_EQ( |
| 7415 1.f, | 7437 1.f, |
| 7416 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7438 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7417 | 7439 |
| 7418 AddAnimatedTransformToLayerWithPlayer(grand_parent_raw->id(), timeline, 1.0, | 7440 AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(), |
| 7419 TransformOperations(), scale); | 7441 timeline, 1.0, TransformOperations(), |
| 7442 scale); |
| 7420 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7443 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7421 ExecuteCalculateDrawProperties(grand_parent_raw); | 7444 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7422 | 7445 |
| 7423 // |grand_parent| and |child| have scale-affecting animations. | 7446 // |grand_parent| and |child| have scale-affecting animations. |
| 7424 EXPECT_EQ( | 7447 EXPECT_EQ( |
| 7425 5.f, | 7448 5.f, |
| 7426 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7449 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7427 EXPECT_EQ(5.f, | 7450 EXPECT_EQ(5.f, |
| 7428 parent_raw->draw_properties().maximum_animation_contents_scale); | 7451 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7429 // We don't support combining animated scales from two nodes; 0.f means | 7452 // We don't support combining animated scales from two nodes; 0.f means |
| 7430 // that the maximum scale could not be computed. | 7453 // that the maximum scale could not be computed. |
| 7431 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7454 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| 7432 EXPECT_EQ( | 7455 EXPECT_EQ( |
| 7433 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7456 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
| 7434 | 7457 |
| 7435 EXPECT_EQ( | 7458 EXPECT_EQ( |
| 7436 1.f, | 7459 1.f, |
| 7437 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7460 grand_parent_raw->draw_properties().starting_animation_contents_scale); |
| 7438 EXPECT_EQ(1.f, | 7461 EXPECT_EQ(1.f, |
| 7439 parent_raw->draw_properties().starting_animation_contents_scale); | 7462 parent_raw->draw_properties().starting_animation_contents_scale); |
| 7440 EXPECT_EQ(0.f, | 7463 EXPECT_EQ(0.f, |
| 7441 child_raw->draw_properties().starting_animation_contents_scale); | 7464 child_raw->draw_properties().starting_animation_contents_scale); |
| 7442 EXPECT_EQ( | 7465 EXPECT_EQ( |
| 7443 0.f, | 7466 0.f, |
| 7444 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7467 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7445 | 7468 |
| 7446 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, | 7469 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7447 TransformOperations(), scale); | 7470 1.0, TransformOperations(), scale); |
| 7448 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7471 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7449 ExecuteCalculateDrawProperties(grand_parent_raw); | 7472 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7450 | 7473 |
| 7451 // |grand_parent|, |parent|, and |child| have scale-affecting animations. | 7474 // |grand_parent|, |parent|, and |child| have scale-affecting animations. |
| 7452 EXPECT_EQ( | 7475 EXPECT_EQ( |
| 7453 5.f, | 7476 5.f, |
| 7454 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7477 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7455 EXPECT_EQ(0.f, | 7478 EXPECT_EQ(0.f, |
| 7456 parent_raw->draw_properties().maximum_animation_contents_scale); | 7479 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7457 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7480 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| 7458 EXPECT_EQ( | 7481 EXPECT_EQ( |
| 7459 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7482 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
| 7460 | 7483 |
| 7461 EXPECT_EQ( | 7484 EXPECT_EQ( |
| 7462 1.f, | 7485 1.f, |
| 7463 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7486 grand_parent_raw->draw_properties().starting_animation_contents_scale); |
| 7464 EXPECT_EQ(0.f, | 7487 EXPECT_EQ(0.f, |
| 7465 parent_raw->draw_properties().starting_animation_contents_scale); | 7488 parent_raw->draw_properties().starting_animation_contents_scale); |
| 7466 EXPECT_EQ(0.f, | 7489 EXPECT_EQ(0.f, |
| 7467 child_raw->draw_properties().starting_animation_contents_scale); | 7490 child_raw->draw_properties().starting_animation_contents_scale); |
| 7468 EXPECT_EQ( | 7491 EXPECT_EQ( |
| 7469 0.f, | 7492 0.f, |
| 7470 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7493 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7471 | 7494 |
| 7472 AbortAnimationsOnLayerWithPlayer(grand_parent_raw->id(), timeline, | 7495 AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline, |
| 7473 TargetProperty::TRANSFORM); | 7496 TargetProperty::TRANSFORM); |
| 7474 AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, | 7497 AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline, |
| 7475 TargetProperty::TRANSFORM); | 7498 TargetProperty::TRANSFORM); |
| 7476 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, | 7499 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| 7477 TargetProperty::TRANSFORM); | 7500 TargetProperty::TRANSFORM); |
| 7478 | 7501 |
| 7479 TransformOperations perspective; | 7502 TransformOperations perspective; |
| 7480 perspective.AppendPerspective(10.f); | 7503 perspective.AppendPerspective(10.f); |
| 7481 | 7504 |
| 7482 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, | 7505 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| 7483 TransformOperations(), perspective); | 7506 1.0, TransformOperations(), |
| 7507 perspective); |
| 7484 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7508 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7485 ExecuteCalculateDrawProperties(grand_parent_raw); | 7509 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7486 | 7510 |
| 7487 // |child| has a scale-affecting animation but computing the maximum of this | 7511 // |child| has a scale-affecting animation but computing the maximum of this |
| 7488 // animation is not supported. | 7512 // animation is not supported. |
| 7489 EXPECT_EQ( | 7513 EXPECT_EQ( |
| 7490 0.f, | 7514 0.f, |
| 7491 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7515 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7492 EXPECT_EQ(0.f, | 7516 EXPECT_EQ(0.f, |
| 7493 parent_raw->draw_properties().maximum_animation_contents_scale); | 7517 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7494 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7518 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| 7495 EXPECT_EQ( | 7519 EXPECT_EQ( |
| 7496 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7520 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
| 7497 | 7521 |
| 7498 EXPECT_EQ( | 7522 EXPECT_EQ( |
| 7499 0.f, | 7523 0.f, |
| 7500 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7524 grand_parent_raw->draw_properties().starting_animation_contents_scale); |
| 7501 EXPECT_EQ(0.f, | 7525 EXPECT_EQ(0.f, |
| 7502 parent_raw->draw_properties().starting_animation_contents_scale); | 7526 parent_raw->draw_properties().starting_animation_contents_scale); |
| 7503 EXPECT_EQ(0.f, | 7527 EXPECT_EQ(0.f, |
| 7504 child_raw->draw_properties().starting_animation_contents_scale); | 7528 child_raw->draw_properties().starting_animation_contents_scale); |
| 7505 EXPECT_EQ( | 7529 EXPECT_EQ( |
| 7506 0.f, | 7530 0.f, |
| 7507 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7531 grand_child_raw->draw_properties().starting_animation_contents_scale); |
| 7508 | 7532 |
| 7509 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, | 7533 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| 7510 TargetProperty::TRANSFORM); | 7534 TargetProperty::TRANSFORM); |
| 7511 gfx::Transform scale_matrix; | 7535 gfx::Transform scale_matrix; |
| 7512 scale_matrix.Scale(1.f, 2.f); | 7536 scale_matrix.Scale(1.f, 2.f); |
| 7513 grand_parent_raw->SetTransform(scale_matrix); | 7537 grand_parent_raw->SetTransform(scale_matrix); |
| 7514 parent_raw->SetTransform(scale_matrix); | 7538 parent_raw->SetTransform(scale_matrix); |
| 7515 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7539 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7516 | 7540 |
| 7517 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, | 7541 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7518 TransformOperations(), scale); | 7542 1.0, TransformOperations(), scale); |
| 7519 ExecuteCalculateDrawProperties(grand_parent_raw); | 7543 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7520 | 7544 |
| 7521 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale | 7545 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale |
| 7522 // animation with maximum scale 5.f. | 7546 // animation with maximum scale 5.f. |
| 7523 EXPECT_EQ( | 7547 EXPECT_EQ( |
| 7524 0.f, | 7548 0.f, |
| 7525 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7549 grand_parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7526 EXPECT_EQ(10.f, | 7550 EXPECT_EQ(10.f, |
| 7527 parent_raw->draw_properties().maximum_animation_contents_scale); | 7551 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7528 EXPECT_EQ(10.f, | 7552 EXPECT_EQ(10.f, |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7916 std::unique_ptr<LayerImpl> child2 = | 7940 std::unique_ptr<LayerImpl> child2 = |
| 7917 LayerImpl::Create(host_impl.active_tree(), 3); | 7941 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7918 LayerImpl* child2_layer = child2.get(); | 7942 LayerImpl* child2_layer = child2.get(); |
| 7919 | 7943 |
| 7920 root->test_properties()->AddChild(std::move(child1)); | 7944 root->test_properties()->AddChild(std::move(child1)); |
| 7921 root->test_properties()->AddChild(std::move(child2)); | 7945 root->test_properties()->AddChild(std::move(child2)); |
| 7922 root->test_properties()->force_render_surface = true; | 7946 root->test_properties()->force_render_surface = true; |
| 7923 root->SetDrawsContent(true); | 7947 root->SetDrawsContent(true); |
| 7924 host_impl.active_tree()->SetRootLayer(std::move(root)); | 7948 host_impl.active_tree()->SetRootLayer(std::move(root)); |
| 7925 | 7949 |
| 7950 host_impl.active_tree()->SetElementIdsForTesting(); |
| 7951 |
| 7926 gfx::Transform identity_matrix, scale_transform_child1, | 7952 gfx::Transform identity_matrix, scale_transform_child1, |
| 7927 scale_transform_child2; | 7953 scale_transform_child2; |
| 7928 scale_transform_child1.Scale(2, 3); | 7954 scale_transform_child1.Scale(2, 3); |
| 7929 scale_transform_child2.Scale(4, 5); | 7955 scale_transform_child2.Scale(4, 5); |
| 7930 | 7956 |
| 7931 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), | 7957 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), |
| 7932 gfx::PointF(), gfx::Size(1, 1), true, false, | 7958 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 7933 true); | 7959 true); |
| 7934 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, | 7960 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, |
| 7935 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), | 7961 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7948 | 7974 |
| 7949 ExecuteCalculateDrawProperties(root_layer); | 7975 ExecuteCalculateDrawProperties(root_layer); |
| 7950 | 7976 |
| 7951 TransformOperations scale; | 7977 TransformOperations scale; |
| 7952 scale.AppendScale(5.f, 8.f, 3.f); | 7978 scale.AppendScale(5.f, 8.f, 3.f); |
| 7953 | 7979 |
| 7954 scoped_refptr<AnimationTimeline> timeline = | 7980 scoped_refptr<AnimationTimeline> timeline = |
| 7955 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 7981 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 7956 host_impl.animation_host()->AddAnimationTimeline(timeline); | 7982 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 7957 | 7983 |
| 7958 AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0, | |
| 7959 TransformOperations(), scale); | |
| 7960 | |
| 7961 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, | 7984 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, |
| 7962 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), | 7985 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| 7963 true, false, false); | 7986 true, false, false); |
| 7964 child2_layer->SetDrawsContent(true); | 7987 child2_layer->SetDrawsContent(true); |
| 7965 | 7988 |
| 7989 AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline, |
| 7990 1.0, TransformOperations(), scale); |
| 7991 |
| 7966 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7992 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7967 ExecuteCalculateDrawProperties(root_layer); | 7993 ExecuteCalculateDrawProperties(root_layer); |
| 7968 | 7994 |
| 7969 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); | 7995 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); |
| 7970 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); | 7996 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); |
| 7971 EXPECT_FLOAT_EQ( | 7997 EXPECT_FLOAT_EQ( |
| 7972 3.f, | 7998 3.f, |
| 7973 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); | 7999 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); |
| 7974 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); | 8000 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); |
| 7975 | 8001 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8203 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 8229 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 8204 const gfx::Transform identity_matrix; | 8230 const gfx::Transform identity_matrix; |
| 8205 scoped_refptr<Layer> root = Layer::Create(); | 8231 scoped_refptr<Layer> root = Layer::Create(); |
| 8206 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8232 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8207 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8233 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8208 | 8234 |
| 8209 root->AddChild(animated); | 8235 root->AddChild(animated); |
| 8210 | 8236 |
| 8211 host()->SetRootLayer(root); | 8237 host()->SetRootLayer(root); |
| 8212 | 8238 |
| 8239 host()->SetElementIdsForTesting(); |
| 8240 |
| 8213 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8241 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8214 gfx::PointF(), gfx::Size(100, 100), true, false); | 8242 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8215 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8243 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8216 gfx::PointF(), gfx::Size(20, 20), true, false); | 8244 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8217 | 8245 |
| 8218 root->SetMasksToBounds(true); | 8246 root->SetMasksToBounds(true); |
| 8219 root->SetForceRenderSurfaceForTesting(true); | 8247 root->SetForceRenderSurfaceForTesting(true); |
| 8220 animated->SetOpacity(0.f); | 8248 animated->SetOpacity(0.f); |
| 8221 | 8249 |
| 8222 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, | 8250 AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(), |
| 8223 1.f, false); | 8251 10.0, 0.f, 1.f, false); |
| 8224 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8252 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8225 | 8253 |
| 8226 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); | 8254 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); |
| 8227 } | 8255 } |
| 8228 | 8256 |
| 8229 TEST_F(LayerTreeHostCommonTest, | 8257 TEST_F(LayerTreeHostCommonTest, |
| 8230 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8258 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8231 const gfx::Transform identity_matrix; | 8259 const gfx::Transform identity_matrix; |
| 8232 scoped_refptr<Layer> root = Layer::Create(); | 8260 scoped_refptr<Layer> root = Layer::Create(); |
| 8233 scoped_refptr<Layer> clip = Layer::Create(); | 8261 scoped_refptr<Layer> clip = Layer::Create(); |
| 8234 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8262 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8235 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8263 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8236 scoped_refptr<LayerWithForcedDrawsContent> surface = | 8264 scoped_refptr<LayerWithForcedDrawsContent> surface = |
| 8237 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8265 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8238 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | 8266 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = |
| 8239 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8267 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8240 | 8268 |
| 8241 root->AddChild(clip); | 8269 root->AddChild(clip); |
| 8242 clip->AddChild(animated); | 8270 clip->AddChild(animated); |
| 8243 animated->AddChild(surface); | 8271 animated->AddChild(surface); |
| 8244 surface->AddChild(descendant_of_animation); | 8272 surface->AddChild(descendant_of_animation); |
| 8245 | 8273 |
| 8246 clip->SetMasksToBounds(true); | 8274 clip->SetMasksToBounds(true); |
| 8247 surface->SetForceRenderSurfaceForTesting(true); | 8275 surface->SetForceRenderSurfaceForTesting(true); |
| 8248 | 8276 |
| 8249 host()->SetRootLayer(root); | 8277 host()->SetRootLayer(root); |
| 8250 | 8278 |
| 8279 host()->SetElementIdsForTesting(); |
| 8280 |
| 8251 gfx::Transform uninvertible_matrix; | 8281 gfx::Transform uninvertible_matrix; |
| 8252 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); | 8282 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); |
| 8253 | 8283 |
| 8254 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8284 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8255 gfx::PointF(), gfx::Size(100, 100), true, false); | 8285 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8256 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(), | 8286 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(), |
| 8257 gfx::PointF(), gfx::Size(10, 10), true, false); | 8287 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8258 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix, | 8288 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix, |
| 8259 gfx::Point3F(), gfx::PointF(), | 8289 gfx::Point3F(), gfx::PointF(), |
| 8260 gfx::Size(120, 120), true, false); | 8290 gfx::Size(120, 120), true, false); |
| 8261 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), | 8291 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), |
| 8262 gfx::PointF(), gfx::Size(100, 100), true, false); | 8292 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8263 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix, | 8293 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix, |
| 8264 gfx::Point3F(), gfx::PointF(), | 8294 gfx::Point3F(), gfx::PointF(), |
| 8265 gfx::Size(200, 200), true, false); | 8295 gfx::Size(200, 200), true, false); |
| 8266 | 8296 |
| 8267 TransformOperations start_transform_operations; | 8297 TransformOperations start_transform_operations; |
| 8268 start_transform_operations.AppendMatrix(uninvertible_matrix); | 8298 start_transform_operations.AppendMatrix(uninvertible_matrix); |
| 8269 TransformOperations end_transform_operations; | 8299 TransformOperations end_transform_operations; |
| 8270 | 8300 |
| 8271 AddAnimatedTransformToLayerWithPlayer(animated->id(), timeline(), 10.0, | 8301 SetElementIdsForTesting(); |
| 8272 start_transform_operations, | 8302 AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(), |
| 8273 end_transform_operations); | 8303 10.0, start_transform_operations, |
| 8304 end_transform_operations); |
| 8274 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8305 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8275 | 8306 |
| 8276 // The animated layer has a singular transform and maps to a non-empty rect in | 8307 // The animated layer has a singular transform and maps to a non-empty rect in |
| 8277 // clipped target space, so is treated as fully visible. | 8308 // clipped target space, so is treated as fully visible. |
| 8278 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); | 8309 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); |
| 8279 | 8310 |
| 8280 // The singular transform on |animated| is flattened when inherited by | 8311 // The singular transform on |animated| is flattened when inherited by |
| 8281 // |surface|, and this happens to make it invertible. | 8312 // |surface|, and this happens to make it invertible. |
| 8282 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); | 8313 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); |
| 8283 EXPECT_EQ(gfx::Rect(2, 2), | 8314 EXPECT_EQ(gfx::Rect(2, 2), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 8310 LayerImpl* grandchild = AddChild<LayerImpl>(child); | 8341 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
| 8311 | 8342 |
| 8312 gfx::Transform identity_transform; | 8343 gfx::Transform identity_transform; |
| 8313 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), | 8344 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
| 8314 gfx::PointF(), gfx::Size(50, 50), true, false); | 8345 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8315 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), | 8346 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), |
| 8316 gfx::PointF(), gfx::Size(50, 50), true, false); | 8347 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8317 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), | 8348 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), |
| 8318 gfx::PointF(), gfx::Size(50, 50), true, false); | 8349 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8319 | 8350 |
| 8320 AddAnimatedFilterToLayerWithPlayer(child->id(), timeline_impl(), 10.0, 0.1f, | 8351 SetElementIdsForTesting(); |
| 8321 0.2f); | 8352 AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(), |
| 8353 10.0, 0.1f, 0.2f); |
| 8322 ExecuteCalculateDrawProperties(root); | 8354 ExecuteCalculateDrawProperties(root); |
| 8323 | 8355 |
| 8324 EXPECT_TRUE(root->has_render_surface()); | 8356 EXPECT_TRUE(root->has_render_surface()); |
| 8325 EXPECT_TRUE(child->has_render_surface()); | 8357 EXPECT_TRUE(child->has_render_surface()); |
| 8326 EXPECT_FALSE(grandchild->has_render_surface()); | 8358 EXPECT_FALSE(grandchild->has_render_surface()); |
| 8327 | 8359 |
| 8328 EXPECT_TRUE(root->filters().IsEmpty()); | 8360 EXPECT_TRUE(root->filters().IsEmpty()); |
| 8329 EXPECT_TRUE(child->filters().IsEmpty()); | 8361 EXPECT_TRUE(child->filters().IsEmpty()); |
| 8330 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8362 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8331 | 8363 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 8342 LayerImpl* grandchild = AddChild<LayerImpl>(child); | 8374 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
| 8343 | 8375 |
| 8344 gfx::Transform identity_transform; | 8376 gfx::Transform identity_transform; |
| 8345 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), | 8377 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
| 8346 gfx::PointF(), gfx::Size(50, 50), true, false); | 8378 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8347 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), | 8379 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), |
| 8348 gfx::PointF(), gfx::Size(50, 50), true, false); | 8380 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8349 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), | 8381 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), |
| 8350 gfx::PointF(), gfx::Size(50, 50), true, false); | 8382 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8351 | 8383 |
| 8384 SetElementIdsForTesting(); |
| 8385 |
| 8352 std::unique_ptr<KeyframedFilterAnimationCurve> curve( | 8386 std::unique_ptr<KeyframedFilterAnimationCurve> curve( |
| 8353 KeyframedFilterAnimationCurve::Create()); | 8387 KeyframedFilterAnimationCurve::Create()); |
| 8354 FilterOperations start_filters; | 8388 FilterOperations start_filters; |
| 8355 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); | 8389 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); |
| 8356 FilterOperations end_filters; | 8390 FilterOperations end_filters; |
| 8357 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); | 8391 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); |
| 8358 curve->AddKeyframe( | 8392 curve->AddKeyframe( |
| 8359 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); | 8393 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); |
| 8360 curve->AddKeyframe(FilterKeyframe::Create( | 8394 curve->AddKeyframe(FilterKeyframe::Create( |
| 8361 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); | 8395 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); |
| 8362 std::unique_ptr<Animation> animation = | 8396 std::unique_ptr<Animation> animation = |
| 8363 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); | 8397 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); |
| 8364 animation->set_fill_mode(Animation::FillMode::NONE); | 8398 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8365 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8399 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8366 | 8400 |
| 8367 AddAnimationToLayerWithPlayer(child->id(), timeline_impl(), | 8401 AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(), |
| 8368 std::move(animation)); | 8402 std::move(animation)); |
| 8369 ExecuteCalculateDrawProperties(root); | 8403 ExecuteCalculateDrawProperties(root); |
| 8370 | 8404 |
| 8371 EXPECT_TRUE(root->has_render_surface()); | 8405 EXPECT_TRUE(root->has_render_surface()); |
| 8372 EXPECT_TRUE(child->has_render_surface()); | 8406 EXPECT_TRUE(child->has_render_surface()); |
| 8373 EXPECT_FALSE(grandchild->has_render_surface()); | 8407 EXPECT_FALSE(grandchild->has_render_surface()); |
| 8374 | 8408 |
| 8375 EXPECT_TRUE(root->filters().IsEmpty()); | 8409 EXPECT_TRUE(root->filters().IsEmpty()); |
| 8376 EXPECT_TRUE(child->filters().IsEmpty()); | 8410 EXPECT_TRUE(child->filters().IsEmpty()); |
| 8377 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8411 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8378 | 8412 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8720 gfx::PointF(), gfx::Size(10, 10), true, false); | 8754 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8721 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 8755 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
| 8722 gfx::PointF(), gfx::Size(10, 10), true, false); | 8756 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8723 | 8757 |
| 8724 root->AddChild(child); | 8758 root->AddChild(child); |
| 8725 child->AddChild(grandchild); | 8759 child->AddChild(grandchild); |
| 8726 grandchild->AddChild(greatgrandchild); | 8760 grandchild->AddChild(greatgrandchild); |
| 8727 | 8761 |
| 8728 host()->SetRootLayer(root); | 8762 host()->SetRootLayer(root); |
| 8729 | 8763 |
| 8764 host()->SetElementIdsForTesting(); |
| 8765 |
| 8730 // Check the non-skipped case. | 8766 // Check the non-skipped case. |
| 8731 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8767 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8732 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8768 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| 8733 | 8769 |
| 8734 // Now we will reset the visible rect from property trees for the grandchild, | 8770 // Now we will reset the visible rect from property trees for the grandchild, |
| 8735 // and we will configure |child| in several ways that should force the subtree | 8771 // and we will configure |child| in several ways that should force the subtree |
| 8736 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8772 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 8737 // remain empty. | 8773 // remain empty. |
| 8738 grandchild->set_visible_layer_rect(gfx::Rect()); | 8774 grandchild->set_visible_layer_rect(gfx::Rect()); |
| 8739 gfx::Transform singular; | 8775 gfx::Transform singular; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8754 child->SetTransform(zero_z_scale); | 8790 child->SetTransform(zero_z_scale); |
| 8755 | 8791 |
| 8756 // Add a transform animation with a start delay. Now, even though |child| has | 8792 // Add a transform animation with a start delay. Now, even though |child| has |
| 8757 // a singular transform, the subtree should still get processed. | 8793 // a singular transform, the subtree should still get processed. |
| 8758 int animation_id = 0; | 8794 int animation_id = 0; |
| 8759 std::unique_ptr<Animation> animation = Animation::Create( | 8795 std::unique_ptr<Animation> animation = Animation::Create( |
| 8760 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), | 8796 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), |
| 8761 animation_id, 1, TargetProperty::TRANSFORM); | 8797 animation_id, 1, TargetProperty::TRANSFORM); |
| 8762 animation->set_fill_mode(Animation::FillMode::NONE); | 8798 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8763 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8799 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8764 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); | 8800 AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
| 8801 std::move(animation)); |
| 8765 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8802 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8766 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8803 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| 8767 grandchild->set_visible_layer_rect(gfx::Rect()); | 8804 grandchild->set_visible_layer_rect(gfx::Rect()); |
| 8768 | 8805 |
| 8769 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), | 8806 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
| 8770 animation_id); | 8807 animation_id); |
| 8771 child->SetTransform(identity); | 8808 child->SetTransform(identity); |
| 8772 child->SetOpacity(0.f); | 8809 child->SetOpacity(0.f); |
| 8773 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8810 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8774 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); | 8811 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); |
| 8775 | 8812 |
| 8776 // Now, even though child has zero opacity, we will configure |grandchild| and | 8813 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 8777 // |greatgrandchild| in several ways that should force the subtree to be | 8814 // |greatgrandchild| in several ways that should force the subtree to be |
| 8778 // processed anyhow. | 8815 // processed anyhow. |
| 8779 grandchild->RequestCopyOfOutput( | 8816 grandchild->RequestCopyOfOutput( |
| 8780 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8817 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8781 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8818 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8782 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8819 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| 8783 greatgrandchild->set_visible_layer_rect(gfx::Rect()); | 8820 greatgrandchild->set_visible_layer_rect(gfx::Rect()); |
| 8784 | 8821 |
| 8785 // Add an opacity animation with a start delay. | 8822 // Add an opacity animation with a start delay. |
| 8786 animation_id = 1; | 8823 animation_id = 1; |
| 8787 animation = Animation::Create( | 8824 animation = Animation::Create( |
| 8788 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 8825 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
| 8789 animation_id, 1, TargetProperty::OPACITY); | 8826 animation_id, 1, TargetProperty::OPACITY); |
| 8790 animation->set_fill_mode(Animation::FillMode::NONE); | 8827 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8791 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8828 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8792 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), | 8829 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
| 8793 std::move(animation)); | 8830 std::move(animation)); |
| 8794 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8831 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8795 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8832 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
| 8796 } | 8833 } |
| 8797 | 8834 |
| 8798 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { | 8835 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| 8799 FakeImplTaskRunnerProvider task_runner_provider; | 8836 FakeImplTaskRunnerProvider task_runner_provider; |
| 8800 TestSharedBitmapManager shared_bitmap_manager; | 8837 TestSharedBitmapManager shared_bitmap_manager; |
| 8801 TestTaskGraphRunner task_graph_runner; | 8838 TestTaskGraphRunner task_graph_runner; |
| 8802 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8839 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 8803 &task_graph_runner); | 8840 &task_graph_runner); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 8828 false); | 8865 false); |
| 8829 | 8866 |
| 8830 LayerImpl* root_ptr = root.get(); | 8867 LayerImpl* root_ptr = root.get(); |
| 8831 LayerImpl* child_ptr = child.get(); | 8868 LayerImpl* child_ptr = child.get(); |
| 8832 LayerImpl* grandchild_ptr = grandchild.get(); | 8869 LayerImpl* grandchild_ptr = grandchild.get(); |
| 8833 | 8870 |
| 8834 child->test_properties()->AddChild(std::move(grandchild)); | 8871 child->test_properties()->AddChild(std::move(grandchild)); |
| 8835 root->test_properties()->AddChild(std::move(child)); | 8872 root->test_properties()->AddChild(std::move(child)); |
| 8836 host_impl.active_tree()->SetRootLayer(std::move(root)); | 8873 host_impl.active_tree()->SetRootLayer(std::move(root)); |
| 8837 | 8874 |
| 8875 host_impl.active_tree()->SetElementIdsForTesting(); |
| 8876 |
| 8838 // Check the non-skipped case. | 8877 // Check the non-skipped case. |
| 8839 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8878 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 8840 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8879 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8841 | 8880 |
| 8842 // Now we will reset the visible rect from property trees for the grandchild, | 8881 // Now we will reset the visible rect from property trees for the grandchild, |
| 8843 // and we will configure |child| in several ways that should force the subtree | 8882 // and we will configure |child| in several ways that should force the subtree |
| 8844 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8883 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 8845 // remain empty. | 8884 // remain empty. |
| 8846 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8885 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8847 | 8886 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8923 TransformOperations operation; | 8962 TransformOperations operation; |
| 8924 operation.AppendMatrix(transform); | 8963 operation.AppendMatrix(transform); |
| 8925 curve->AddKeyframe( | 8964 curve->AddKeyframe( |
| 8926 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8965 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8927 curve->AddKeyframe(TransformKeyframe::Create( | 8966 curve->AddKeyframe(TransformKeyframe::Create( |
| 8928 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8967 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8929 std::unique_ptr<Animation> transform_animation( | 8968 std::unique_ptr<Animation> transform_animation( |
| 8930 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8969 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8931 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8970 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8932 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 8971 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 8933 root_ptr->id(), player.get()); | 8972 root_ptr->element_id(), player.get()); |
| 8934 host_impl.active_tree() | 8973 host_impl.active_tree() |
| 8935 ->animation_host() | 8974 ->animation_host() |
| 8936 ->GetElementAnimationsForElementId(root_ptr->id()) | 8975 ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| 8937 ->AddAnimation(std::move(transform_animation)); | 8976 ->AddAnimation(std::move(transform_animation)); |
| 8938 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8977 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8939 child_ptr->SetScrollClipLayer(root_ptr->id()); | 8978 child_ptr->SetScrollClipLayer(root_ptr->id()); |
| 8940 root_ptr->SetTransform(singular); | 8979 root_ptr->SetTransform(singular); |
| 8941 child_ptr->SetTransform(singular); | 8980 child_ptr->SetTransform(singular); |
| 8942 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8981 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8943 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8982 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 8944 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8983 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8945 | 8984 |
| 8946 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 8985 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 8947 root_ptr->id(), player.get()); | 8986 root_ptr->element_id(), player.get()); |
| 8948 } | 8987 } |
| 8949 | 8988 |
| 8950 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { | 8989 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| 8951 LayerImpl* root = root_layer(); | 8990 LayerImpl* root = root_layer(); |
| 8952 LayerImpl* child = AddChild<LayerImpl>(root); | 8991 LayerImpl* child = AddChild<LayerImpl>(root); |
| 8953 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 8992 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
| 8954 | 8993 |
| 8955 gfx::Transform identity; | 8994 gfx::Transform identity; |
| 8956 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), | 8995 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), |
| 8957 gfx::Size(10, 10), true, false, true); | 8996 gfx::Size(10, 10), true, false, true); |
| 8958 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 8997 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
| 8959 gfx::Size(10, 10), true, false, false); | 8998 gfx::Size(10, 10), true, false, false); |
| 8960 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), | 8999 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), |
| 8961 gfx::PointF(), gfx::Size(10, 10), true, false, | 9000 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 8962 false); | 9001 false); |
| 9002 SetElementIdsForTesting(); |
| 8963 | 9003 |
| 8964 gfx::Transform singular; | 9004 gfx::Transform singular; |
| 8965 singular.matrix().set(0, 0, 0); | 9005 singular.matrix().set(0, 0, 0); |
| 8966 singular.matrix().set(0, 1, 1); | 9006 singular.matrix().set(0, 1, 1); |
| 8967 | 9007 |
| 8968 child->SetTransform(singular); | 9008 child->SetTransform(singular); |
| 8969 child->SetDrawsContent(true); | 9009 child->SetDrawsContent(true); |
| 8970 grand_child->SetDrawsContent(true); | 9010 grand_child->SetDrawsContent(true); |
| 8971 | 9011 |
| 8972 std::unique_ptr<KeyframedTransformAnimationCurve> curve( | 9012 std::unique_ptr<KeyframedTransformAnimationCurve> curve( |
| 8973 KeyframedTransformAnimationCurve::Create()); | 9013 KeyframedTransformAnimationCurve::Create()); |
| 8974 TransformOperations start; | 9014 TransformOperations start; |
| 8975 start.AppendTranslate(1.f, 2.f, 3.f); | 9015 start.AppendTranslate(1.f, 2.f, 3.f); |
| 8976 gfx::Transform transform; | 9016 gfx::Transform transform; |
| 8977 transform.Scale3d(1.0, 2.0, 3.0); | 9017 transform.Scale3d(1.0, 2.0, 3.0); |
| 8978 TransformOperations operation; | 9018 TransformOperations operation; |
| 8979 operation.AppendMatrix(transform); | 9019 operation.AppendMatrix(transform); |
| 8980 curve->AddKeyframe( | 9020 curve->AddKeyframe( |
| 8981 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 9021 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8982 curve->AddKeyframe(TransformKeyframe::Create( | 9022 curve->AddKeyframe(TransformKeyframe::Create( |
| 8983 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 9023 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8984 std::unique_ptr<Animation> transform_animation( | 9024 std::unique_ptr<Animation> transform_animation( |
| 8985 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 9025 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8986 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 9026 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8987 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( | 9027 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( |
| 8988 grand_child->id(), player.get()); | 9028 grand_child->element_id(), player.get()); |
| 8989 host_impl() | 9029 host_impl() |
| 8990 ->active_tree() | 9030 ->active_tree() |
| 8991 ->animation_host() | 9031 ->animation_host() |
| 8992 ->GetElementAnimationsForElementId(grand_child->id()) | 9032 ->GetElementAnimationsForElementId(grand_child->element_id()) |
| 8993 ->AddAnimation(std::move(transform_animation)); | 9033 ->AddAnimation(std::move(transform_animation)); |
| 8994 | 9034 |
| 8995 ExecuteCalculateDrawProperties(root); | 9035 ExecuteCalculateDrawProperties(root); |
| 8996 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); | 9036 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); |
| 8997 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 9037 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 8998 | 9038 |
| 8999 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( | 9039 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( |
| 9000 grand_child->id(), player.get()); | 9040 grand_child->element_id(), player.get()); |
| 9001 } | 9041 } |
| 9002 | 9042 |
| 9003 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { | 9043 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| 9004 FakeImplTaskRunnerProvider task_runner_provider; | 9044 FakeImplTaskRunnerProvider task_runner_provider; |
| 9005 TestSharedBitmapManager shared_bitmap_manager; | 9045 TestSharedBitmapManager shared_bitmap_manager; |
| 9006 TestTaskGraphRunner task_graph_runner; | 9046 TestTaskGraphRunner task_graph_runner; |
| 9007 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 9047 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 9008 &task_graph_runner); | 9048 &task_graph_runner); |
| 9009 | 9049 |
| 9010 gfx::Transform identity; | 9050 gfx::Transform identity; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 9033 gfx::PointF(), gfx::Size(10, 10), true, false, | 9073 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 9034 false); | 9074 false); |
| 9035 | 9075 |
| 9036 LayerImpl* root_ptr = root.get(); | 9076 LayerImpl* root_ptr = root.get(); |
| 9037 LayerImpl* grandchild_ptr = grandchild.get(); | 9077 LayerImpl* grandchild_ptr = grandchild.get(); |
| 9038 | 9078 |
| 9039 child->test_properties()->AddChild(std::move(grandchild)); | 9079 child->test_properties()->AddChild(std::move(grandchild)); |
| 9040 root->test_properties()->AddChild(std::move(child)); | 9080 root->test_properties()->AddChild(std::move(child)); |
| 9041 | 9081 |
| 9042 host_impl.pending_tree()->SetRootLayer(std::move(root)); | 9082 host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| 9083 host_impl.pending_tree()->SetElementIdsForTesting(); |
| 9043 | 9084 |
| 9044 // Check the non-skipped case. | 9085 // Check the non-skipped case. |
| 9045 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 9086 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 9046 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9087 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9047 | 9088 |
| 9048 std::unique_ptr<KeyframedFloatAnimationCurve> curve( | 9089 std::unique_ptr<KeyframedFloatAnimationCurve> curve( |
| 9049 KeyframedFloatAnimationCurve::Create()); | 9090 KeyframedFloatAnimationCurve::Create()); |
| 9050 std::unique_ptr<TimingFunction> func = | 9091 std::unique_ptr<TimingFunction> func = |
| 9051 CubicBezierTimingFunction::CreatePreset( | 9092 CubicBezierTimingFunction::CreatePreset( |
| 9052 CubicBezierTimingFunction::EaseType::EASE); | 9093 CubicBezierTimingFunction::EaseType::EASE); |
| 9053 curve->AddKeyframe( | 9094 curve->AddKeyframe( |
| 9054 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); | 9095 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); |
| 9055 curve->AddKeyframe( | 9096 curve->AddKeyframe( |
| 9056 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); | 9097 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); |
| 9057 std::unique_ptr<Animation> animation( | 9098 std::unique_ptr<Animation> animation( |
| 9058 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); | 9099 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
| 9059 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 9100 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 9060 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 9101 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 9061 root_ptr->id(), player.get()); | 9102 root_ptr->element_id(), player.get()); |
| 9062 host_impl.active_tree() | 9103 host_impl.active_tree() |
| 9063 ->animation_host() | 9104 ->animation_host() |
| 9064 ->GetElementAnimationsForElementId(root_ptr->id()) | 9105 ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| 9065 ->AddAnimation(std::move(animation)); | 9106 ->AddAnimation(std::move(animation)); |
| 9066 root_ptr->test_properties()->opacity = 0.f; | 9107 root_ptr->test_properties()->opacity = 0.f; |
| 9067 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 9108 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 9068 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 9109 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 9069 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 9110 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 9070 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9111 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9071 | 9112 |
| 9072 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 9113 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 9073 root_ptr->id(), player.get()); | 9114 root_ptr->element_id(), player.get()); |
| 9074 } | 9115 } |
| 9075 | 9116 |
| 9076 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9117 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9077 gfx::Transform identity; | 9118 gfx::Transform identity; |
| 9078 LayerImpl* root = root_layer(); | 9119 LayerImpl* root = root_layer(); |
| 9079 LayerImpl* child = AddChild<LayerImpl>(root); | 9120 LayerImpl* child = AddChild<LayerImpl>(root); |
| 9080 | 9121 |
| 9081 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), | 9122 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), |
| 9082 gfx::Size(100, 100), true, false, true); | 9123 gfx::Size(100, 100), true, false, true); |
| 9083 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 9124 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9988 | 10029 |
| 9989 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { | 10030 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| 9990 const gfx::Transform identity_matrix; | 10031 const gfx::Transform identity_matrix; |
| 9991 scoped_refptr<Layer> root = Layer::Create(); | 10032 scoped_refptr<Layer> root = Layer::Create(); |
| 9992 scoped_refptr<LayerWithForcedDrawsContent> animated = | 10033 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 9993 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 10034 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9994 root->AddChild(animated); | 10035 root->AddChild(animated); |
| 9995 | 10036 |
| 9996 host()->SetRootLayer(root); | 10037 host()->SetRootLayer(root); |
| 9997 | 10038 |
| 10039 host()->SetElementIdsForTesting(); |
| 10040 |
| 9998 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 10041 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9999 gfx::PointF(), gfx::Size(100, 100), true, false); | 10042 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 10000 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 10043 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 10001 gfx::PointF(), gfx::Size(20, 20), true, false); | 10044 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 10002 | 10045 |
| 10003 root->SetForceRenderSurfaceForTesting(true); | 10046 root->SetForceRenderSurfaceForTesting(true); |
| 10004 animated->SetOpacity(0.f); | 10047 animated->SetOpacity(0.f); |
| 10005 | 10048 |
| 10006 scoped_refptr<AnimationPlayer> player = | 10049 scoped_refptr<AnimationPlayer> player = |
| 10007 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); | 10050 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| 10008 timeline()->AttachPlayer(player); | 10051 timeline()->AttachPlayer(player); |
| 10009 player->AttachElement(animated->id()); | 10052 |
| 10053 player->AttachElement(animated->element_id()); |
| 10010 | 10054 |
| 10011 int animation_id = 0; | 10055 int animation_id = 0; |
| 10012 std::unique_ptr<Animation> animation = Animation::Create( | 10056 std::unique_ptr<Animation> animation = Animation::Create( |
| 10013 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 10057 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
| 10014 animation_id, 1, TargetProperty::OPACITY); | 10058 animation_id, 1, TargetProperty::OPACITY); |
| 10015 animation->set_fill_mode(Animation::FillMode::NONE); | 10059 animation->set_fill_mode(Animation::FillMode::NONE); |
| 10016 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10060 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 10017 Animation* animation_ptr = animation.get(); | 10061 Animation* animation_ptr = animation.get(); |
| 10018 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), | 10062 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| 10019 std::move(animation)); | 10063 std::move(animation)); |
| 10020 | 10064 |
| 10021 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10065 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 10022 | 10066 |
| 10023 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; | 10067 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
| 10024 EffectNode* node = tree.Node(animated->effect_tree_index()); | 10068 EffectNode* node = tree.Node(animated->effect_tree_index()); |
| 10025 EXPECT_FALSE(node->data.is_currently_animating_opacity); | 10069 EXPECT_FALSE(node->data.is_currently_animating_opacity); |
| 10026 EXPECT_TRUE(node->data.has_potential_opacity_animation); | 10070 EXPECT_TRUE(node->data.has_potential_opacity_animation); |
| 10027 | 10071 |
| 10028 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10072 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
| 10029 root->layer_tree_host()->AnimateLayers( | 10073 root->layer_tree_host()->AnimateLayers( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 10040 | 10084 |
| 10041 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { | 10085 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
| 10042 const gfx::Transform identity_matrix; | 10086 const gfx::Transform identity_matrix; |
| 10043 scoped_refptr<Layer> root = Layer::Create(); | 10087 scoped_refptr<Layer> root = Layer::Create(); |
| 10044 scoped_refptr<LayerWithForcedDrawsContent> animated = | 10088 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 10045 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 10089 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 10046 root->AddChild(animated); | 10090 root->AddChild(animated); |
| 10047 | 10091 |
| 10048 host()->SetRootLayer(root); | 10092 host()->SetRootLayer(root); |
| 10049 | 10093 |
| 10094 host()->SetElementIdsForTesting(); |
| 10095 |
| 10050 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 10096 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 10051 gfx::PointF(), gfx::Size(100, 100), true, false); | 10097 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 10052 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 10098 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 10053 gfx::PointF(), gfx::Size(20, 20), true, false); | 10099 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 10054 | 10100 |
| 10055 root->SetForceRenderSurfaceForTesting(true); | 10101 root->SetForceRenderSurfaceForTesting(true); |
| 10056 | 10102 |
| 10057 scoped_refptr<AnimationPlayer> player = | 10103 scoped_refptr<AnimationPlayer> player = |
| 10058 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); | 10104 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| 10059 timeline()->AttachPlayer(player); | 10105 timeline()->AttachPlayer(player); |
| 10060 player->AttachElement(animated->id()); | 10106 player->AttachElement(animated->element_id()); |
| 10061 | 10107 |
| 10062 std::unique_ptr<KeyframedTransformAnimationCurve> curve( | 10108 std::unique_ptr<KeyframedTransformAnimationCurve> curve( |
| 10063 KeyframedTransformAnimationCurve::Create()); | 10109 KeyframedTransformAnimationCurve::Create()); |
| 10064 TransformOperations start; | 10110 TransformOperations start; |
| 10065 start.AppendTranslate(1.f, 2.f, 3.f); | 10111 start.AppendTranslate(1.f, 2.f, 3.f); |
| 10066 gfx::Transform transform; | 10112 gfx::Transform transform; |
| 10067 transform.Scale3d(1.0, 2.0, 3.0); | 10113 transform.Scale3d(1.0, 2.0, 3.0); |
| 10068 TransformOperations operation; | 10114 TransformOperations operation; |
| 10069 operation.AppendMatrix(transform); | 10115 operation.AppendMatrix(transform); |
| 10070 curve->AddKeyframe( | 10116 curve->AddKeyframe( |
| 10071 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 10117 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 10072 curve->AddKeyframe(TransformKeyframe::Create( | 10118 curve->AddKeyframe(TransformKeyframe::Create( |
| 10073 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 10119 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 10074 std::unique_ptr<Animation> animation( | 10120 std::unique_ptr<Animation> animation( |
| 10075 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 10121 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 10076 animation->set_fill_mode(Animation::FillMode::NONE); | 10122 animation->set_fill_mode(Animation::FillMode::NONE); |
| 10077 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10123 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 10078 Animation* animation_ptr = animation.get(); | 10124 Animation* animation_ptr = animation.get(); |
| 10079 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), | 10125 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| 10080 std::move(animation)); | 10126 std::move(animation)); |
| 10081 | 10127 |
| 10082 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10128 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 10083 | 10129 |
| 10084 TransformTree& tree = | 10130 TransformTree& tree = |
| 10085 root->layer_tree_host()->property_trees()->transform_tree; | 10131 root->layer_tree_host()->property_trees()->transform_tree; |
| 10086 TransformNode* node = tree.Node(animated->transform_tree_index()); | 10132 TransformNode* node = tree.Node(animated->transform_tree_index()); |
| 10087 EXPECT_FALSE(node->data.is_currently_animating); | 10133 EXPECT_FALSE(node->data.is_currently_animating); |
| 10088 EXPECT_TRUE(node->data.has_potential_animation); | 10134 EXPECT_TRUE(node->data.has_potential_animation); |
| 10089 | 10135 |
| 10090 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10136 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10326 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10372 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10327 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10373 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10328 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10374 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10329 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10375 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10330 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10376 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10331 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10377 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10332 } | 10378 } |
| 10333 | 10379 |
| 10334 } // namespace | 10380 } // namespace |
| 10335 } // namespace cc | 10381 } // namespace cc |
| OLD | NEW |