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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 // changed. | 1057 // changed. |
1058 gfx::Size arbitrary_size = gfx::Size(111, 222); | 1058 gfx::Size arbitrary_size = gfx::Size(111, 222); |
1059 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 1059 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
1060 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); | 1060 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); |
1061 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( | 1061 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
1062 root->PushPropertiesTo(root_impl.get()); | 1062 root->PushPropertiesTo(root_impl.get()); |
1063 child->PushPropertiesTo(child_impl.get()); | 1063 child->PushPropertiesTo(child_impl.get()); |
1064 child2->PushPropertiesTo(child2_impl.get()); | 1064 child2->PushPropertiesTo(child2_impl.get()); |
1065 grand_child->PushPropertiesTo(grand_child_impl.get())); | 1065 grand_child->PushPropertiesTo(grand_child_impl.get())); |
1066 | 1066 |
| 1067 FilterOperations arbitrary_filters; |
| 1068 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
| 1069 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 1070 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters)); |
| 1071 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 1072 root->PushPropertiesTo(root_impl.get()); |
| 1073 child->PushPropertiesTo(child_impl.get()); |
| 1074 child2->PushPropertiesTo(child2_impl.get()); |
| 1075 grand_child->PushPropertiesTo(grand_child_impl.get())); |
| 1076 |
1067 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); | 1077 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); |
1068 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 1078 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
1069 root->SetPosition(arbitrary_point_f); | 1079 root->SetPosition(arbitrary_point_f); |
1070 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node( | 1080 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node( |
1071 root->transform_tree_index()); | 1081 root->transform_tree_index()); |
1072 EXPECT_TRUE(node->data.transform_changed); | 1082 EXPECT_TRUE(node->data.transform_changed); |
1073 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( | 1083 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
1074 root->PushPropertiesTo(root_impl.get()); | 1084 root->PushPropertiesTo(root_impl.get()); |
1075 child->PushPropertiesTo(child_impl.get()); | 1085 child->PushPropertiesTo(child_impl.get()); |
1076 child2->PushPropertiesTo(child2_impl.get()); | 1086 child2->PushPropertiesTo(child2_impl.get()); |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 | 1723 |
1714 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); | 1724 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); |
1715 | 1725 |
1716 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | 1726 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); |
1717 | 1727 |
1718 test_layer->PushPropertiesTo(impl_layer.get()); | 1728 test_layer->PushPropertiesTo(impl_layer.get()); |
1719 | 1729 |
1720 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); | 1730 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); |
1721 } | 1731 } |
1722 | 1732 |
1723 TEST_F(LayerTest, | |
1724 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) { | |
1725 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); | |
1726 scoped_ptr<LayerImpl> impl_layer = | |
1727 LayerImpl::Create(host_impl_.active_tree(), 1); | |
1728 | |
1729 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, | |
1730 layer_tree_host_->SetRootLayer(test_layer)); | |
1731 | |
1732 scoped_ptr<AnimationRegistrar> registrar; | |
1733 if (settings().use_compositor_animation_timelines) { | |
1734 AddAnimatedFilterToLayerWithPlayer(impl_layer->id(), timeline_impl(), 1.0, | |
1735 1.f, 2.f); | |
1736 } else { | |
1737 registrar = AnimationRegistrar::Create(); | |
1738 impl_layer->layer_animation_controller()->SetAnimationRegistrar( | |
1739 registrar.get()); | |
1740 | |
1741 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0, | |
1742 1.f, 2.f); | |
1743 } | |
1744 | |
1745 FilterOperations filters; | |
1746 filters.Append(FilterOperation::CreateBlurFilter(2.f)); | |
1747 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); | |
1748 | |
1749 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1750 test_layer->PushPropertiesTo(impl_layer.get()); | |
1751 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); | |
1752 | |
1753 impl_layer->ResetAllChangeTrackingForSubtree(); | |
1754 if (settings().use_compositor_animation_timelines) { | |
1755 int animation_id = AddAnimatedFilterToLayerWithPlayer( | |
1756 impl_layer->id(), timeline_impl(), 1.0, 1.f, 2.f); | |
1757 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), | |
1758 animation_id) | |
1759 ->set_is_impl_only(true); | |
1760 } else { | |
1761 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0, | |
1762 1.f, 2.f); | |
1763 impl_layer->layer_animation_controller() | |
1764 ->GetAnimation(TargetProperty::FILTER) | |
1765 ->set_is_impl_only(true); | |
1766 } | |
1767 filters.Append(FilterOperation::CreateSepiaFilter(0.5f)); | |
1768 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); | |
1769 | |
1770 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1771 test_layer->PushPropertiesTo(impl_layer.get()); | |
1772 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1773 } | |
1774 | |
1775 TEST_F(LayerTest, MaskAndReplicaHasParent) { | 1733 TEST_F(LayerTest, MaskAndReplicaHasParent) { |
1776 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); | 1734 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
1777 scoped_refptr<Layer> child = Layer::Create(layer_settings_); | 1735 scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
1778 scoped_refptr<Layer> mask = Layer::Create(layer_settings_); | 1736 scoped_refptr<Layer> mask = Layer::Create(layer_settings_); |
1779 scoped_refptr<Layer> replica = Layer::Create(layer_settings_); | 1737 scoped_refptr<Layer> replica = Layer::Create(layer_settings_); |
1780 scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); | 1738 scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); |
1781 scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); | 1739 scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); |
1782 scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); | 1740 scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); |
1783 scoped_refptr<Layer> replica_mask_replacement = | 1741 scoped_refptr<Layer> replica_mask_replacement = |
1784 Layer::Create(layer_settings_); | 1742 Layer::Create(layer_settings_); |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2689 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
2732 | 2690 |
2733 test_layer->PushPropertiesTo(impl_layer.get()); | 2691 test_layer->PushPropertiesTo(impl_layer.get()); |
2734 | 2692 |
2735 EXPECT_EQ(2lu, impl_layer->element_id()); | 2693 EXPECT_EQ(2lu, impl_layer->element_id()); |
2736 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2694 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
2737 } | 2695 } |
2738 | 2696 |
2739 } // namespace | 2697 } // namespace |
2740 } // namespace cc | 2698 } // namespace cc |
OLD | NEW |