| 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 8836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8847 rotated->AddChild(surface); | 8847 rotated->AddChild(surface); |
| 8848 surface->AddChild(container); | 8848 surface->AddChild(container); |
| 8849 surface->AddChild(box); | 8849 surface->AddChild(box); |
| 8850 | 8850 |
| 8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8852 host->SetRootLayer(root); | 8852 host->SetRootLayer(root); |
| 8853 | 8853 |
| 8854 ExecuteCalculateDrawProperties(root.get()); | 8854 ExecuteCalculateDrawProperties(root.get()); |
| 8855 } | 8855 } |
| 8856 | 8856 |
| 8857 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| 8858 gfx::Transform identity; |
| 8859 gfx::Transform translate_z; |
| 8860 translate_z.Translate3d(0, 0, 10); |
| 8861 |
| 8862 scoped_refptr<Layer> root = Layer::Create(); |
| 8863 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8864 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8865 root->SetIsContainerForFixedPositionLayers(true); |
| 8866 |
| 8867 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8868 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 8869 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8870 false); |
| 8871 frame_clip->SetMasksToBounds(true); |
| 8872 |
| 8873 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8874 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8875 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8876 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8877 false); |
| 8878 |
| 8879 LayerPositionConstraint constraint; |
| 8880 constraint.set_is_fixed_position(true); |
| 8881 fixed->SetPositionConstraint(constraint); |
| 8882 |
| 8883 root->AddChild(frame_clip); |
| 8884 frame_clip->AddChild(fixed); |
| 8885 |
| 8886 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8887 host->SetRootLayer(root); |
| 8888 |
| 8889 ExecuteCalculateDrawProperties(root.get()); |
| 8890 |
| 8891 gfx::Rect expected(0, 0, 100, 100); |
| 8892 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 8893 } |
| 8894 |
| 8857 } // namespace | 8895 } // namespace |
| 8858 } // namespace cc | 8896 } // namespace cc |
| OLD | NEW |