| 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> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "cc/animation/animation_host.h" | 15 #include "cc/animation/animation_host.h" |
| 16 #include "cc/animation/animation_id_provider.h" | 16 #include "cc/animation/animation_id_provider.h" |
| 17 #include "cc/animation/animation_player.h" | 17 #include "cc/animation/animation_player.h" |
| 18 #include "cc/animation/keyframed_animation_curve.h" | 18 #include "cc/animation/keyframed_animation_curve.h" |
| 19 #include "cc/animation/layer_animation_controller.h" | |
| 20 #include "cc/animation/transform_operations.h" | 19 #include "cc/animation/transform_operations.h" |
| 21 #include "cc/base/math_util.h" | 20 #include "cc/base/math_util.h" |
| 22 #include "cc/input/main_thread_scrolling_reason.h" | 21 #include "cc/input/main_thread_scrolling_reason.h" |
| 23 #include "cc/layers/content_layer_client.h" | 22 #include "cc/layers/content_layer_client.h" |
| 24 #include "cc/layers/layer.h" | 23 #include "cc/layers/layer.h" |
| 25 #include "cc/layers/layer_client.h" | 24 #include "cc/layers/layer_client.h" |
| 26 #include "cc/layers/layer_impl.h" | 25 #include "cc/layers/layer_impl.h" |
| 27 #include "cc/layers/layer_iterator.h" | 26 #include "cc/layers/layer_iterator.h" |
| 28 #include "cc/layers/render_surface_impl.h" | 27 #include "cc/layers/render_surface_impl.h" |
| 29 #include "cc/output/copy_output_request.h" | 28 #include "cc/output/copy_output_request.h" |
| (...skipping 8907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8937 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8936 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8938 curve->AddKeyframe(TransformKeyframe::Create( | 8937 curve->AddKeyframe(TransformKeyframe::Create( |
| 8939 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8938 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8940 std::unique_ptr<Animation> transform_animation( | 8939 std::unique_ptr<Animation> transform_animation( |
| 8941 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8940 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8942 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8941 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8943 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( | 8942 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( |
| 8944 root_ptr->id(), player.get()); | 8943 root_ptr->id(), player.get()); |
| 8945 host_impl.active_tree() | 8944 host_impl.active_tree() |
| 8946 ->animation_host() | 8945 ->animation_host() |
| 8947 ->GetControllerForLayerId(root_ptr->id()) | 8946 ->GetElementAnimationsForLayerId(root_ptr->id()) |
| 8948 ->AddAnimation(std::move(transform_animation)); | 8947 ->AddAnimation(std::move(transform_animation)); |
| 8949 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8948 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8950 child_ptr->SetScrollClipLayer(root_ptr->id()); | 8949 child_ptr->SetScrollClipLayer(root_ptr->id()); |
| 8951 root_ptr->SetTransform(singular); | 8950 root_ptr->SetTransform(singular); |
| 8952 child_ptr->SetTransform(singular); | 8951 child_ptr->SetTransform(singular); |
| 8953 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8952 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8954 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8953 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 8955 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8954 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8956 | 8955 |
| 8957 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( | 8956 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8993 curve->AddKeyframe(TransformKeyframe::Create( | 8992 curve->AddKeyframe(TransformKeyframe::Create( |
| 8994 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8993 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8995 std::unique_ptr<Animation> transform_animation( | 8994 std::unique_ptr<Animation> transform_animation( |
| 8996 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8995 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8997 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8996 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8998 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer( | 8997 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer( |
| 8999 grand_child->id(), player.get()); | 8998 grand_child->id(), player.get()); |
| 9000 host_impl() | 8999 host_impl() |
| 9001 ->active_tree() | 9000 ->active_tree() |
| 9002 ->animation_host() | 9001 ->animation_host() |
| 9003 ->GetControllerForLayerId(grand_child->id()) | 9002 ->GetElementAnimationsForLayerId(grand_child->id()) |
| 9004 ->AddAnimation(std::move(transform_animation)); | 9003 ->AddAnimation(std::move(transform_animation)); |
| 9005 | 9004 |
| 9006 ExecuteCalculateDrawProperties(root); | 9005 ExecuteCalculateDrawProperties(root); |
| 9007 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); | 9006 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); |
| 9008 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 9007 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 9009 | 9008 |
| 9010 host_impl()->active_tree()->animation_host()->UnregisterPlayerForLayer( | 9009 host_impl()->active_tree()->animation_host()->UnregisterPlayerForLayer( |
| 9011 grand_child->id(), player.get()); | 9010 grand_child->id(), player.get()); |
| 9012 } | 9011 } |
| 9013 | 9012 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9063 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); | 9062 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); |
| 9064 curve->AddKeyframe( | 9063 curve->AddKeyframe( |
| 9065 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); | 9064 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); |
| 9066 std::unique_ptr<Animation> animation( | 9065 std::unique_ptr<Animation> animation( |
| 9067 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); | 9066 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
| 9068 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 9067 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 9069 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( | 9068 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( |
| 9070 root_ptr->id(), player.get()); | 9069 root_ptr->id(), player.get()); |
| 9071 host_impl.active_tree() | 9070 host_impl.active_tree() |
| 9072 ->animation_host() | 9071 ->animation_host() |
| 9073 ->GetControllerForLayerId(root_ptr->id()) | 9072 ->GetElementAnimationsForLayerId(root_ptr->id()) |
| 9074 ->AddAnimation(std::move(animation)); | 9073 ->AddAnimation(std::move(animation)); |
| 9075 root_ptr->SetOpacity(0); | 9074 root_ptr->SetOpacity(0); |
| 9076 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 9075 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 9077 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 9076 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 9078 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 9077 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); |
| 9079 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9078 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9080 | 9079 |
| 9081 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( | 9080 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( |
| 9082 root_ptr->id(), player.get()); | 9081 root_ptr->id(), player.get()); |
| 9083 } | 9082 } |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10123 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10122 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10124 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10123 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10125 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10124 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10126 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10125 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10127 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10126 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10128 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10127 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10129 } | 10128 } |
| 10130 | 10129 |
| 10131 } // namespace | 10130 } // namespace |
| 10132 } // namespace cc | 10131 } // namespace cc |
| OLD | NEW |