| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layers/layer_utils.h" | 5 #include "cc/layers/layer_utils.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_host.h" | 7 #include "cc/animation/animation_host.h" |
| 8 #include "cc/animation/animation_id_provider.h" | 8 #include "cc/animation/animation_id_provider.h" |
| 9 #include "cc/animation/transform_operations.h" | 9 #include "cc/animation/transform_operations.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 return std::sqrt(width * width + height * height); | 25 return std::sqrt(width * width + height * height); |
| 26 } | 26 } |
| 27 | 27 |
| 28 class LayerUtilsGetAnimationBoundsTest : public testing::Test { | 28 class LayerUtilsGetAnimationBoundsTest : public testing::Test { |
| 29 public: | 29 public: |
| 30 LayerUtilsGetAnimationBoundsTest() | 30 LayerUtilsGetAnimationBoundsTest() |
| 31 : host_impl_(&task_runner_provider_, | 31 : host_impl_(&task_runner_provider_, |
| 32 &shared_bitmap_manager_, | 32 &shared_bitmap_manager_, |
| 33 &task_graph_runner_), | 33 &task_graph_runner_), |
| 34 root_(CreateTwoForkTree(&host_impl_)), | 34 root_(CreateTwoForkTree(&host_impl_)), |
| 35 parent1_(root_->children()[0]), | 35 parent1_(root_->test_properties()->children[0]), |
| 36 parent2_(root_->children()[1]), | 36 parent2_(root_->test_properties()->children[1]), |
| 37 child1_(parent1_->children()[0]), | 37 child1_(parent1_->test_properties()->children[0]), |
| 38 child2_(parent2_->children()[0]), | 38 child2_(parent2_->test_properties()->children[0]), |
| 39 grand_child_(child2_->children()[0]), | 39 grand_child_(child2_->test_properties()->children[0]), |
| 40 great_grand_child_(grand_child_->children()[0]) { | 40 great_grand_child_(grand_child_->test_properties()->children[0]) { |
| 41 timeline_ = | 41 timeline_ = |
| 42 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 42 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 43 host_impl_.animation_host()->AddAnimationTimeline(timeline_); | 43 host_impl_.animation_host()->AddAnimationTimeline(timeline_); |
| 44 } | 44 } |
| 45 | 45 |
| 46 LayerImpl* root() { return root_; } | 46 LayerImpl* root() { return root_; } |
| 47 LayerImpl* parent1() { return parent1_; } | 47 LayerImpl* parent1() { return parent1_; } |
| 48 LayerImpl* child1() { return child1_; } | 48 LayerImpl* child1() { return child1_; } |
| 49 LayerImpl* parent2() { return parent2_; } | 49 LayerImpl* parent2() { return parent2_; } |
| 50 LayerImpl* child2() { return child2_; } | 50 LayerImpl* child2() { return child2_; } |
| 51 LayerImpl* grand_child() { return grand_child_; } | 51 LayerImpl* grand_child() { return grand_child_; } |
| 52 LayerImpl* great_grand_child() { return great_grand_child_; } | 52 LayerImpl* great_grand_child() { return great_grand_child_; } |
| 53 | 53 |
| 54 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } | 54 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } |
| 55 FakeLayerTreeHostImpl& host_impl() { return host_impl_; } | 55 FakeLayerTreeHostImpl& host_impl() { return host_impl_; } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 static LayerImpl* CreateTwoForkTree(LayerTreeHostImpl* host_impl) { | 58 static LayerImpl* CreateTwoForkTree(LayerTreeHostImpl* host_impl) { |
| 59 std::unique_ptr<LayerImpl> root = | 59 std::unique_ptr<LayerImpl> root = |
| 60 LayerImpl::Create(host_impl->active_tree(), 1); | 60 LayerImpl::Create(host_impl->active_tree(), 1); |
| 61 LayerImpl* root_ptr = root.get(); | 61 LayerImpl* root_ptr = root.get(); |
| 62 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 2)); | 62 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 2)); |
| 63 root->children()[0]->AddChild( | 63 root->test_properties()->children[0]->AddChild( |
| 64 LayerImpl::Create(host_impl->active_tree(), 3)); | 64 LayerImpl::Create(host_impl->active_tree(), 3)); |
| 65 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 4)); | 65 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 4)); |
| 66 root->children()[1]->AddChild( | 66 root->test_properties()->children[1]->AddChild( |
| 67 LayerImpl::Create(host_impl->active_tree(), 5)); | 67 LayerImpl::Create(host_impl->active_tree(), 5)); |
| 68 root->children()[1]->children()[0]->AddChild( | 68 root->test_properties() |
| 69 LayerImpl::Create(host_impl->active_tree(), 6)); | 69 ->children[1] |
| 70 root->children()[1]->children()[0]->children()[0]->AddChild( | 70 ->test_properties() |
| 71 LayerImpl::Create(host_impl->active_tree(), 7)); | 71 ->children[0] |
| 72 ->AddChild(LayerImpl::Create(host_impl->active_tree(), 6)); |
| 73 root->test_properties() |
| 74 ->children[1] |
| 75 ->test_properties() |
| 76 ->children[0] |
| 77 ->test_properties() |
| 78 ->children[0] |
| 79 ->AddChild(LayerImpl::Create(host_impl->active_tree(), 7)); |
| 72 host_impl->active_tree()->SetRootLayer(std::move(root)); | 80 host_impl->active_tree()->SetRootLayer(std::move(root)); |
| 73 return root_ptr; | 81 return root_ptr; |
| 74 } | 82 } |
| 75 | 83 |
| 76 FakeImplTaskRunnerProvider task_runner_provider_; | 84 FakeImplTaskRunnerProvider task_runner_provider_; |
| 77 TestSharedBitmapManager shared_bitmap_manager_; | 85 TestSharedBitmapManager shared_bitmap_manager_; |
| 78 TestTaskGraphRunner task_graph_runner_; | 86 TestTaskGraphRunner task_graph_runner_; |
| 79 FakeLayerTreeHostImpl host_impl_; | 87 FakeLayerTreeHostImpl host_impl_; |
| 80 LayerImpl* root_; | 88 LayerImpl* root_; |
| 81 LayerImpl* parent1_; | 89 LayerImpl* parent1_; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, | 570 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, |
| 563 // except for the perspective calculations. | 571 // except for the perspective calculations. |
| 564 | 572 |
| 565 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); | 573 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); |
| 566 EXPECT_BOXF_EQ(expected, box); | 574 EXPECT_BOXF_EQ(expected, box); |
| 567 } | 575 } |
| 568 | 576 |
| 569 } // namespace | 577 } // namespace |
| 570 | 578 |
| 571 } // namespace cc | 579 } // namespace cc |
| OLD | NEW |