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 9796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9807 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) || | 9807 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) || |
9808 std::isnan(child->DrawTransform().matrix().get(1, 1)); | 9808 std::isnan(child->DrawTransform().matrix().get(1, 1)); |
9809 EXPECT_TRUE(is_inf_or_nan); | 9809 EXPECT_TRUE(is_inf_or_nan); |
9810 | 9810 |
9811 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); | 9811 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); |
9812 bool root_in_rsll = | 9812 bool root_in_rsll = |
9813 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 9813 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
9814 EXPECT_TRUE(root_in_rsll); | 9814 EXPECT_TRUE(root_in_rsll); |
9815 } | 9815 } |
9816 | 9816 |
| 9817 TEST_F(LayerTreeHostCommonTest, CurrentlyRunningOpacityAnimationsTrackingTest) { |
| 9818 const gfx::Transform identity_matrix; |
| 9819 scoped_refptr<Layer> root = Layer::Create(); |
| 9820 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 9821 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9822 root->AddChild(animated); |
| 9823 |
| 9824 host()->SetRootLayer(root); |
| 9825 |
| 9826 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9827 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9828 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 9829 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 9830 |
| 9831 root->SetForceRenderSurfaceForTesting(true); |
| 9832 animated->SetOpacity(0.f); |
| 9833 |
| 9834 scoped_refptr<AnimationPlayer> player = |
| 9835 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| 9836 timeline()->AttachPlayer(player); |
| 9837 player->AttachElement(animated->id()); |
| 9838 |
| 9839 AddOpacityTransitionToPlayer(player.get(), 10.0, 0.f, 1.f, false); |
| 9840 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9841 |
| 9842 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
| 9843 EffectNode* node = tree.Node(animated->effect_tree_index()); |
| 9844 EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| 9845 |
| 9846 root->layer_tree_host()->AnimateLayers( |
| 9847 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
| 9848 node = tree.Node(animated->effect_tree_index()); |
| 9849 EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| 9850 |
| 9851 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); |
| 9852 node = tree.Node(animated->effect_tree_index()); |
| 9853 EXPECT_FALSE(node->data.is_currently_animating_opacity); |
| 9854 } |
| 9855 |
9817 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { | 9856 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { |
9818 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 9857 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
9819 scroll.layer_id = 2; | 9858 scroll.layer_id = 2; |
9820 scroll.scroll_delta = gfx::Vector2d(5, 10); | 9859 scroll.scroll_delta = gfx::Vector2d(5, 10); |
9821 | 9860 |
9822 proto::ScrollUpdateInfo proto; | 9861 proto::ScrollUpdateInfo proto; |
9823 scroll.ToProtobuf(&proto); | 9862 scroll.ToProtobuf(&proto); |
9824 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; | 9863 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; |
9825 new_scroll.FromProtobuf(proto); | 9864 new_scroll.FromProtobuf(proto); |
9826 | 9865 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10039 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10078 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10040 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10079 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10041 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10080 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10042 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10081 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10043 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10082 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10044 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10083 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10045 } | 10084 } |
10046 | 10085 |
10047 } // namespace | 10086 } // namespace |
10048 } // namespace cc | 10087 } // namespace cc |
OLD | NEW |