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

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: respond to 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 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2546 grand_child_of_root, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2547 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2547 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2548 SetLayerPropertiesForTesting( 2548 SetLayerPropertiesForTesting(
2549 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2549 grand_child_of_rs1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2550 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2550 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2551 SetLayerPropertiesForTesting( 2551 SetLayerPropertiesForTesting(
2552 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), 2552 grand_child_of_rs2, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f),
2553 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); 2553 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false);
2554 2554
2555 parent->layer_tree_impl()->BuildPropertyTreesForTesting(); 2555 parent->layer_tree_impl()->BuildPropertyTreesForTesting();
2556 SetElementIdsForTesting();
2556 2557
2557 // Put an animated opacity on the render surface. 2558 // Put an animated opacity on the render surface.
2558 AddOpacityTransitionToLayerWithPlayer(render_surface1->id(), timeline_impl(), 2559 AddOpacityTransitionToElementWithPlayer(
2559 10.0, 1.f, 0.f, false); 2560 render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false);
2560 2561
2561 // Also put an animated opacity on a layer without descendants. 2562 // Also put an animated opacity on a layer without descendants.
2562 AddOpacityTransitionToLayerWithPlayer(grand_child_of_root->id(), 2563 AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(),
2563 timeline_impl(), 10.0, 1.f, 0.f, false); 2564 timeline_impl(), 10.0, 1.f, 0.f,
2565 false);
2564 2566
2565 // Put a transform animation on the render surface. 2567 // Put a transform animation on the render surface.
2566 AddAnimatedTransformToLayerWithPlayer(render_surface2->id(), timeline_impl(), 2568 AddAnimatedTransformToElementWithPlayer(render_surface2->element_id(),
2567 10.0, 30, 0); 2569 timeline_impl(), 10.0, 30, 0);
2568 2570
2569 // Also put transform animations on grand_child_of_root, and 2571 // Also put transform animations on grand_child_of_root, and
2570 // grand_child_of_rs2 2572 // grand_child_of_rs2
2571 AddAnimatedTransformToLayerWithPlayer(grand_child_of_root->id(), 2573 AddAnimatedTransformToElementWithPlayer(grand_child_of_root->element_id(),
2572 timeline_impl(), 10.0, 30, 0); 2574 timeline_impl(), 10.0, 30, 0);
2573 AddAnimatedTransformToLayerWithPlayer(grand_child_of_rs2->id(), 2575 AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(),
2574 timeline_impl(), 10.0, 30, 0); 2576 timeline_impl(), 10.0, 30, 0);
2575 2577
2576 parent->layer_tree_impl()->property_trees()->needs_rebuild = true; 2578 parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
2577 ExecuteCalculateDrawProperties(parent); 2579 ExecuteCalculateDrawProperties(parent);
2578 2580
2579 // Only layers that are associated with render surfaces should have an actual 2581 // Only layers that are associated with render surfaces should have an actual
2580 // RenderSurface() value. 2582 // RenderSurface() value.
2581 ASSERT_TRUE(parent->render_surface()); 2583 ASSERT_TRUE(parent->render_surface());
2582 ASSERT_FALSE(child_of_root->render_surface()); 2584 ASSERT_FALSE(child_of_root->render_surface());
2583 ASSERT_FALSE(grand_child_of_root->render_surface()); 2585 ASSERT_FALSE(grand_child_of_root->render_surface());
2584 2586
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 gfx::Size(10, 10), true, false, true); 2685 gfx::Size(10, 10), true, false, true);
2684 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 2686 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
2685 gfx::Size(10, 10), true, false, false); 2687 gfx::Size(10, 10), true, false, false);
2686 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), 2688 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
2687 gfx::PointF(), gfx::Size(10, 10), true, false, 2689 gfx::PointF(), gfx::Size(10, 10), true, false,
2688 false); 2690 false);
2689 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), 2691 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(),
2690 gfx::PointF(), gfx::Size(10, 10), true, false, 2692 gfx::PointF(), gfx::Size(10, 10), true, false,
2691 false); 2693 false);
2692 2694
2695 SetElementIdsForTesting();
2696
2693 // Add a transform animation with a start delay to |grand_child|. 2697 // Add a transform animation with a start delay to |grand_child|.
2694 std::unique_ptr<Animation> animation = Animation::Create( 2698 std::unique_ptr<Animation> animation = Animation::Create(
2695 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, 2699 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1,
2696 TargetProperty::TRANSFORM); 2700 TargetProperty::TRANSFORM);
2697 animation->set_fill_mode(Animation::FillMode::NONE); 2701 animation->set_fill_mode(Animation::FillMode::NONE);
2698 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 2702 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
2699 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), 2703 AddAnimationToElementWithPlayer(grand_child->element_id(), timeline_impl(),
2700 std::move(animation)); 2704 std::move(animation));
2701 ExecuteCalculateDrawProperties(parent); 2705 ExecuteCalculateDrawProperties(parent);
2702 2706
2703 EXPECT_FALSE(parent->screen_space_transform_is_animating()); 2707 EXPECT_FALSE(parent->screen_space_transform_is_animating());
2704 EXPECT_FALSE(child->screen_space_transform_is_animating()); 2708 EXPECT_FALSE(child->screen_space_transform_is_animating());
2705 2709
2706 EXPECT_FALSE(grand_child->TransformIsAnimating()); 2710 EXPECT_FALSE(grand_child->TransformIsAnimating());
2707 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); 2711 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation());
2708 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); 2712 EXPECT_TRUE(grand_child->screen_space_transform_is_animating());
2709 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); 2713 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating());
2710 } 2714 }
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 child2->SetDrawsContent(true); 4415 child2->SetDrawsContent(true);
4412 animating_surface->SetDrawsContent(true); 4416 animating_surface->SetDrawsContent(true);
4413 child_of_animating_surface->SetDrawsContent(true); 4417 child_of_animating_surface->SetDrawsContent(true);
4414 animating_child->SetDrawsContent(true); 4418 animating_child->SetDrawsContent(true);
4415 4419
4416 gfx::Transform backface_matrix; 4420 gfx::Transform backface_matrix;
4417 backface_matrix.Translate(50.0, 50.0); 4421 backface_matrix.Translate(50.0, 50.0);
4418 backface_matrix.RotateAboutYAxis(180.0); 4422 backface_matrix.RotateAboutYAxis(180.0);
4419 backface_matrix.Translate(-50.0, -50.0); 4423 backface_matrix.Translate(-50.0, -50.0);
4420 4424
4425 SetElementIdsForTesting();
4426
4421 // Animate the transform on the render surface. 4427 // Animate the transform on the render surface.
4422 AddAnimatedTransformToLayerWithPlayer(animating_surface->id(), 4428 AddAnimatedTransformToElementWithPlayer(animating_surface->element_id(),
4423 timeline_impl(), 10.0, 30, 0); 4429 timeline_impl(), 10.0, 30, 0);
4424 // This is just an animating layer, not a surface. 4430 // This is just an animating layer, not a surface.
4425 AddAnimatedTransformToLayerWithPlayer(animating_child->id(), timeline_impl(), 4431 AddAnimatedTransformToElementWithPlayer(animating_child->element_id(),
4426 10.0, 30, 0); 4432 timeline_impl(), 10.0, 30, 0);
4427 4433
4428 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), 4434 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
4429 gfx::PointF(), gfx::Size(100, 100), true, false); 4435 gfx::PointF(), gfx::Size(100, 100), true, false);
4430 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(), 4436 SetLayerPropertiesForTesting(child, backface_matrix, gfx::Point3F(),
4431 gfx::PointF(), gfx::Size(100, 100), true, false); 4437 gfx::PointF(), gfx::Size(100, 100), true, false);
4432 SetLayerPropertiesForTesting(animating_surface, backface_matrix, 4438 SetLayerPropertiesForTesting(animating_surface, backface_matrix,
4433 gfx::Point3F(), gfx::PointF(), 4439 gfx::Point3F(), gfx::PointF(),
4434 gfx::Size(100, 100), true, false, true); 4440 gfx::Size(100, 100), true, false, true);
4435 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix, 4441 SetLayerPropertiesForTesting(child_of_animating_surface, backface_matrix,
4436 gfx::Point3F(), gfx::PointF(), 4442 gfx::Point3F(), gfx::PointF(),
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
5028 false); 5034 false);
5029 child->SetDrawsContent(true); 5035 child->SetDrawsContent(true);
5030 child->test_properties()->opacity = 0.0f; 5036 child->test_properties()->opacity = 0.0f;
5031 5037
5032 const int child_id = child->id(); 5038 const int child_id = child->id();
5033 root->AddChild(std::move(child)); 5039 root->AddChild(std::move(child));
5034 root->SetHasRenderSurface(true); 5040 root->SetHasRenderSurface(true);
5035 LayerImpl* root_layer = root.get(); 5041 LayerImpl* root_layer = root.get();
5036 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5042 host_impl.pending_tree()->SetRootLayer(std::move(root));
5037 host_impl.pending_tree()->BuildPropertyTreesForTesting(); 5043 host_impl.pending_tree()->BuildPropertyTreesForTesting();
5044
5038 // Add opacity animation. 5045 // Add opacity animation.
5039 scoped_refptr<AnimationTimeline> timeline = 5046 scoped_refptr<AnimationTimeline> timeline =
5040 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5047 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5041 host_impl.animation_host()->AddAnimationTimeline(timeline); 5048 host_impl.animation_host()->AddAnimationTimeline(timeline);
5049 host_impl.pending_tree()->SetElementIdsForTesting();
5042 5050
5043 AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f, 5051 ElementId child_element_id =
5044 false); 5052 host_impl.pending_tree()->LayerById(child_id)->element_id();
5053
5054 AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0,
5055 0.0f, 1.0f, false);
5045 5056
5046 LayerImplList render_surface_layer_list; 5057 LayerImplList render_surface_layer_list;
5047 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5058 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5048 root_layer, root_layer->bounds(), &render_surface_layer_list); 5059 root_layer, root_layer->bounds(), &render_surface_layer_list);
5049 inputs.can_adjust_raster_scales = true; 5060 inputs.can_adjust_raster_scales = true;
5050 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5061 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5051 5062
5052 // We should have one render surface and two layers. The child 5063 // We should have one render surface and two layers. The child
5053 // layer should be included even though it is transparent. 5064 // layer should be included even though it is transparent.
5054 ASSERT_EQ(1u, render_surface_layer_list.size()); 5065 ASSERT_EQ(1u, render_surface_layer_list.size());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
5146 5157
5147 // Stash raw pointers to look at later. 5158 // Stash raw pointers to look at later.
5148 root_ = root_ptr.get(); 5159 root_ = root_ptr.get();
5149 child_ = child_ptr.get(); 5160 child_ = child_ptr.get();
5150 grand_child_ = grand_child_ptr.get(); 5161 grand_child_ = grand_child_ptr.get();
5151 5162
5152 child_->AddChild(std::move(grand_child_ptr)); 5163 child_->AddChild(std::move(grand_child_ptr));
5153 root_->AddChild(std::move(child_ptr)); 5164 root_->AddChild(std::move(child_ptr));
5154 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); 5165 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr));
5155 5166
5167 host_impl_.active_tree()->SetElementIdsForTesting();
5168
5156 root_->SetContentsOpaque(true); 5169 root_->SetContentsOpaque(true);
5157 child_->SetContentsOpaque(true); 5170 child_->SetContentsOpaque(true);
5158 grand_child_->SetContentsOpaque(true); 5171 grand_child_->SetContentsOpaque(true);
5159 5172
5160 root_->SetDrawsContent(true); 5173 root_->SetDrawsContent(true);
5161 child_->SetDrawsContent(true); 5174 child_->SetDrawsContent(true);
5162 grand_child_->SetDrawsContent(true); 5175 grand_child_->SetDrawsContent(true);
5163 5176
5164 gfx::Transform identity_matrix; 5177 gfx::Transform identity_matrix;
5165 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(), 5178 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5287 5300
5288 // Sanity check: Make sure can_use_lcd_text_ is set on each node. 5301 // Sanity check: Make sure can_use_lcd_text_ is set on each node.
5289 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5302 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5290 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5303 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5291 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); 5304 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText());
5292 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5305 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5293 5306
5294 // Add opacity animation. 5307 // Add opacity animation.
5295 child_->test_properties()->opacity = 0.9f; 5308 child_->test_properties()->opacity = 0.9f;
5296 child_->layer_tree_impl()->property_trees()->needs_rebuild = true; 5309 child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
5297 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, 5310
5298 0.1f, false); 5311 SetElementIdsForTesting();
5312
5313 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(),
5314 10.0, 0.9f, 0.1f, false);
5299 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5315 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5300 // Text LCD should be adjusted while animation is active. 5316 // Text LCD should be adjusted while animation is active.
5301 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5317 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5302 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); 5318 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText());
5303 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText()); 5319 EXPECT_EQ(expect_not_lcd_text, grand_child_->CanUseLCDText());
5304 } 5320 }
5305 5321
5306 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { 5322 TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
5307 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; 5323 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
5308 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; 5324 bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
5309 5325
5310 // Sanity check: Make sure can_use_lcd_text_ is set on each node. 5326 // Sanity check: Make sure can_use_lcd_text_ is set on each node.
5311 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5327 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5312 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5328 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5313 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText()); 5329 EXPECT_EQ(expect_lcd_text, child_->CanUseLCDText());
5314 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5330 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5331 SetElementIdsForTesting();
5315 5332
5316 // Mark contents non-opaque within the first animation frame. 5333 // Mark contents non-opaque within the first animation frame.
5317 child_->SetContentsOpaque(false); 5334 child_->SetContentsOpaque(false);
5318 AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, 5335 AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(),
5319 0.1f, false); 5336 10.0, 0.9f, 0.1f, false);
5320 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL); 5337 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
5321 // LCD text should be disabled for non-opaque layers even during animations. 5338 // LCD text should be disabled for non-opaque layers even during animations.
5322 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText()); 5339 EXPECT_EQ(expect_lcd_text, root_->CanUseLCDText());
5323 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText()); 5340 EXPECT_EQ(expect_not_lcd_text, child_->CanUseLCDText());
5324 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText()); 5341 EXPECT_EQ(expect_lcd_text, grand_child_->CanUseLCDText());
5325 } 5342 }
5326 5343
5327 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 5344 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
5328 LCDTextTest, 5345 LCDTextTest,
5329 testing::Combine(testing::Bool(), 5346 testing::Combine(testing::Bool(),
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
7074 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(), 7091 SetLayerPropertiesForTesting(scroller, identity_transform, gfx::Point3F(),
7075 gfx::PointF(), gfx::Size(100, 100), true, false, 7092 gfx::PointF(), gfx::Size(100, 100), true, false,
7076 false); 7093 false);
7077 7094
7078 gfx::Transform end_scale; 7095 gfx::Transform end_scale;
7079 end_scale.Scale(2.f, 2.f); 7096 end_scale.Scale(2.f, 2.f);
7080 TransformOperations start_operations; 7097 TransformOperations start_operations;
7081 start_operations.AppendMatrix(start_scale); 7098 start_operations.AppendMatrix(start_scale);
7082 TransformOperations end_operations; 7099 TransformOperations end_operations;
7083 end_operations.AppendMatrix(end_scale); 7100 end_operations.AppendMatrix(end_scale);
7084 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), 7101 SetElementIdsForTesting();
7085 1.0, start_operations, end_operations); 7102
7103 AddAnimatedTransformToElementWithPlayer(animated_layer->element_id(),
7104 timeline_impl(), 1.0,
7105 start_operations, end_operations);
7086 gfx::Vector2dF scroll_delta(5.f, 9.f); 7106 gfx::Vector2dF scroll_delta(5.f, 9.f);
7087 SetScrollOffsetDelta(scroller, scroll_delta); 7107 SetScrollOffsetDelta(scroller, scroll_delta);
7088 7108
7089 ExecuteCalculateDrawProperties(root); 7109 ExecuteCalculateDrawProperties(root);
7090 7110
7091 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); 7111 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f);
7092 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, 7112 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation,
7093 scroller->DrawTransform().To2dTranslation()); 7113 scroller->DrawTransform().To2dTranslation());
7094 } 7114 }
7095 7115
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
7178 0.f, 7198 0.f,
7179 grand_child_raw->draw_properties().starting_animation_contents_scale); 7199 grand_child_raw->draw_properties().starting_animation_contents_scale);
7180 7200
7181 TransformOperations translation; 7201 TransformOperations translation;
7182 translation.AppendTranslate(1.f, 2.f, 3.f); 7202 translation.AppendTranslate(1.f, 2.f, 3.f);
7183 7203
7184 scoped_refptr<AnimationTimeline> timeline; 7204 scoped_refptr<AnimationTimeline> timeline;
7185 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 7205 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
7186 host_impl.animation_host()->AddAnimationTimeline(timeline); 7206 host_impl.animation_host()->AddAnimationTimeline(timeline);
7187 7207
7188 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7208 host_impl.active_tree()->SetElementIdsForTesting();
7189 TransformOperations(), translation); 7209 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7210 1.0, TransformOperations(),
7211 translation);
7190 7212
7191 // No layers have scale-affecting animations. 7213 // No layers have scale-affecting animations.
7192 EXPECT_EQ( 7214 EXPECT_EQ(
7193 0.f, 7215 0.f,
7194 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7216 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7195 EXPECT_EQ(0.f, 7217 EXPECT_EQ(0.f,
7196 parent_raw->draw_properties().maximum_animation_contents_scale); 7218 parent_raw->draw_properties().maximum_animation_contents_scale);
7197 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7219 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7198 EXPECT_EQ( 7220 EXPECT_EQ(
7199 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7221 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7200 7222
7201 EXPECT_EQ( 7223 EXPECT_EQ(
7202 0.f, 7224 0.f,
7203 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7225 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7204 EXPECT_EQ(0.f, 7226 EXPECT_EQ(0.f,
7205 parent_raw->draw_properties().starting_animation_contents_scale); 7227 parent_raw->draw_properties().starting_animation_contents_scale);
7206 EXPECT_EQ(0.f, 7228 EXPECT_EQ(0.f,
7207 child_raw->draw_properties().starting_animation_contents_scale); 7229 child_raw->draw_properties().starting_animation_contents_scale);
7208 EXPECT_EQ( 7230 EXPECT_EQ(
7209 0.f, 7231 0.f,
7210 grand_child_raw->draw_properties().starting_animation_contents_scale); 7232 grand_child_raw->draw_properties().starting_animation_contents_scale);
7211 7233
7212 TransformOperations scale; 7234 TransformOperations scale;
7213 scale.AppendScale(5.f, 4.f, 3.f); 7235 scale.AppendScale(5.f, 4.f, 3.f);
7214 7236
7215 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, 7237 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline,
7216 TransformOperations(), scale); 7238 1.0, TransformOperations(), scale);
7217 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7239 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7218 ExecuteCalculateDrawProperties(grand_parent_raw); 7240 ExecuteCalculateDrawProperties(grand_parent_raw);
7219 7241
7220 // Only |child| has a scale-affecting animation. 7242 // Only |child| has a scale-affecting animation.
7221 EXPECT_EQ( 7243 EXPECT_EQ(
7222 0.f, 7244 0.f,
7223 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7245 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7224 EXPECT_EQ(0.f, 7246 EXPECT_EQ(0.f,
7225 parent_raw->draw_properties().maximum_animation_contents_scale); 7247 parent_raw->draw_properties().maximum_animation_contents_scale);
7226 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale); 7248 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale);
7227 EXPECT_EQ( 7249 EXPECT_EQ(
7228 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7250 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7229 7251
7230 EXPECT_EQ( 7252 EXPECT_EQ(
7231 0.f, 7253 0.f,
7232 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7254 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7233 EXPECT_EQ(0.f, 7255 EXPECT_EQ(0.f,
7234 parent_raw->draw_properties().starting_animation_contents_scale); 7256 parent_raw->draw_properties().starting_animation_contents_scale);
7235 EXPECT_EQ(1.f, 7257 EXPECT_EQ(1.f,
7236 child_raw->draw_properties().starting_animation_contents_scale); 7258 child_raw->draw_properties().starting_animation_contents_scale);
7237 EXPECT_EQ( 7259 EXPECT_EQ(
7238 1.f, 7260 1.f,
7239 grand_child_raw->draw_properties().starting_animation_contents_scale); 7261 grand_child_raw->draw_properties().starting_animation_contents_scale);
7240 7262
7241 AddAnimatedTransformToLayerWithPlayer(grand_parent_raw->id(), timeline, 1.0, 7263 AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(),
7242 TransformOperations(), scale); 7264 timeline, 1.0, TransformOperations(),
7265 scale);
7243 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7266 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7244 ExecuteCalculateDrawProperties(grand_parent_raw); 7267 ExecuteCalculateDrawProperties(grand_parent_raw);
7245 7268
7246 // |grand_parent| and |child| have scale-affecting animations. 7269 // |grand_parent| and |child| have scale-affecting animations.
7247 EXPECT_EQ( 7270 EXPECT_EQ(
7248 5.f, 7271 5.f,
7249 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7272 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7250 EXPECT_EQ(5.f, 7273 EXPECT_EQ(5.f,
7251 parent_raw->draw_properties().maximum_animation_contents_scale); 7274 parent_raw->draw_properties().maximum_animation_contents_scale);
7252 // We don't support combining animated scales from two nodes; 0.f means 7275 // We don't support combining animated scales from two nodes; 0.f means
7253 // that the maximum scale could not be computed. 7276 // that the maximum scale could not be computed.
7254 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7277 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7255 EXPECT_EQ( 7278 EXPECT_EQ(
7256 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7279 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7257 7280
7258 EXPECT_EQ( 7281 EXPECT_EQ(
7259 1.f, 7282 1.f,
7260 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7283 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7261 EXPECT_EQ(1.f, 7284 EXPECT_EQ(1.f,
7262 parent_raw->draw_properties().starting_animation_contents_scale); 7285 parent_raw->draw_properties().starting_animation_contents_scale);
7263 EXPECT_EQ(0.f, 7286 EXPECT_EQ(0.f,
7264 child_raw->draw_properties().starting_animation_contents_scale); 7287 child_raw->draw_properties().starting_animation_contents_scale);
7265 EXPECT_EQ( 7288 EXPECT_EQ(
7266 0.f, 7289 0.f,
7267 grand_child_raw->draw_properties().starting_animation_contents_scale); 7290 grand_child_raw->draw_properties().starting_animation_contents_scale);
7268 7291
7269 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7292 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7270 TransformOperations(), scale); 7293 1.0, TransformOperations(), scale);
7271 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7294 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7272 ExecuteCalculateDrawProperties(grand_parent_raw); 7295 ExecuteCalculateDrawProperties(grand_parent_raw);
7273 7296
7274 // |grand_parent|, |parent|, and |child| have scale-affecting animations. 7297 // |grand_parent|, |parent|, and |child| have scale-affecting animations.
7275 EXPECT_EQ( 7298 EXPECT_EQ(
7276 5.f, 7299 5.f,
7277 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7300 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7278 EXPECT_EQ(0.f, 7301 EXPECT_EQ(0.f,
7279 parent_raw->draw_properties().maximum_animation_contents_scale); 7302 parent_raw->draw_properties().maximum_animation_contents_scale);
7280 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7303 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7281 EXPECT_EQ( 7304 EXPECT_EQ(
7282 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7305 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7283 7306
7284 EXPECT_EQ( 7307 EXPECT_EQ(
7285 1.f, 7308 1.f,
7286 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7309 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7287 EXPECT_EQ(0.f, 7310 EXPECT_EQ(0.f,
7288 parent_raw->draw_properties().starting_animation_contents_scale); 7311 parent_raw->draw_properties().starting_animation_contents_scale);
7289 EXPECT_EQ(0.f, 7312 EXPECT_EQ(0.f,
7290 child_raw->draw_properties().starting_animation_contents_scale); 7313 child_raw->draw_properties().starting_animation_contents_scale);
7291 EXPECT_EQ( 7314 EXPECT_EQ(
7292 0.f, 7315 0.f,
7293 grand_child_raw->draw_properties().starting_animation_contents_scale); 7316 grand_child_raw->draw_properties().starting_animation_contents_scale);
7294 7317
7295 AbortAnimationsOnLayerWithPlayer(grand_parent_raw->id(), timeline, 7318 AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline,
7296 TargetProperty::TRANSFORM); 7319 TargetProperty::TRANSFORM);
7297 AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, 7320 AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline,
7298 TargetProperty::TRANSFORM); 7321 TargetProperty::TRANSFORM);
7299 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, 7322 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline,
7300 TargetProperty::TRANSFORM); 7323 TargetProperty::TRANSFORM);
7301 7324
7302 TransformOperations perspective; 7325 TransformOperations perspective;
7303 perspective.AppendPerspective(10.f); 7326 perspective.AppendPerspective(10.f);
7304 7327
7305 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, 7328 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline,
7306 TransformOperations(), perspective); 7329 1.0, TransformOperations(),
7330 perspective);
7307 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7331 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7308 ExecuteCalculateDrawProperties(grand_parent_raw); 7332 ExecuteCalculateDrawProperties(grand_parent_raw);
7309 7333
7310 // |child| has a scale-affecting animation but computing the maximum of this 7334 // |child| has a scale-affecting animation but computing the maximum of this
7311 // animation is not supported. 7335 // animation is not supported.
7312 EXPECT_EQ( 7336 EXPECT_EQ(
7313 0.f, 7337 0.f,
7314 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7338 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7315 EXPECT_EQ(0.f, 7339 EXPECT_EQ(0.f,
7316 parent_raw->draw_properties().maximum_animation_contents_scale); 7340 parent_raw->draw_properties().maximum_animation_contents_scale);
7317 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 7341 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
7318 EXPECT_EQ( 7342 EXPECT_EQ(
7319 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 7343 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
7320 7344
7321 EXPECT_EQ( 7345 EXPECT_EQ(
7322 0.f, 7346 0.f,
7323 grand_parent_raw->draw_properties().starting_animation_contents_scale); 7347 grand_parent_raw->draw_properties().starting_animation_contents_scale);
7324 EXPECT_EQ(0.f, 7348 EXPECT_EQ(0.f,
7325 parent_raw->draw_properties().starting_animation_contents_scale); 7349 parent_raw->draw_properties().starting_animation_contents_scale);
7326 EXPECT_EQ(0.f, 7350 EXPECT_EQ(0.f,
7327 child_raw->draw_properties().starting_animation_contents_scale); 7351 child_raw->draw_properties().starting_animation_contents_scale);
7328 EXPECT_EQ( 7352 EXPECT_EQ(
7329 0.f, 7353 0.f,
7330 grand_child_raw->draw_properties().starting_animation_contents_scale); 7354 grand_child_raw->draw_properties().starting_animation_contents_scale);
7331 7355
7332 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, 7356 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline,
7333 TargetProperty::TRANSFORM); 7357 TargetProperty::TRANSFORM);
7334 gfx::Transform scale_matrix; 7358 gfx::Transform scale_matrix;
7335 scale_matrix.Scale(1.f, 2.f); 7359 scale_matrix.Scale(1.f, 2.f);
7336 grand_parent_raw->SetTransform(scale_matrix); 7360 grand_parent_raw->SetTransform(scale_matrix);
7337 parent_raw->SetTransform(scale_matrix); 7361 parent_raw->SetTransform(scale_matrix);
7338 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7362 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7339 7363
7340 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, 7364 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline,
7341 TransformOperations(), scale); 7365 1.0, TransformOperations(), scale);
7342 ExecuteCalculateDrawProperties(grand_parent_raw); 7366 ExecuteCalculateDrawProperties(grand_parent_raw);
7343 7367
7344 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale 7368 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale
7345 // animation with maximum scale 5.f. 7369 // animation with maximum scale 5.f.
7346 EXPECT_EQ( 7370 EXPECT_EQ(
7347 0.f, 7371 0.f,
7348 grand_parent_raw->draw_properties().maximum_animation_contents_scale); 7372 grand_parent_raw->draw_properties().maximum_animation_contents_scale);
7349 EXPECT_EQ(10.f, 7373 EXPECT_EQ(10.f,
7350 parent_raw->draw_properties().maximum_animation_contents_scale); 7374 parent_raw->draw_properties().maximum_animation_contents_scale);
7351 EXPECT_EQ(10.f, 7375 EXPECT_EQ(10.f,
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
7734 std::unique_ptr<LayerImpl> child2 = 7758 std::unique_ptr<LayerImpl> child2 =
7735 LayerImpl::Create(host_impl.active_tree(), 3); 7759 LayerImpl::Create(host_impl.active_tree(), 3);
7736 LayerImpl* child2_layer = child2.get(); 7760 LayerImpl* child2_layer = child2.get();
7737 7761
7738 root->AddChild(std::move(child1)); 7762 root->AddChild(std::move(child1));
7739 root->AddChild(std::move(child2)); 7763 root->AddChild(std::move(child2));
7740 root->test_properties()->force_render_surface = true; 7764 root->test_properties()->force_render_surface = true;
7741 root->SetDrawsContent(true); 7765 root->SetDrawsContent(true);
7742 host_impl.active_tree()->SetRootLayer(std::move(root)); 7766 host_impl.active_tree()->SetRootLayer(std::move(root));
7743 7767
7768 host_impl.active_tree()->SetElementIdsForTesting();
7769
7744 gfx::Transform identity_matrix, scale_transform_child1, 7770 gfx::Transform identity_matrix, scale_transform_child1,
7745 scale_transform_child2; 7771 scale_transform_child2;
7746 scale_transform_child1.Scale(2, 3); 7772 scale_transform_child1.Scale(2, 3);
7747 scale_transform_child2.Scale(4, 5); 7773 scale_transform_child2.Scale(4, 5);
7748 7774
7749 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), 7775 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
7750 gfx::PointF(), gfx::Size(1, 1), true, false, 7776 gfx::PointF(), gfx::Size(1, 1), true, false,
7751 true); 7777 true);
7752 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, 7778 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1,
7753 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7779 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
(...skipping 10 matching lines...) Expand all
7764 7790
7765 ExecuteCalculateDrawProperties(root_layer); 7791 ExecuteCalculateDrawProperties(root_layer);
7766 7792
7767 TransformOperations scale; 7793 TransformOperations scale;
7768 scale.AppendScale(5.f, 8.f, 3.f); 7794 scale.AppendScale(5.f, 8.f, 3.f);
7769 7795
7770 scoped_refptr<AnimationTimeline> timeline = 7796 scoped_refptr<AnimationTimeline> timeline =
7771 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 7797 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
7772 host_impl.animation_host()->AddAnimationTimeline(timeline); 7798 host_impl.animation_host()->AddAnimationTimeline(timeline);
7773 7799
7774 AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0,
7775 TransformOperations(), scale);
7776
7777 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, 7800 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2,
7778 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7801 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
7779 true, false, false); 7802 true, false, false);
7780 child2_layer->SetDrawsContent(true); 7803 child2_layer->SetDrawsContent(true);
7781 7804
7805 AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline,
7806 1.0, TransformOperations(), scale);
7807
7782 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; 7808 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
7783 ExecuteCalculateDrawProperties(root_layer); 7809 ExecuteCalculateDrawProperties(root_layer);
7784 7810
7785 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); 7811 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale());
7786 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); 7812 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale());
7787 EXPECT_FLOAT_EQ(3.f, child1_layer->mask_layer()->GetIdealContentsScale()); 7813 EXPECT_FLOAT_EQ(3.f, child1_layer->mask_layer()->GetIdealContentsScale());
7788 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); 7814 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale());
7789 7815
7790 EXPECT_FLOAT_EQ( 7816 EXPECT_FLOAT_EQ(
7791 0.f, root_layer->draw_properties().maximum_animation_contents_scale); 7817 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
8039 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { 8065 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) {
8040 const gfx::Transform identity_matrix; 8066 const gfx::Transform identity_matrix;
8041 scoped_refptr<Layer> root = Layer::Create(); 8067 scoped_refptr<Layer> root = Layer::Create();
8042 scoped_refptr<LayerWithForcedDrawsContent> animated = 8068 scoped_refptr<LayerWithForcedDrawsContent> animated =
8043 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8069 make_scoped_refptr(new LayerWithForcedDrawsContent());
8044 8070
8045 root->AddChild(animated); 8071 root->AddChild(animated);
8046 8072
8047 host()->SetRootLayer(root); 8073 host()->SetRootLayer(root);
8048 8074
8075 host()->SetElementIdsForTesting();
8076
8049 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 8077 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
8050 gfx::PointF(), gfx::Size(100, 100), true, false); 8078 gfx::PointF(), gfx::Size(100, 100), true, false);
8051 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 8079 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
8052 gfx::PointF(), gfx::Size(20, 20), true, false); 8080 gfx::PointF(), gfx::Size(20, 20), true, false);
8053 8081
8054 root->SetMasksToBounds(true); 8082 root->SetMasksToBounds(true);
8055 root->SetForceRenderSurfaceForTesting(true); 8083 root->SetForceRenderSurfaceForTesting(true);
8056 animated->SetOpacity(0.f); 8084 animated->SetOpacity(0.f);
8057 8085
8058 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, 8086 AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(),
8059 1.f, false); 8087 10.0, 0.f, 1.f, false);
8060 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8088 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8061 8089
8062 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); 8090 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty());
8063 } 8091 }
8064 8092
8065 TEST_F(LayerTreeHostCommonTest, 8093 TEST_F(LayerTreeHostCommonTest,
8066 VisibleContentRectForAnimatedLayerWithSingularTransform) { 8094 VisibleContentRectForAnimatedLayerWithSingularTransform) {
8067 const gfx::Transform identity_matrix; 8095 const gfx::Transform identity_matrix;
8068 scoped_refptr<Layer> root = Layer::Create(); 8096 scoped_refptr<Layer> root = Layer::Create();
8069 scoped_refptr<Layer> clip = Layer::Create(); 8097 scoped_refptr<Layer> clip = Layer::Create();
8070 scoped_refptr<LayerWithForcedDrawsContent> animated = 8098 scoped_refptr<LayerWithForcedDrawsContent> animated =
8071 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8099 make_scoped_refptr(new LayerWithForcedDrawsContent());
8072 scoped_refptr<LayerWithForcedDrawsContent> surface = 8100 scoped_refptr<LayerWithForcedDrawsContent> surface =
8073 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8101 make_scoped_refptr(new LayerWithForcedDrawsContent());
8074 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = 8102 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation =
8075 make_scoped_refptr(new LayerWithForcedDrawsContent()); 8103 make_scoped_refptr(new LayerWithForcedDrawsContent());
8076 8104
8077 root->AddChild(clip); 8105 root->AddChild(clip);
8078 clip->AddChild(animated); 8106 clip->AddChild(animated);
8079 animated->AddChild(surface); 8107 animated->AddChild(surface);
8080 surface->AddChild(descendant_of_animation); 8108 surface->AddChild(descendant_of_animation);
8081 8109
8082 clip->SetMasksToBounds(true); 8110 clip->SetMasksToBounds(true);
8083 surface->SetForceRenderSurfaceForTesting(true); 8111 surface->SetForceRenderSurfaceForTesting(true);
8084 8112
8085 host()->SetRootLayer(root); 8113 host()->SetRootLayer(root);
8086 8114
8115 host()->SetElementIdsForTesting();
8116
8087 gfx::Transform uninvertible_matrix; 8117 gfx::Transform uninvertible_matrix;
8088 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); 8118 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f);
8089 8119
8090 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 8120 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
8091 gfx::PointF(), gfx::Size(100, 100), true, false); 8121 gfx::PointF(), gfx::Size(100, 100), true, false);
8092 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(), 8122 SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(),
8093 gfx::PointF(), gfx::Size(10, 10), true, false); 8123 gfx::PointF(), gfx::Size(10, 10), true, false);
8094 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix, 8124 SetLayerPropertiesForTesting(animated.get(), uninvertible_matrix,
8095 gfx::Point3F(), gfx::PointF(), 8125 gfx::Point3F(), gfx::PointF(),
8096 gfx::Size(120, 120), true, false); 8126 gfx::Size(120, 120), true, false);
8097 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), 8127 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(),
8098 gfx::PointF(), gfx::Size(100, 100), true, false); 8128 gfx::PointF(), gfx::Size(100, 100), true, false);
8099 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix, 8129 SetLayerPropertiesForTesting(descendant_of_animation.get(), identity_matrix,
8100 gfx::Point3F(), gfx::PointF(), 8130 gfx::Point3F(), gfx::PointF(),
8101 gfx::Size(200, 200), true, false); 8131 gfx::Size(200, 200), true, false);
8102 8132
8103 TransformOperations start_transform_operations; 8133 TransformOperations start_transform_operations;
8104 start_transform_operations.AppendMatrix(uninvertible_matrix); 8134 start_transform_operations.AppendMatrix(uninvertible_matrix);
8105 TransformOperations end_transform_operations; 8135 TransformOperations end_transform_operations;
8106 8136
8107 AddAnimatedTransformToLayerWithPlayer(animated->id(), timeline(), 10.0, 8137 SetElementIdsForTesting();
8108 start_transform_operations, 8138 AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(),
8109 end_transform_operations); 8139 10.0, start_transform_operations,
8140 end_transform_operations);
8110 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8141 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8111 8142
8112 // The animated layer has a singular transform and maps to a non-empty rect in 8143 // The animated layer has a singular transform and maps to a non-empty rect in
8113 // clipped target space, so is treated as fully visible. 8144 // clipped target space, so is treated as fully visible.
8114 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); 8145 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing());
8115 8146
8116 // The singular transform on |animated| is flattened when inherited by 8147 // The singular transform on |animated| is flattened when inherited by
8117 // |surface|, and this happens to make it invertible. 8148 // |surface|, and this happens to make it invertible.
8118 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); 8149 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing());
8119 EXPECT_EQ(gfx::Rect(2, 2), 8150 EXPECT_EQ(gfx::Rect(2, 2),
(...skipping 26 matching lines...) Expand all
8146 LayerImpl* grandchild = AddChild<LayerImpl>(child); 8177 LayerImpl* grandchild = AddChild<LayerImpl>(child);
8147 8178
8148 gfx::Transform identity_transform; 8179 gfx::Transform identity_transform;
8149 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 8180 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
8150 gfx::PointF(), gfx::Size(50, 50), true, false); 8181 gfx::PointF(), gfx::Size(50, 50), true, false);
8151 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), 8182 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(),
8152 gfx::PointF(), gfx::Size(50, 50), true, false); 8183 gfx::PointF(), gfx::Size(50, 50), true, false);
8153 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), 8184 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(),
8154 gfx::PointF(), gfx::Size(50, 50), true, false); 8185 gfx::PointF(), gfx::Size(50, 50), true, false);
8155 8186
8156 AddAnimatedFilterToLayerWithPlayer(child->id(), timeline_impl(), 10.0, 0.1f, 8187 SetElementIdsForTesting();
8157 0.2f); 8188 AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(),
8189 10.0, 0.1f, 0.2f);
8158 ExecuteCalculateDrawProperties(root); 8190 ExecuteCalculateDrawProperties(root);
8159 8191
8160 EXPECT_TRUE(root->has_render_surface()); 8192 EXPECT_TRUE(root->has_render_surface());
8161 EXPECT_TRUE(child->has_render_surface()); 8193 EXPECT_TRUE(child->has_render_surface());
8162 EXPECT_FALSE(grandchild->has_render_surface()); 8194 EXPECT_FALSE(grandchild->has_render_surface());
8163 8195
8164 EXPECT_TRUE(root->filters().IsEmpty()); 8196 EXPECT_TRUE(root->filters().IsEmpty());
8165 EXPECT_TRUE(child->filters().IsEmpty()); 8197 EXPECT_TRUE(child->filters().IsEmpty());
8166 EXPECT_TRUE(grandchild->filters().IsEmpty()); 8198 EXPECT_TRUE(grandchild->filters().IsEmpty());
8167 8199
(...skipping 10 matching lines...) Expand all
8178 LayerImpl* grandchild = AddChild<LayerImpl>(child); 8210 LayerImpl* grandchild = AddChild<LayerImpl>(child);
8179 8211
8180 gfx::Transform identity_transform; 8212 gfx::Transform identity_transform;
8181 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 8213 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
8182 gfx::PointF(), gfx::Size(50, 50), true, false); 8214 gfx::PointF(), gfx::Size(50, 50), true, false);
8183 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), 8215 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(),
8184 gfx::PointF(), gfx::Size(50, 50), true, false); 8216 gfx::PointF(), gfx::Size(50, 50), true, false);
8185 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), 8217 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(),
8186 gfx::PointF(), gfx::Size(50, 50), true, false); 8218 gfx::PointF(), gfx::Size(50, 50), true, false);
8187 8219
8220 SetElementIdsForTesting();
8221
8188 std::unique_ptr<KeyframedFilterAnimationCurve> curve( 8222 std::unique_ptr<KeyframedFilterAnimationCurve> curve(
8189 KeyframedFilterAnimationCurve::Create()); 8223 KeyframedFilterAnimationCurve::Create());
8190 FilterOperations start_filters; 8224 FilterOperations start_filters;
8191 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); 8225 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f));
8192 FilterOperations end_filters; 8226 FilterOperations end_filters;
8193 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); 8227 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f));
8194 curve->AddKeyframe( 8228 curve->AddKeyframe(
8195 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); 8229 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
8196 curve->AddKeyframe(FilterKeyframe::Create( 8230 curve->AddKeyframe(FilterKeyframe::Create(
8197 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); 8231 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr));
8198 std::unique_ptr<Animation> animation = 8232 std::unique_ptr<Animation> animation =
8199 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); 8233 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER);
8200 animation->set_fill_mode(Animation::FillMode::NONE); 8234 animation->set_fill_mode(Animation::FillMode::NONE);
8201 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8235 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8202 8236
8203 AddAnimationToLayerWithPlayer(child->id(), timeline_impl(), 8237 AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(),
8204 std::move(animation)); 8238 std::move(animation));
8205 ExecuteCalculateDrawProperties(root); 8239 ExecuteCalculateDrawProperties(root);
8206 8240
8207 EXPECT_TRUE(root->has_render_surface()); 8241 EXPECT_TRUE(root->has_render_surface());
8208 EXPECT_TRUE(child->has_render_surface()); 8242 EXPECT_TRUE(child->has_render_surface());
8209 EXPECT_FALSE(grandchild->has_render_surface()); 8243 EXPECT_FALSE(grandchild->has_render_surface());
8210 8244
8211 EXPECT_TRUE(root->filters().IsEmpty()); 8245 EXPECT_TRUE(root->filters().IsEmpty());
8212 EXPECT_TRUE(child->filters().IsEmpty()); 8246 EXPECT_TRUE(child->filters().IsEmpty());
8213 EXPECT_TRUE(grandchild->filters().IsEmpty()); 8247 EXPECT_TRUE(grandchild->filters().IsEmpty());
8214 8248
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
8556 gfx::PointF(), gfx::Size(10, 10), true, false); 8590 gfx::PointF(), gfx::Size(10, 10), true, false);
8557 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), 8591 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(),
8558 gfx::PointF(), gfx::Size(10, 10), true, false); 8592 gfx::PointF(), gfx::Size(10, 10), true, false);
8559 8593
8560 root->AddChild(child); 8594 root->AddChild(child);
8561 child->AddChild(grandchild); 8595 child->AddChild(grandchild);
8562 grandchild->AddChild(greatgrandchild); 8596 grandchild->AddChild(greatgrandchild);
8563 8597
8564 host()->SetRootLayer(root); 8598 host()->SetRootLayer(root);
8565 8599
8600 host()->SetElementIdsForTesting();
8601
8566 // Check the non-skipped case. 8602 // Check the non-skipped case.
8567 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8603 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8568 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8604 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8569 8605
8570 // Now we will reset the visible rect from property trees for the grandchild, 8606 // Now we will reset the visible rect from property trees for the grandchild,
8571 // and we will configure |child| in several ways that should force the subtree 8607 // and we will configure |child| in several ways that should force the subtree
8572 // to be skipped. The visible content rect for |grandchild| should, therefore, 8608 // to be skipped. The visible content rect for |grandchild| should, therefore,
8573 // remain empty. 8609 // remain empty.
8574 grandchild->set_visible_layer_rect(gfx::Rect()); 8610 grandchild->set_visible_layer_rect(gfx::Rect());
8575 gfx::Transform singular; 8611 gfx::Transform singular;
(...skipping 14 matching lines...) Expand all
8590 child->SetTransform(zero_z_scale); 8626 child->SetTransform(zero_z_scale);
8591 8627
8592 // Add a transform animation with a start delay. Now, even though |child| has 8628 // Add a transform animation with a start delay. Now, even though |child| has
8593 // a singular transform, the subtree should still get processed. 8629 // a singular transform, the subtree should still get processed.
8594 int animation_id = 0; 8630 int animation_id = 0;
8595 std::unique_ptr<Animation> animation = Animation::Create( 8631 std::unique_ptr<Animation> animation = Animation::Create(
8596 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 8632 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)),
8597 animation_id, 1, TargetProperty::TRANSFORM); 8633 animation_id, 1, TargetProperty::TRANSFORM);
8598 animation->set_fill_mode(Animation::FillMode::NONE); 8634 animation->set_fill_mode(Animation::FillMode::NONE);
8599 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8635 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8600 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); 8636 AddAnimationToElementWithPlayer(child->element_id(), timeline(),
8637 std::move(animation));
8601 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8638 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8602 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8639 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8603 grandchild->set_visible_layer_rect(gfx::Rect()); 8640 grandchild->set_visible_layer_rect(gfx::Rect());
8604 8641
8605 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), 8642 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(),
8606 animation_id); 8643 animation_id);
8607 child->SetTransform(identity); 8644 child->SetTransform(identity);
8608 child->SetOpacity(0.f); 8645 child->SetOpacity(0.f);
8609 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8646 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8610 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8647 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing());
8611 8648
8612 // Now, even though child has zero opacity, we will configure |grandchild| and 8649 // Now, even though child has zero opacity, we will configure |grandchild| and
8613 // |greatgrandchild| in several ways that should force the subtree to be 8650 // |greatgrandchild| in several ways that should force the subtree to be
8614 // processed anyhow. 8651 // processed anyhow.
8615 grandchild->RequestCopyOfOutput( 8652 grandchild->RequestCopyOfOutput(
8616 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); 8653 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback)));
8617 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8654 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8618 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8655 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8619 greatgrandchild->set_visible_layer_rect(gfx::Rect()); 8656 greatgrandchild->set_visible_layer_rect(gfx::Rect());
8620 8657
8621 // Add an opacity animation with a start delay. 8658 // Add an opacity animation with a start delay.
8622 animation_id = 1; 8659 animation_id = 1;
8623 animation = Animation::Create( 8660 animation = Animation::Create(
8624 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 8661 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
8625 animation_id, 1, TargetProperty::OPACITY); 8662 animation_id, 1, TargetProperty::OPACITY);
8626 animation->set_fill_mode(Animation::FillMode::NONE); 8663 animation->set_fill_mode(Animation::FillMode::NONE);
8627 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8664 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8628 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), 8665 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(),
8629 std::move(animation)); 8666 std::move(animation));
8630 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8667 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8631 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8668 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8632 } 8669 }
8633 8670
8634 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { 8671 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) {
8635 FakeImplTaskRunnerProvider task_runner_provider; 8672 FakeImplTaskRunnerProvider task_runner_provider;
8636 TestSharedBitmapManager shared_bitmap_manager; 8673 TestSharedBitmapManager shared_bitmap_manager;
8637 TestTaskGraphRunner task_graph_runner; 8674 TestTaskGraphRunner task_graph_runner;
8638 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8675 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8639 &task_graph_runner); 8676 &task_graph_runner);
(...skipping 24 matching lines...) Expand all
8664 false); 8701 false);
8665 8702
8666 LayerImpl* root_ptr = root.get(); 8703 LayerImpl* root_ptr = root.get();
8667 LayerImpl* child_ptr = child.get(); 8704 LayerImpl* child_ptr = child.get();
8668 LayerImpl* grandchild_ptr = grandchild.get(); 8705 LayerImpl* grandchild_ptr = grandchild.get();
8669 8706
8670 child->AddChild(std::move(grandchild)); 8707 child->AddChild(std::move(grandchild));
8671 root->AddChild(std::move(child)); 8708 root->AddChild(std::move(child));
8672 host_impl.active_tree()->SetRootLayer(std::move(root)); 8709 host_impl.active_tree()->SetRootLayer(std::move(root));
8673 8710
8711 host_impl.active_tree()->SetElementIdsForTesting();
8712
8674 // Check the non-skipped case. 8713 // Check the non-skipped case.
8675 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8714 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8676 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8715 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8677 8716
8678 // Now we will reset the visible rect from property trees for the grandchild, 8717 // Now we will reset the visible rect from property trees for the grandchild,
8679 // and we will configure |child| in several ways that should force the subtree 8718 // and we will configure |child| in several ways that should force the subtree
8680 // to be skipped. The visible content rect for |grandchild| should, therefore, 8719 // to be skipped. The visible content rect for |grandchild| should, therefore,
8681 // remain empty. 8720 // remain empty.
8682 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8721 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8683 8722
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
8759 TransformOperations operation; 8798 TransformOperations operation;
8760 operation.AppendMatrix(transform); 8799 operation.AppendMatrix(transform);
8761 curve->AddKeyframe( 8800 curve->AddKeyframe(
8762 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8801 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8763 curve->AddKeyframe(TransformKeyframe::Create( 8802 curve->AddKeyframe(TransformKeyframe::Create(
8764 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8803 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8765 std::unique_ptr<Animation> transform_animation( 8804 std::unique_ptr<Animation> transform_animation(
8766 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8805 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8767 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8806 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8768 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( 8807 host_impl.active_tree()->animation_host()->RegisterPlayerForElement(
8769 root_ptr->id(), player.get()); 8808 root_ptr->element_id(), player.get());
8770 host_impl.active_tree() 8809 host_impl.active_tree()
8771 ->animation_host() 8810 ->animation_host()
8772 ->GetElementAnimationsForElementId(root_ptr->id()) 8811 ->GetElementAnimationsForElementId(root_ptr->element_id())
8773 ->AddAnimation(std::move(transform_animation)); 8812 ->AddAnimation(std::move(transform_animation));
8774 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8813 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8775 child_ptr->SetScrollClipLayer(root_ptr->id()); 8814 child_ptr->SetScrollClipLayer(root_ptr->id());
8776 root_ptr->SetTransform(singular); 8815 root_ptr->SetTransform(singular);
8777 child_ptr->SetTransform(singular); 8816 child_ptr->SetTransform(singular);
8778 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8817 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8779 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8818 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8780 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8819 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8781 8820
8782 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( 8821 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement(
8783 root_ptr->id(), player.get()); 8822 root_ptr->element_id(), player.get());
8784 } 8823 }
8785 8824
8786 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { 8825 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) {
8787 LayerImpl* root = root_layer(); 8826 LayerImpl* root = root_layer();
8788 LayerImpl* child = AddChild<LayerImpl>(root); 8827 LayerImpl* child = AddChild<LayerImpl>(root);
8789 LayerImpl* grand_child = AddChild<LayerImpl>(child); 8828 LayerImpl* grand_child = AddChild<LayerImpl>(child);
8790 8829
8791 gfx::Transform identity; 8830 gfx::Transform identity;
8792 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 8831 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8793 gfx::Size(10, 10), true, false, true); 8832 gfx::Size(10, 10), true, false, true);
8794 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 8833 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
8795 gfx::Size(10, 10), true, false, false); 8834 gfx::Size(10, 10), true, false, false);
8796 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), 8835 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
8797 gfx::PointF(), gfx::Size(10, 10), true, false, 8836 gfx::PointF(), gfx::Size(10, 10), true, false,
8798 false); 8837 false);
8838 SetElementIdsForTesting();
8799 8839
8800 gfx::Transform singular; 8840 gfx::Transform singular;
8801 singular.matrix().set(0, 0, 0); 8841 singular.matrix().set(0, 0, 0);
8802 singular.matrix().set(0, 1, 1); 8842 singular.matrix().set(0, 1, 1);
8803 8843
8804 child->SetTransform(singular); 8844 child->SetTransform(singular);
8805 child->SetDrawsContent(true); 8845 child->SetDrawsContent(true);
8806 grand_child->SetDrawsContent(true); 8846 grand_child->SetDrawsContent(true);
8807 8847
8808 std::unique_ptr<KeyframedTransformAnimationCurve> curve( 8848 std::unique_ptr<KeyframedTransformAnimationCurve> curve(
8809 KeyframedTransformAnimationCurve::Create()); 8849 KeyframedTransformAnimationCurve::Create());
8810 TransformOperations start; 8850 TransformOperations start;
8811 start.AppendTranslate(1.f, 2.f, 3.f); 8851 start.AppendTranslate(1.f, 2.f, 3.f);
8812 gfx::Transform transform; 8852 gfx::Transform transform;
8813 transform.Scale3d(1.0, 2.0, 3.0); 8853 transform.Scale3d(1.0, 2.0, 3.0);
8814 TransformOperations operation; 8854 TransformOperations operation;
8815 operation.AppendMatrix(transform); 8855 operation.AppendMatrix(transform);
8816 curve->AddKeyframe( 8856 curve->AddKeyframe(
8817 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8857 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8818 curve->AddKeyframe(TransformKeyframe::Create( 8858 curve->AddKeyframe(TransformKeyframe::Create(
8819 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8859 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8820 std::unique_ptr<Animation> transform_animation( 8860 std::unique_ptr<Animation> transform_animation(
8821 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8861 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8822 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8862 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8823 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( 8863 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement(
8824 grand_child->id(), player.get()); 8864 grand_child->element_id(), player.get());
8825 host_impl() 8865 host_impl()
8826 ->active_tree() 8866 ->active_tree()
8827 ->animation_host() 8867 ->animation_host()
8828 ->GetElementAnimationsForElementId(grand_child->id()) 8868 ->GetElementAnimationsForElementId(grand_child->element_id())
8829 ->AddAnimation(std::move(transform_animation)); 8869 ->AddAnimation(std::move(transform_animation));
8830 8870
8831 ExecuteCalculateDrawProperties(root); 8871 ExecuteCalculateDrawProperties(root);
8832 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); 8872 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect());
8833 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 8873 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
8834 8874
8835 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( 8875 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement(
8836 grand_child->id(), player.get()); 8876 grand_child->element_id(), player.get());
8837 } 8877 }
8838 8878
8839 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { 8879 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) {
8840 FakeImplTaskRunnerProvider task_runner_provider; 8880 FakeImplTaskRunnerProvider task_runner_provider;
8841 TestSharedBitmapManager shared_bitmap_manager; 8881 TestSharedBitmapManager shared_bitmap_manager;
8842 TestTaskGraphRunner task_graph_runner; 8882 TestTaskGraphRunner task_graph_runner;
8843 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8883 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8844 &task_graph_runner); 8884 &task_graph_runner);
8845 8885
8846 gfx::Transform identity; 8886 gfx::Transform identity;
(...skipping 22 matching lines...) Expand all
8869 gfx::PointF(), gfx::Size(10, 10), true, false, 8909 gfx::PointF(), gfx::Size(10, 10), true, false,
8870 false); 8910 false);
8871 8911
8872 LayerImpl* root_ptr = root.get(); 8912 LayerImpl* root_ptr = root.get();
8873 LayerImpl* grandchild_ptr = grandchild.get(); 8913 LayerImpl* grandchild_ptr = grandchild.get();
8874 8914
8875 child->AddChild(std::move(grandchild)); 8915 child->AddChild(std::move(grandchild));
8876 root->AddChild(std::move(child)); 8916 root->AddChild(std::move(child));
8877 8917
8878 host_impl.pending_tree()->SetRootLayer(std::move(root)); 8918 host_impl.pending_tree()->SetRootLayer(std::move(root));
8919 host_impl.pending_tree()->SetElementIdsForTesting();
8879 8920
8880 // Check the non-skipped case. 8921 // Check the non-skipped case.
8881 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8922 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8882 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8923 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8883 8924
8884 std::unique_ptr<KeyframedFloatAnimationCurve> curve( 8925 std::unique_ptr<KeyframedFloatAnimationCurve> curve(
8885 KeyframedFloatAnimationCurve::Create()); 8926 KeyframedFloatAnimationCurve::Create());
8886 std::unique_ptr<TimingFunction> func = EaseTimingFunction::Create(); 8927 std::unique_ptr<TimingFunction> func = EaseTimingFunction::Create();
8887 curve->AddKeyframe( 8928 curve->AddKeyframe(
8888 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); 8929 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func)));
8889 curve->AddKeyframe( 8930 curve->AddKeyframe(
8890 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); 8931 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr));
8891 std::unique_ptr<Animation> animation( 8932 std::unique_ptr<Animation> animation(
8892 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); 8933 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY));
8893 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8934 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8894 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( 8935 host_impl.active_tree()->animation_host()->RegisterPlayerForElement(
8895 root_ptr->id(), player.get()); 8936 root_ptr->element_id(), player.get());
8896 host_impl.active_tree() 8937 host_impl.active_tree()
8897 ->animation_host() 8938 ->animation_host()
8898 ->GetElementAnimationsForElementId(root_ptr->id()) 8939 ->GetElementAnimationsForElementId(root_ptr->element_id())
8899 ->AddAnimation(std::move(animation)); 8940 ->AddAnimation(std::move(animation));
8900 root_ptr->test_properties()->opacity = 0.f; 8941 root_ptr->test_properties()->opacity = 0.f;
8901 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8942 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8902 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8943 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8903 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8944 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8904 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8945 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8905 8946
8906 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( 8947 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement(
8907 root_ptr->id(), player.get()); 8948 root_ptr->element_id(), player.get());
8908 } 8949 }
8909 8950
8910 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { 8951 TEST_F(LayerTreeHostCommonTest, SkippingLayer) {
8911 gfx::Transform identity; 8952 gfx::Transform identity;
8912 LayerImpl* root = root_layer(); 8953 LayerImpl* root = root_layer();
8913 LayerImpl* child = AddChild<LayerImpl>(root); 8954 LayerImpl* child = AddChild<LayerImpl>(root);
8914 8955
8915 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 8956 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8916 gfx::Size(100, 100), true, false, true); 8957 gfx::Size(100, 100), true, false, true);
8917 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 8958 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
9748 9789
9749 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { 9790 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) {
9750 const gfx::Transform identity_matrix; 9791 const gfx::Transform identity_matrix;
9751 scoped_refptr<Layer> root = Layer::Create(); 9792 scoped_refptr<Layer> root = Layer::Create();
9752 scoped_refptr<LayerWithForcedDrawsContent> animated = 9793 scoped_refptr<LayerWithForcedDrawsContent> animated =
9753 make_scoped_refptr(new LayerWithForcedDrawsContent()); 9794 make_scoped_refptr(new LayerWithForcedDrawsContent());
9754 root->AddChild(animated); 9795 root->AddChild(animated);
9755 9796
9756 host()->SetRootLayer(root); 9797 host()->SetRootLayer(root);
9757 9798
9799 host()->SetElementIdsForTesting();
9800
9758 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 9801 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
9759 gfx::PointF(), gfx::Size(100, 100), true, false); 9802 gfx::PointF(), gfx::Size(100, 100), true, false);
9760 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 9803 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
9761 gfx::PointF(), gfx::Size(20, 20), true, false); 9804 gfx::PointF(), gfx::Size(20, 20), true, false);
9762 9805
9763 root->SetForceRenderSurfaceForTesting(true); 9806 root->SetForceRenderSurfaceForTesting(true);
9764 animated->SetOpacity(0.f); 9807 animated->SetOpacity(0.f);
9765 9808
9766 scoped_refptr<AnimationPlayer> player = 9809 scoped_refptr<AnimationPlayer> player =
9767 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 9810 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
9768 timeline()->AttachPlayer(player); 9811 timeline()->AttachPlayer(player);
9769 player->AttachElement(animated->id()); 9812
9813 player->AttachElement(animated->element_id());
9770 9814
9771 int animation_id = 0; 9815 int animation_id = 0;
9772 std::unique_ptr<Animation> animation = Animation::Create( 9816 std::unique_ptr<Animation> animation = Animation::Create(
9773 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 9817 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
9774 animation_id, 1, TargetProperty::OPACITY); 9818 animation_id, 1, TargetProperty::OPACITY);
9775 animation->set_fill_mode(Animation::FillMode::NONE); 9819 animation->set_fill_mode(Animation::FillMode::NONE);
9776 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 9820 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
9777 Animation* animation_ptr = animation.get(); 9821 Animation* animation_ptr = animation.get();
9778 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), 9822 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(),
9779 std::move(animation)); 9823 std::move(animation));
9780 9824
9781 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 9825 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9782 9826
9783 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; 9827 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree;
9784 EffectNode* node = tree.Node(animated->effect_tree_index()); 9828 EffectNode* node = tree.Node(animated->effect_tree_index());
9785 EXPECT_FALSE(node->data.is_currently_animating_opacity); 9829 EXPECT_FALSE(node->data.is_currently_animating_opacity);
9786 EXPECT_TRUE(node->data.has_potential_opacity_animation); 9830 EXPECT_TRUE(node->data.has_potential_opacity_animation);
9787 9831
9788 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); 9832 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0));
9789 root->layer_tree_host()->AnimateLayers( 9833 root->layer_tree_host()->AnimateLayers(
(...skipping 10 matching lines...) Expand all
9800 9844
9801 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { 9845 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) {
9802 const gfx::Transform identity_matrix; 9846 const gfx::Transform identity_matrix;
9803 scoped_refptr<Layer> root = Layer::Create(); 9847 scoped_refptr<Layer> root = Layer::Create();
9804 scoped_refptr<LayerWithForcedDrawsContent> animated = 9848 scoped_refptr<LayerWithForcedDrawsContent> animated =
9805 make_scoped_refptr(new LayerWithForcedDrawsContent()); 9849 make_scoped_refptr(new LayerWithForcedDrawsContent());
9806 root->AddChild(animated); 9850 root->AddChild(animated);
9807 9851
9808 host()->SetRootLayer(root); 9852 host()->SetRootLayer(root);
9809 9853
9854 host()->SetElementIdsForTesting();
9855
9810 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 9856 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
9811 gfx::PointF(), gfx::Size(100, 100), true, false); 9857 gfx::PointF(), gfx::Size(100, 100), true, false);
9812 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), 9858 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
9813 gfx::PointF(), gfx::Size(20, 20), true, false); 9859 gfx::PointF(), gfx::Size(20, 20), true, false);
9814 9860
9815 root->SetForceRenderSurfaceForTesting(true); 9861 root->SetForceRenderSurfaceForTesting(true);
9816 9862
9817 scoped_refptr<AnimationPlayer> player = 9863 scoped_refptr<AnimationPlayer> player =
9818 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 9864 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
9819 timeline()->AttachPlayer(player); 9865 timeline()->AttachPlayer(player);
9820 player->AttachElement(animated->id()); 9866 player->AttachElement(animated->element_id());
9821 9867
9822 std::unique_ptr<KeyframedTransformAnimationCurve> curve( 9868 std::unique_ptr<KeyframedTransformAnimationCurve> curve(
9823 KeyframedTransformAnimationCurve::Create()); 9869 KeyframedTransformAnimationCurve::Create());
9824 TransformOperations start; 9870 TransformOperations start;
9825 start.AppendTranslate(1.f, 2.f, 3.f); 9871 start.AppendTranslate(1.f, 2.f, 3.f);
9826 gfx::Transform transform; 9872 gfx::Transform transform;
9827 transform.Scale3d(1.0, 2.0, 3.0); 9873 transform.Scale3d(1.0, 2.0, 3.0);
9828 TransformOperations operation; 9874 TransformOperations operation;
9829 operation.AppendMatrix(transform); 9875 operation.AppendMatrix(transform);
9830 curve->AddKeyframe( 9876 curve->AddKeyframe(
9831 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 9877 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
9832 curve->AddKeyframe(TransformKeyframe::Create( 9878 curve->AddKeyframe(TransformKeyframe::Create(
9833 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 9879 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
9834 std::unique_ptr<Animation> animation( 9880 std::unique_ptr<Animation> animation(
9835 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 9881 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
9836 animation->set_fill_mode(Animation::FillMode::NONE); 9882 animation->set_fill_mode(Animation::FillMode::NONE);
9837 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 9883 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
9838 Animation* animation_ptr = animation.get(); 9884 Animation* animation_ptr = animation.get();
9839 AddAnimationToLayerWithExistingPlayer(animated->id(), timeline(), 9885 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(),
9840 std::move(animation)); 9886 std::move(animation));
9841 9887
9842 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 9888 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9843 9889
9844 TransformTree& tree = 9890 TransformTree& tree =
9845 root->layer_tree_host()->property_trees()->transform_tree; 9891 root->layer_tree_host()->property_trees()->transform_tree;
9846 TransformNode* node = tree.Node(animated->transform_tree_index()); 9892 TransformNode* node = tree.Node(animated->transform_tree_index());
9847 EXPECT_FALSE(node->data.is_currently_animating); 9893 EXPECT_FALSE(node->data.is_currently_animating);
9848 EXPECT_TRUE(node->data.has_potential_animation); 9894 EXPECT_TRUE(node->data.has_potential_animation);
9849 9895
9850 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); 9896 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
10086 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10132 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10087 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10133 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10088 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10134 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10089 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10135 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10090 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10136 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10091 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10137 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10092 } 10138 }
10093 10139
10094 } // namespace 10140 } // namespace
10095 } // namespace cc 10141 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698