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.0, -0.5f)); | |
|
ajuma
2015/03/26 18:03:25
Does blink usually send negative values for scroll
Ian Vollick
2015/03/30 17:51:25
You're right, this is wrong. Blink sends the fract
| |
| 8970 scroller->SetScrollOffset(gfx::ScrollOffset(0.0, 0.5)); | |
| 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 root->AddChild(frame_clip); | |
| 8983 frame_clip->AddChild(scroller); | |
| 8984 scroller->AddChild(fixed); | |
| 8985 | |
| 8986 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | |
| 8987 host->SetRootLayer(root); | |
| 8988 | |
| 8989 ExecuteCalculateDrawProperties(root.get()); | |
| 8990 | |
| 8991 gfx::Rect expected(0, 1, 50, 49); | |
| 8992 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | |
| 8993 } | |
| 8994 | |
| 8946 } // namespace | 8995 } // namespace |
| 8947 } // namespace cc | 8996 } // namespace cc |
| OLD | NEW |