| 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/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "cc/test/fake_content_layer_client.h" | 24 #include "cc/test/fake_content_layer_client.h" |
| 25 #include "cc/test/fake_impl_proxy.h" | 25 #include "cc/test/fake_impl_proxy.h" |
| 26 #include "cc/test/fake_layer_tree_host.h" | 26 #include "cc/test/fake_layer_tree_host.h" |
| 27 #include "cc/test/fake_layer_tree_host_impl.h" | 27 #include "cc/test/fake_layer_tree_host_impl.h" |
| 28 #include "cc/test/fake_output_surface.h" | 28 #include "cc/test/fake_output_surface.h" |
| 29 #include "cc/test/fake_picture_layer.h" | 29 #include "cc/test/fake_picture_layer.h" |
| 30 #include "cc/test/fake_picture_layer_impl.h" | 30 #include "cc/test/fake_picture_layer_impl.h" |
| 31 #include "cc/test/geometry_test_utils.h" | 31 #include "cc/test/geometry_test_utils.h" |
| 32 #include "cc/test/layer_tree_host_common_test.h" | 32 #include "cc/test/layer_tree_host_common_test.h" |
| 33 #include "cc/test/test_task_graph_runner.h" | 33 #include "cc/test/test_task_graph_runner.h" |
| 34 #include "cc/trees/draw_property_utils.h" |
| 34 #include "cc/trees/layer_tree_impl.h" | 35 #include "cc/trees/layer_tree_impl.h" |
| 35 #include "cc/trees/proxy.h" | 36 #include "cc/trees/proxy.h" |
| 36 #include "cc/trees/single_thread_proxy.h" | 37 #include "cc/trees/single_thread_proxy.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 38 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "ui/gfx/geometry/quad_f.h" | 40 #include "ui/gfx/geometry/quad_f.h" |
| 40 #include "ui/gfx/geometry/vector2d_conversions.h" | 41 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 41 #include "ui/gfx/transform.h" | 42 #include "ui/gfx/transform.h" |
| 42 | 43 |
| 43 namespace cc { | 44 namespace cc { |
| (...skipping 5676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5720 gfx::PointF(10.f, 15.f), gfx::Size(50, 50), true, | 5721 gfx::PointF(10.f, 15.f), gfx::Size(50, 50), true, |
| 5721 false); | 5722 false); |
| 5722 SetLayerPropertiesForTesting(child.get(), gfx::Transform(), gfx::Point3F(), | 5723 SetLayerPropertiesForTesting(child.get(), gfx::Transform(), gfx::Point3F(), |
| 5723 gfx::PointF(1.f, 2.f), gfx::Size(50, 50), true, | 5724 gfx::PointF(1.f, 2.f), gfx::Size(50, 50), true, |
| 5724 false); | 5725 false); |
| 5725 | 5726 |
| 5726 host()->SetRootLayer(root); | 5727 host()->SetRootLayer(root); |
| 5727 | 5728 |
| 5728 ExecuteCalculateDrawProperties(root.get()); | 5729 ExecuteCalculateDrawProperties(root.get()); |
| 5729 | 5730 |
| 5731 TransformTree& tree = host()->property_trees()->transform_tree; |
| 5732 |
| 5730 gfx::Transform expected_fixed_draw_transform; | 5733 gfx::Transform expected_fixed_draw_transform; |
| 5731 expected_fixed_draw_transform.Translate(10.f, 15.f); | 5734 expected_fixed_draw_transform.Translate(10.f, 15.f); |
| 5732 EXPECT_EQ(expected_fixed_draw_transform, fixed->draw_transform()); | 5735 EXPECT_EQ(expected_fixed_draw_transform, |
| 5736 DrawTransformFromPropertyTrees(fixed.get(), tree)); |
| 5733 | 5737 |
| 5734 gfx::Transform expected_fixed_screen_space_transform; | 5738 gfx::Transform expected_fixed_screen_space_transform; |
| 5735 expected_fixed_screen_space_transform.Translate(17.f, 24.f); | 5739 expected_fixed_screen_space_transform.Translate(17.f, 24.f); |
| 5736 EXPECT_EQ(expected_fixed_screen_space_transform, | 5740 EXPECT_EQ(expected_fixed_screen_space_transform, |
| 5737 fixed->screen_space_transform()); | 5741 ScreenSpaceTransformFromPropertyTrees(fixed.get(), tree)); |
| 5738 | 5742 |
| 5739 gfx::Transform expected_child_draw_transform; | 5743 gfx::Transform expected_child_draw_transform; |
| 5740 expected_child_draw_transform.Translate(11.f, 17.f); | 5744 expected_child_draw_transform.Translate(11.f, 17.f); |
| 5741 EXPECT_EQ(expected_child_draw_transform, child->draw_transform()); | 5745 EXPECT_EQ(expected_child_draw_transform, |
| 5746 DrawTransformFromPropertyTrees(child.get(), tree)); |
| 5742 | 5747 |
| 5743 gfx::Transform expected_child_screen_space_transform; | 5748 gfx::Transform expected_child_screen_space_transform; |
| 5744 expected_child_screen_space_transform.Translate(18.f, 26.f); | 5749 expected_child_screen_space_transform.Translate(18.f, 26.f); |
| 5745 EXPECT_EQ(expected_child_screen_space_transform, | 5750 EXPECT_EQ(expected_child_screen_space_transform, |
| 5746 child->screen_space_transform()); | 5751 ScreenSpaceTransformFromPropertyTrees(child.get(), tree)); |
| 5747 } | 5752 } |
| 5748 | 5753 |
| 5749 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { | 5754 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
| 5750 // This test verifies that a scrolling layer that gets snapped to | 5755 // This test verifies that a scrolling layer that gets snapped to |
| 5751 // integer coordinates doesn't move a fixed position child. | 5756 // integer coordinates doesn't move a fixed position child. |
| 5752 // | 5757 // |
| 5753 // + root | 5758 // + root |
| 5754 // + container | 5759 // + container |
| 5755 // + scroller | 5760 // + scroller |
| 5756 // + fixed | 5761 // + fixed |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7902 gfx::PointF(), gfx::Size(30, 30), true, false, | 7907 gfx::PointF(), gfx::Size(30, 30), true, false, |
| 7903 false); | 7908 false); |
| 7904 | 7909 |
| 7905 ExecuteCalculateDrawProperties(root); | 7910 ExecuteCalculateDrawProperties(root); |
| 7906 | 7911 |
| 7907 EXPECT_EQ(test_layer->clip_rect(), gfx::RectF(-4, -4, 30, 30)); | 7912 EXPECT_EQ(test_layer->clip_rect(), gfx::RectF(-4, -4, 30, 30)); |
| 7908 } | 7913 } |
| 7909 | 7914 |
| 7910 } // namespace | 7915 } // namespace |
| 7911 } // namespace cc | 7916 } // namespace cc |
| OLD | NEW |