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 10422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10433 child->SetBounds(gfx::Size(20, 20)); | 10433 child->SetBounds(gfx::Size(20, 20)); |
10434 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); | 10434 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
10435 | 10435 |
10436 // Changing the opacity from 1 to non-1 value should trigger rebuild of | 10436 // Changing the opacity from 1 to non-1 value should trigger rebuild of |
10437 // property trees as a new effect node will be created. | 10437 // property trees as a new effect node will be created. |
10438 child->SetOpacity(0.5f); | 10438 child->SetOpacity(0.5f); |
10439 PropertyTrees* property_trees = host()->property_trees(); | 10439 PropertyTrees* property_trees = host()->property_trees(); |
10440 EXPECT_TRUE(property_trees->needs_rebuild); | 10440 EXPECT_TRUE(property_trees->needs_rebuild); |
10441 | 10441 |
10442 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); | 10442 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
10443 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), | 10443 EXPECT_NE(property_trees->layer_id_to_effect_node_index.find(child->id()), |
10444 property_trees->effect_id_to_index_map.end()); | 10444 property_trees->layer_id_to_effect_node_index.end()); |
10445 | 10445 |
10446 // child already has an effect node. Changing its opacity shouldn't trigger | 10446 // child already has an effect node. Changing its opacity shouldn't trigger |
10447 // a property trees rebuild. | 10447 // a property trees rebuild. |
10448 child->SetOpacity(0.8f); | 10448 child->SetOpacity(0.8f); |
10449 property_trees = host()->property_trees(); | 10449 property_trees = host()->property_trees(); |
10450 EXPECT_FALSE(property_trees->needs_rebuild); | 10450 EXPECT_FALSE(property_trees->needs_rebuild); |
10451 | 10451 |
10452 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); | 10452 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
10453 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), | 10453 EXPECT_NE(property_trees->layer_id_to_effect_node_index.find(child->id()), |
10454 property_trees->effect_id_to_index_map.end()); | 10454 property_trees->layer_id_to_effect_node_index.end()); |
10455 | 10455 |
10456 // Changing the opacity from non-1 value to 1 should trigger a rebuild of | 10456 // Changing the opacity from non-1 value to 1 should trigger a rebuild of |
10457 // property trees as the effect node may no longer be needed. | 10457 // property trees as the effect node may no longer be needed. |
10458 child->SetOpacity(1.f); | 10458 child->SetOpacity(1.f); |
10459 property_trees = host()->property_trees(); | 10459 property_trees = host()->property_trees(); |
10460 EXPECT_TRUE(property_trees->needs_rebuild); | 10460 EXPECT_TRUE(property_trees->needs_rebuild); |
10461 | 10461 |
10462 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); | 10462 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
10463 EXPECT_EQ(property_trees->effect_id_to_index_map.find(child->id()), | 10463 EXPECT_EQ(property_trees->layer_id_to_effect_node_index.find(child->id()), |
10464 property_trees->effect_id_to_index_map.end()); | 10464 property_trees->layer_id_to_effect_node_index.end()); |
10465 } | 10465 } |
10466 | 10466 |
10467 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { | 10467 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
10468 scoped_refptr<Layer> root = Layer::Create(); | 10468 scoped_refptr<Layer> root = Layer::Create(); |
10469 scoped_refptr<LayerWithForcedDrawsContent> animated = | 10469 scoped_refptr<LayerWithForcedDrawsContent> animated = |
10470 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 10470 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
10471 root->AddChild(animated); | 10471 root->AddChild(animated); |
10472 host()->SetRootLayer(root); | 10472 host()->SetRootLayer(root); |
10473 host()->GetLayerTree()->SetElementIdsForTesting(); | 10473 host()->GetLayerTree()->SetElementIdsForTesting(); |
10474 | 10474 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10759 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10759 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10760 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10760 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10761 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10761 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10762 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10762 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10763 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10763 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10764 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10764 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10765 } | 10765 } |
10766 | 10766 |
10767 } // namespace | 10767 } // namespace |
10768 } // namespace cc | 10768 } // namespace cc |
OLD | NEW |