| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 6878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6889 EXPECT_VECTOR2DF_EQ(expected_scroller_screen_space_transform_translation, | 6889 EXPECT_VECTOR2DF_EQ(expected_scroller_screen_space_transform_translation, |
| 6890 scroller_impl->ScreenSpaceTransform().To2dTranslation()); | 6890 scroller_impl->ScreenSpaceTransform().To2dTranslation()); |
| 6891 | 6891 |
| 6892 gfx::Transform expected_scroll_child_screen_space_transform; | 6892 gfx::Transform expected_scroll_child_screen_space_transform; |
| 6893 expected_scroll_child_screen_space_transform.Translate(-5.3f, -9.3f); | 6893 expected_scroll_child_screen_space_transform.Translate(-5.3f, -9.3f); |
| 6894 expected_scroll_child_screen_space_transform.RotateAboutYAxis(30); | 6894 expected_scroll_child_screen_space_transform.RotateAboutYAxis(30); |
| 6895 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_scroll_child_screen_space_transform, | 6895 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_scroll_child_screen_space_transform, |
| 6896 scroll_child_impl->ScreenSpaceTransform()); | 6896 scroll_child_impl->ScreenSpaceTransform()); |
| 6897 } | 6897 } |
| 6898 | 6898 |
| 6899 TEST_F(LayerTreeHostCommonTest, NonFlatContainerForFixedPosLayer) { |
| 6900 scoped_refptr<Layer> root = Layer::Create(); |
| 6901 scoped_refptr<Layer> container = Layer::Create(); |
| 6902 scoped_refptr<Layer> scroller = Layer::Create(); |
| 6903 scoped_refptr<Layer> fixed_pos = Layer::Create(); |
| 6904 |
| 6905 scroller->SetIsContainerForFixedPositionLayers(true); |
| 6906 root->AddChild(container); |
| 6907 container->AddChild(scroller); |
| 6908 scroller->AddChild(fixed_pos); |
| 6909 host()->SetRootLayer(root); |
| 6910 |
| 6911 LayerPositionConstraint fixed_position; |
| 6912 fixed_position.set_is_fixed_position(true); |
| 6913 scroller->SetScrollClipLayerId(container->id()); |
| 6914 fixed_pos->SetPositionConstraint(fixed_position); |
| 6915 |
| 6916 root->SetBounds(gfx::Size(50, 50)); |
| 6917 container->SetBounds(gfx::Size(50, 50)); |
| 6918 scroller->SetBounds(gfx::Size(50, 50)); |
| 6919 fixed_pos->SetBounds(gfx::Size(50, 50)); |
| 6920 |
| 6921 gfx::Transform rotate; |
| 6922 rotate.RotateAboutXAxis(20); |
| 6923 container->SetTransform(rotate); |
| 6924 |
| 6925 ExecuteCalculateDrawProperties(root.get()); |
| 6926 TransformTree& tree = |
| 6927 root->layer_tree_host()->property_trees()->transform_tree; |
| 6928 gfx::Transform transform; |
| 6929 tree.ComputeTranslation(fixed_pos->transform_tree_index(), |
| 6930 container->transform_tree_index(), &transform); |
| 6931 EXPECT_TRUE(transform.IsIdentity()); |
| 6932 } |
| 6933 |
| 6899 TEST_F(LayerTreeHostCommonTest, ScrollSnappingWithFixedPosChild) { | 6934 TEST_F(LayerTreeHostCommonTest, ScrollSnappingWithFixedPosChild) { |
| 6900 // This test verifies that a fixed pos child of a scrolling layer doesn't get | 6935 // This test verifies that a fixed pos child of a scrolling layer doesn't get |
| 6901 // snapped to integer coordinates. | 6936 // snapped to integer coordinates. |
| 6902 // | 6937 // |
| 6903 // + root | 6938 // + root |
| 6904 // + container | 6939 // + container |
| 6905 // + scroller | 6940 // + scroller |
| 6906 // + fixed_pos | 6941 // + fixed_pos |
| 6907 // | 6942 // |
| 6908 scoped_refptr<Layer> root = Layer::Create(); | 6943 scoped_refptr<Layer> root = Layer::Create(); |
| (...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9712 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9747 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9713 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9748 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9714 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9749 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9715 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9750 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9716 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9751 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9717 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9752 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9718 } | 9753 } |
| 9719 | 9754 |
| 9720 } // namespace | 9755 } // namespace |
| 9721 } // namespace cc | 9756 } // namespace cc |
| OLD | NEW |