Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: cc/layers/layer_position_constraint_unittest.cc

Issue 332873005: Rendering context information added to SharedQuadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed RenderingContextId to 3dSortingContextId for clarity. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/layer_position_constraint.h" 5 #include "cc/layers/layer_position_constraint.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/geometry_test_utils.h" 12 #include "cc/test/geometry_test_utils.h"
13 #include "cc/test/test_shared_bitmap_manager.h" 13 #include "cc/test/test_shared_bitmap_manager.h"
14 #include "cc/trees/layer_tree_host_common.h" 14 #include "cc/trees/layer_tree_host_common.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace cc { 17 namespace cc {
18 namespace { 18 namespace {
19 19
20 void SetLayerPropertiesForTesting(LayerImpl* layer, 20 void SetLayerPropertiesForTesting(LayerImpl* layer,
21 const gfx::Transform& transform, 21 const gfx::Transform& transform,
22 const gfx::Point3F& transform_origin, 22 const gfx::Point3F& transform_origin,
23 const gfx::PointF& position, 23 const gfx::PointF& position,
24 const gfx::Size& bounds, 24 const gfx::Size& bounds,
25 bool flatten_transform, 25 bool flatten_transform) {
26 bool is_3d_sorted) {
27 layer->SetTransform(transform); 26 layer->SetTransform(transform);
28 layer->SetTransformOrigin(transform_origin); 27 layer->SetTransformOrigin(transform_origin);
29 layer->SetPosition(position); 28 layer->SetPosition(position);
30 layer->SetBounds(bounds); 29 layer->SetBounds(bounds);
31 layer->SetShouldFlattenTransform(flatten_transform); 30 layer->SetShouldFlattenTransform(flatten_transform);
32 layer->SetIs3dSorted(is_3d_sorted);
33 layer->SetContentBounds(bounds); 31 layer->SetContentBounds(bounds);
34 } 32 }
35 33
36 void ExecuteCalculateDrawProperties(LayerImpl* root_layer, 34 void ExecuteCalculateDrawProperties(LayerImpl* root_layer,
37 float device_scale_factor, 35 float device_scale_factor,
38 float page_scale_factor, 36 float page_scale_factor,
39 LayerImpl* page_scale_application_layer, 37 LayerImpl* page_scale_application_layer,
40 bool can_use_lcd_text) { 38 bool can_use_lcd_text) {
41 gfx::Transform identity_matrix; 39 gfx::Transform identity_matrix;
42 std::vector<LayerImpl*> dummy_render_surface_layer_list; 40 std::vector<LayerImpl*> dummy_render_surface_layer_list;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 gfx::Transform IdentityMatrix; 87 gfx::Transform IdentityMatrix;
90 gfx::Point3F transform_origin; 88 gfx::Point3F transform_origin;
91 gfx::PointF position; 89 gfx::PointF position;
92 gfx::Size bounds(200, 200); 90 gfx::Size bounds(200, 200);
93 gfx::Size clip_bounds(100, 100); 91 gfx::Size clip_bounds(100, 100);
94 SetLayerPropertiesForTesting(scroll_layer.get(), 92 SetLayerPropertiesForTesting(scroll_layer.get(),
95 IdentityMatrix, 93 IdentityMatrix,
96 transform_origin, 94 transform_origin,
97 position, 95 position,
98 bounds, 96 bounds,
99 true, 97 true);
100 false); 98 SetLayerPropertiesForTesting(
101 SetLayerPropertiesForTesting(child.get(), 99 child.get(), IdentityMatrix, transform_origin, position, bounds, true);
102 IdentityMatrix,
103 transform_origin,
104 position,
105 bounds,
106 true,
107 false);
108 SetLayerPropertiesForTesting(grand_child.get(), 100 SetLayerPropertiesForTesting(grand_child.get(),
109 IdentityMatrix, 101 IdentityMatrix,
110 transform_origin, 102 transform_origin,
111 position, 103 position,
112 bounds, 104 bounds,
113 true, 105 true);
114 false);
115 SetLayerPropertiesForTesting(great_grand_child.get(), 106 SetLayerPropertiesForTesting(great_grand_child.get(),
116 IdentityMatrix, 107 IdentityMatrix,
117 transform_origin, 108 transform_origin,
118 position, 109 position,
119 bounds, 110 bounds,
120 true, 111 true);
121 false);
122 112
123 root->SetBounds(clip_bounds); 113 root->SetBounds(clip_bounds);
124 scroll_layer->SetScrollClipLayer(root->id()); 114 scroll_layer->SetScrollClipLayer(root->id());
125 child->SetScrollClipLayer(root->id()); 115 child->SetScrollClipLayer(root->id());
126 grand_child->SetScrollClipLayer(root->id()); 116 grand_child->SetScrollClipLayer(root->id());
127 117
128 grand_child->AddChild(great_grand_child.Pass()); 118 grand_child->AddChild(great_grand_child.Pass());
129 child->AddChild(grand_child.Pass()); 119 child->AddChild(grand_child.Pass());
130 scroll_layer->AddChild(child.Pass()); 120 scroll_layer->AddChild(child.Pass());
131 root->AddChild(scroll_layer.Pass()); 121 root->AddChild(scroll_layer.Pass());
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // Add one more layer to the test tree for this scenario. 727 // Add one more layer to the test tree for this scenario.
738 { 728 {
739 gfx::Transform identity; 729 gfx::Transform identity;
740 scoped_ptr<LayerImpl> fixed_position_child = 730 scoped_ptr<LayerImpl> fixed_position_child =
741 LayerImpl::Create(host_impl_.active_tree(), 5); 731 LayerImpl::Create(host_impl_.active_tree(), 5);
742 SetLayerPropertiesForTesting(fixed_position_child.get(), 732 SetLayerPropertiesForTesting(fixed_position_child.get(),
743 identity, 733 identity,
744 gfx::Point3F(), 734 gfx::Point3F(),
745 gfx::PointF(), 735 gfx::PointF(),
746 gfx::Size(100, 100), 736 gfx::Size(100, 100),
747 true, 737 true);
748 false);
749 great_grand_child->AddChild(fixed_position_child.Pass()); 738 great_grand_child->AddChild(fixed_position_child.Pass());
750 } 739 }
751 LayerImpl* fixed_position_child = great_grand_child->children()[0]; 740 LayerImpl* fixed_position_child = great_grand_child->children()[0];
752 741
753 // Actually set up the scenario here. 742 // Actually set up the scenario here.
754 child->SetIsContainerForFixedPositionLayers(true); 743 child->SetIsContainerForFixedPositionLayers(true);
755 grand_child->SetPosition(gfx::PointF(8.f, 6.f)); 744 grand_child->SetPosition(gfx::PointF(8.f, 6.f));
756 grand_child->SetForceRenderSurface(true); 745 grand_child->SetForceRenderSurface(true);
757 great_grand_child->SetPosition(gfx::PointF(40.f, 60.f)); 746 great_grand_child->SetPosition(gfx::PointF(40.f, 60.f));
758 great_grand_child->SetForceRenderSurface(true); 747 great_grand_child->SetForceRenderSurface(true);
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 fixed_to_container1->draw_transform()); 1152 fixed_to_container1->draw_transform());
1164 1153
1165 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, 1154 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform,
1166 container2->draw_transform()); 1155 container2->draw_transform());
1167 1156
1168 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, 1157 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform,
1169 fixed_to_container2->draw_transform()); 1158 fixed_to_container2->draw_transform());
1170 } 1159 }
1171 } // namespace 1160 } // namespace
1172 } // namespace cc 1161 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698