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

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

Issue 1876903003: cc : Add node and ancestors are animated or invertible to transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 10 #include <set>
(...skipping 8855 matching lines...) Expand 10 before | Expand all | Expand 10 after
8866 host_impl.active_tree() 8866 host_impl.active_tree()
8867 ->animation_host() 8867 ->animation_host()
8868 ->GetControllerForLayerId(root_ptr->id()) 8868 ->GetControllerForLayerId(root_ptr->id())
8869 ->AddAnimation(std::move(transform_animation)); 8869 ->AddAnimation(std::move(transform_animation));
8870 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8870 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8871 child_ptr->SetScrollClipLayer(root_ptr->id()); 8871 child_ptr->SetScrollClipLayer(root_ptr->id());
8872 root_ptr->SetTransform(singular); 8872 root_ptr->SetTransform(singular);
8873 child_ptr->SetTransform(singular); 8873 child_ptr->SetTransform(singular);
8874 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8874 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8875 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8875 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8876 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8876 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8877 8877
8878 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( 8878 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer(
8879 root_ptr->id(), player.get()); 8879 root_ptr->id(), player.get());
8880 } 8880 }
8881 8881
8882 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) {
8883 LayerImpl* root = root_layer();
8884 LayerImpl* child = AddChild<LayerImpl>(root);
8885 LayerImpl* grand_child = AddChild<LayerImpl>(child);
8886
8887 gfx::Transform identity;
8888 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8889 gfx::Size(10, 10), true, false, true);
8890 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
8891 gfx::Size(10, 10), true, false, false);
8892 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
8893 gfx::PointF(), gfx::Size(10, 10), true, false,
8894 false);
8895
8896 gfx::Transform singular;
8897 singular.matrix().set(0, 0, 0);
8898 singular.matrix().set(0, 1, 1);
8899
8900 child->SetTransform(singular);
8901 child->SetDrawsContent(true);
8902 grand_child->SetDrawsContent(true);
8903
8904 scoped_ptr<KeyframedTransformAnimationCurve> curve(
8905 KeyframedTransformAnimationCurve::Create());
8906 TransformOperations start;
8907 start.AppendTranslate(1.f, 2.f, 3.f);
8908 gfx::Transform transform;
8909 transform.Scale3d(1.0, 2.0, 3.0);
8910 TransformOperations operation;
8911 operation.AppendMatrix(transform);
8912 curve->AddKeyframe(
8913 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8914 curve->AddKeyframe(TransformKeyframe::Create(
8915 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8916 scoped_ptr<Animation> transform_animation(
8917 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8918 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8919 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer(
8920 grand_child->id(), player.get());
8921 host_impl()
8922 ->active_tree()
8923 ->animation_host()
8924 ->GetControllerForLayerId(grand_child->id())
8925 ->AddAnimation(std::move(transform_animation));
8926
8927 ExecuteCalculateDrawProperties(root);
8928 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect());
8929 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
8930
8931 host_impl()->active_tree()->animation_host()->UnregisterPlayerForLayer(
8932 grand_child->id(), player.get());
8933 }
8934
8882 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { 8935 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) {
8883 FakeImplTaskRunnerProvider task_runner_provider; 8936 FakeImplTaskRunnerProvider task_runner_provider;
8884 TestSharedBitmapManager shared_bitmap_manager; 8937 TestSharedBitmapManager shared_bitmap_manager;
8885 TestTaskGraphRunner task_graph_runner; 8938 TestTaskGraphRunner task_graph_runner;
8886 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8939 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8887 &task_graph_runner); 8940 &task_graph_runner);
8888 8941
8889 gfx::Transform identity; 8942 gfx::Transform identity;
8890 host_impl.CreatePendingTree(); 8943 host_impl.CreatePendingTree();
8891 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 8944 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
9941 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 9994 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9942 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 9995 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9943 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 9996 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9944 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 9997 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9945 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 9998 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9946 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 9999 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9947 } 10000 }
9948 10001
9949 } // namespace 10002 } // namespace
9950 } // namespace cc 10003 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698