| 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 grand_child->SetDrawsContent(true); | 1117 grand_child->SetDrawsContent(true); |
| 1118 float device_scale_factor = 1.f; | 1118 float device_scale_factor = 1.f; |
| 1119 float page_scale_factor = 1.f; | 1119 float page_scale_factor = 1.f; |
| 1120 LayerImpl* page_scale_layer = nullptr; | 1120 LayerImpl* page_scale_layer = nullptr; |
| 1121 LayerImpl* inner_viewport_scroll_layer = nullptr; | 1121 LayerImpl* inner_viewport_scroll_layer = nullptr; |
| 1122 LayerImpl* outer_viewport_scroll_layer = nullptr; | 1122 LayerImpl* outer_viewport_scroll_layer = nullptr; |
| 1123 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, | 1123 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, |
| 1124 page_scale_layer, inner_viewport_scroll_layer, | 1124 page_scale_layer, inner_viewport_scroll_layer, |
| 1125 outer_viewport_scroll_layer); | 1125 outer_viewport_scroll_layer); |
| 1126 | 1126 |
| 1127 // Mapping grand_child's bounds to screen space produces an empty rect so | 1127 // Mapping grand_child's bounds to screen space produces an empty rect, but |
| 1128 // grand_child should be hidden. | 1128 // only because it is turned sideways. The entire rect is contained inside |
| 1129 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); | 1129 // the clip, and is only empty so long as the numerical precision of the |
| 1130 // transform is effectively perfect. Currently we do the calculation the |
| 1131 // other way around, and the Projection of the screen space clip into layer |
| 1132 // space includes the entire bounds. |
| 1133 EXPECT_EQ(gfx::Rect(grand_child->bounds()), |
| 1134 grand_child->visible_layer_rect()); |
| 1130 } | 1135 } |
| 1131 | 1136 |
| 1132 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { | 1137 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { |
| 1133 // A layer that is empty in one axis, but not the other, was accidentally | 1138 // A layer that is empty in one axis, but not the other, was accidentally |
| 1134 // skipping a necessary translation. Without that translation, the coordinate | 1139 // skipping a necessary translation. Without that translation, the coordinate |
| 1135 // space of the layer's draw transform is incorrect. | 1140 // space of the layer's draw transform is incorrect. |
| 1136 // | 1141 // |
| 1137 // Normally this isn't a problem, because the layer wouldn't be drawn anyway, | 1142 // Normally this isn't a problem, because the layer wouldn't be drawn anyway, |
| 1138 // but if that layer becomes a render surface, then its draw transform is | 1143 // but if that layer becomes a render surface, then its draw transform is |
| 1139 // implicitly inherited by the rest of the subtree, which then is positioned | 1144 // implicitly inherited by the rest of the subtree, which then is positioned |
| (...skipping 9666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10806 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10811 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10807 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10812 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10808 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10813 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10809 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10814 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10810 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10815 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10811 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10816 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10812 } | 10817 } |
| 10813 | 10818 |
| 10814 } // namespace | 10819 } // namespace |
| 10815 } // namespace cc | 10820 } // namespace cc |
| OLD | NEW |