Chromium Code Reviews| 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 8925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8936 | 8936 |
| 8937 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8937 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8938 host->SetRootLayer(root); | 8938 host->SetRootLayer(root); |
| 8939 | 8939 |
| 8940 ExecuteCalculateDrawProperties(root.get()); | 8940 ExecuteCalculateDrawProperties(root.get()); |
| 8941 | 8941 |
| 8942 gfx::Rect expected(0, 0, 100, 100); | 8942 gfx::Rect expected(0, 0, 100, 100); |
| 8943 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 8943 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 8944 } | 8944 } |
| 8945 | 8945 |
| 8946 TEST_F(LayerTreeHostCommonTest, | |
| 8947 PropertyTreesAccountForScrollCompensationAdjustment) { | |
| 8948 gfx::Transform identity; | |
| 8949 gfx::Transform translate_z; | |
| 8950 translate_z.Translate3d(0, 0, 10); | |
| 8951 | |
| 8952 scoped_refptr<Layer> root = Layer::Create(); | |
| 8953 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | |
| 8954 gfx::PointF(), gfx::Size(800, 800), true, false); | |
| 8955 root->SetIsContainerForFixedPositionLayers(true); | |
| 8956 | |
| 8957 scoped_refptr<Layer> frame_clip = Layer::Create(); | |
| 8958 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | |
| 8959 gfx::PointF(500, 100), gfx::Size(100, 100), true, | |
| 8960 false); | |
| 8961 frame_clip->SetMasksToBounds(true); | |
| 8962 | |
| 8963 scoped_refptr<LayerWithForcedDrawsContent> scroller = | |
| 8964 make_scoped_refptr(new LayerWithForcedDrawsContent()); | |
| 8965 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | |
| 8966 gfx::PointF(), gfx::Size(1000, 1000), true, | |
| 8967 false); | |
| 8968 | |
| 8969 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3, 0.7f)); | |
|
ajuma
2015/03/30 19:08:52
0.3f
Ian Vollick
2015/03/30 19:38:50
Done.
| |
| 8970 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); | |
| 8971 scroller->SetScrollClipLayerId(frame_clip->id()); | |
| 8972 | |
| 8973 scoped_refptr<LayerWithForcedDrawsContent> fixed = | |
| 8974 make_scoped_refptr(new LayerWithForcedDrawsContent()); | |
| 8975 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | |
| 8976 gfx::PointF(), gfx::Size(50, 50), true, false); | |
| 8977 | |
| 8978 LayerPositionConstraint constraint; | |
| 8979 constraint.set_is_fixed_position(true); | |
| 8980 fixed->SetPositionConstraint(constraint); | |
| 8981 | |
| 8982 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = | |
| 8983 make_scoped_refptr(new LayerWithForcedDrawsContent()); | |
| 8984 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), | |
| 8985 gfx::PointF(), gfx::Size(10, 10), true, false); | |
| 8986 | |
| 8987 fixed_child->SetPositionConstraint(constraint); | |
| 8988 | |
| 8989 root->AddChild(frame_clip); | |
| 8990 frame_clip->AddChild(scroller); | |
| 8991 scroller->AddChild(fixed); | |
| 8992 fixed->AddChild(fixed_child); | |
| 8993 | |
| 8994 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | |
| 8995 host->SetRootLayer(root); | |
| 8996 | |
| 8997 ExecuteCalculateDrawProperties(root.get()); | |
| 8998 | |
| 8999 gfx::Rect expected(0, 0, 50, 50); | |
| 9000 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | |
| 9001 | |
| 9002 expected = gfx::Rect(0, 0, 10, 10); | |
| 9003 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); | |
| 9004 } | |
| 9005 | |
| 8946 } // namespace | 9006 } // namespace |
| 8947 } // namespace cc | 9007 } // namespace cc |
| OLD | NEW |