OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 9827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9838 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) || | 9838 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) || |
9839 std::isnan(child->DrawTransform().matrix().get(1, 1)); | 9839 std::isnan(child->DrawTransform().matrix().get(1, 1)); |
9840 EXPECT_TRUE(is_inf_or_nan); | 9840 EXPECT_TRUE(is_inf_or_nan); |
9841 | 9841 |
9842 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); | 9842 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); |
9843 bool root_in_rsll = | 9843 bool root_in_rsll = |
9844 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 9844 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
9845 EXPECT_TRUE(root_in_rsll); | 9845 EXPECT_TRUE(root_in_rsll); |
9846 } | 9846 } |
9847 | 9847 |
| 9848 TEST_F(LayerTreeHostCommonTest, CurrentlyRunningOpacityAnimationsTrackingTest) { |
| 9849 const gfx::Transform identity_matrix; |
| 9850 scoped_refptr<Layer> root = Layer::Create(); |
| 9851 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 9852 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9853 root->AddChild(animated); |
| 9854 |
| 9855 host()->SetRootLayer(root); |
| 9856 |
| 9857 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9858 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9859 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 9860 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 9861 |
| 9862 root->SetForceRenderSurfaceForTesting(true); |
| 9863 animated->SetOpacity(0.f); |
| 9864 |
| 9865 scoped_refptr<AnimationPlayer> player = |
| 9866 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| 9867 timeline()->AttachPlayer(player); |
| 9868 player->AttachElement(animated->id()); |
| 9869 |
| 9870 AddOpacityTransitionToPlayer(player.get(), 10.0, 0.f, 1.f, false); |
| 9871 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9872 |
| 9873 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
| 9874 EffectNode* node = tree.Node(animated->effect_tree_index()); |
| 9875 EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| 9876 |
| 9877 root->layer_tree_host()->AnimateLayers( |
| 9878 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
| 9879 node = tree.Node(animated->effect_tree_index()); |
| 9880 EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| 9881 |
| 9882 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); |
| 9883 node = tree.Node(animated->effect_tree_index()); |
| 9884 EXPECT_FALSE(node->data.is_currently_animating_opacity); |
| 9885 } |
| 9886 |
9848 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { | 9887 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { |
9849 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 9888 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
9850 scroll.layer_id = 2; | 9889 scroll.layer_id = 2; |
9851 scroll.scroll_delta = gfx::Vector2d(5, 10); | 9890 scroll.scroll_delta = gfx::Vector2d(5, 10); |
9852 | 9891 |
9853 proto::ScrollUpdateInfo proto; | 9892 proto::ScrollUpdateInfo proto; |
9854 scroll.ToProtobuf(&proto); | 9893 scroll.ToProtobuf(&proto); |
9855 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; | 9894 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; |
9856 new_scroll.FromProtobuf(proto); | 9895 new_scroll.FromProtobuf(proto); |
9857 | 9896 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10070 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10109 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10071 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10110 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10072 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10111 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10073 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10112 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10074 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10113 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10075 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10114 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10076 } | 10115 } |
10077 | 10116 |
10078 } // namespace | 10117 } // namespace |
10079 } // namespace cc | 10118 } // namespace cc |
OLD | NEW |