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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
(...skipping 8794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8805 | 8805 |
8806 EXPECT_TRUE(root->filters().IsEmpty()); | 8806 EXPECT_TRUE(root->filters().IsEmpty()); |
8807 EXPECT_TRUE(child->filters().IsEmpty()); | 8807 EXPECT_TRUE(child->filters().IsEmpty()); |
8808 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8808 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
8809 | 8809 |
8810 EXPECT_FALSE(root->FilterIsAnimating()); | 8810 EXPECT_FALSE(root->FilterIsAnimating()); |
8811 EXPECT_TRUE(child->FilterIsAnimating()); | 8811 EXPECT_TRUE(child->FilterIsAnimating()); |
8812 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8812 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
8813 } | 8813 } |
8814 | 8814 |
| 8815 // Ensures that the property tree code accounts for offsets between fixed |
| 8816 // position layers and their respective containers. |
| 8817 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| 8818 scoped_refptr<Layer> root = Layer::Create(); |
| 8819 scoped_refptr<Layer> child = Layer::Create(); |
| 8820 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8821 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8822 |
| 8823 root->AddChild(child); |
| 8824 child->AddChild(grandchild); |
| 8825 |
| 8826 gfx::Transform identity_transform; |
| 8827 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8828 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8829 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8830 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8831 false); |
| 8832 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8833 gfx::Point3F(), gfx::PointF(-1000, -1000), |
| 8834 gfx::Size(50, 50), true, false); |
| 8835 |
| 8836 root->SetMasksToBounds(true); |
| 8837 root->SetIsContainerForFixedPositionLayers(true); |
| 8838 LayerPositionConstraint constraint; |
| 8839 constraint.set_is_fixed_position(true); |
| 8840 grandchild->SetPositionConstraint(constraint); |
| 8841 |
| 8842 root->SetIsContainerForFixedPositionLayers(true); |
| 8843 |
| 8844 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8845 host->SetRootLayer(root); |
| 8846 |
| 8847 ExecuteCalculateDrawProperties(root.get()); |
| 8848 |
| 8849 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), |
| 8850 grandchild->visible_rect_from_property_trees()); |
| 8851 } |
| 8852 |
8815 } // namespace | 8853 } // namespace |
8816 } // namespace cc | 8854 } // namespace cc |
OLD | NEW |