| 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 6284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6295 | 6295 |
| 6296 EXPECT_EQ(scroll_child->effect_tree_index(), | 6296 EXPECT_EQ(scroll_child->effect_tree_index(), |
| 6297 scroll_child_target->effect_tree_index()); | 6297 scroll_child_target->effect_tree_index()); |
| 6298 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40)); | 6298 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40)); |
| 6299 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75)); | 6299 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75)); |
| 6300 gfx::Transform scale; | 6300 gfx::Transform scale; |
| 6301 scale.Scale(1.5f, 1.5f); | 6301 scale.Scale(1.5f, 1.5f); |
| 6302 EXPECT_TRANSFORMATION_MATRIX_EQ(scroll_child->DrawTransform(), scale); | 6302 EXPECT_TRANSFORMATION_MATRIX_EQ(scroll_child->DrawTransform(), scale); |
| 6303 } | 6303 } |
| 6304 | 6304 |
| 6305 TEST_F(LayerTreeHostCommonTest, TargetBetweenScrollChildandScrollParentTarget) { |
| 6306 LayerImpl* root = root_layer_for_testing(); |
| 6307 LayerImpl* scroll_child_target = AddChildToRoot<LayerImpl>(); |
| 6308 LayerImpl* scroll_child = AddChild<LayerImpl>(scroll_child_target); |
| 6309 LayerImpl* child_of_scroll_child = AddChild<LayerImpl>(scroll_child); |
| 6310 LayerImpl* intervening_target = AddChild<LayerImpl>(scroll_child_target); |
| 6311 LayerImpl* clip = AddChild<LayerImpl>(intervening_target); |
| 6312 LayerImpl* scroll_parent_target = AddChild<LayerImpl>(clip); |
| 6313 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_target); |
| 6314 |
| 6315 scroll_parent->SetDrawsContent(true); |
| 6316 child_of_scroll_child->SetDrawsContent(true); |
| 6317 |
| 6318 scroll_child->test_properties()->scroll_parent = scroll_parent; |
| 6319 scroll_parent->test_properties()->scroll_children = |
| 6320 base::MakeUnique<std::set<LayerImpl*>>(); |
| 6321 scroll_parent->test_properties()->scroll_children->insert(scroll_child); |
| 6322 |
| 6323 root->SetBounds(gfx::Size(50, 50)); |
| 6324 scroll_child_target->SetBounds(gfx::Size(50, 50)); |
| 6325 scroll_child_target->SetMasksToBounds(true); |
| 6326 scroll_child_target->test_properties()->force_render_surface = true; |
| 6327 scroll_child->SetBounds(gfx::Size(50, 50)); |
| 6328 child_of_scroll_child->SetBounds(gfx::Size(50, 50)); |
| 6329 child_of_scroll_child->test_properties()->force_render_surface = true; |
| 6330 intervening_target->SetBounds(gfx::Size(50, 50)); |
| 6331 intervening_target->test_properties()->force_render_surface = true; |
| 6332 clip->SetBounds(gfx::Size(50, 50)); |
| 6333 clip->SetMasksToBounds(true); |
| 6334 scroll_parent_target->SetBounds(gfx::Size(50, 50)); |
| 6335 scroll_parent_target->SetMasksToBounds(true); |
| 6336 scroll_parent_target->test_properties()->force_render_surface = true; |
| 6337 scroll_parent->SetBounds(gfx::Size(50, 50)); |
| 6338 |
| 6339 ExecuteCalculateDrawProperties(root); |
| 6340 PropertyTrees* property_trees = root->layer_tree_impl()->property_trees(); |
| 6341 ClipNode* clip_node = |
| 6342 property_trees->clip_tree.Node(child_of_scroll_child->clip_tree_index()); |
| 6343 ClipNode* parent_clip_node = property_trees->clip_tree.parent(clip_node); |
| 6344 DCHECK_GT(parent_clip_node->target_transform_id, |
| 6345 property_trees->transform_tree.TargetId( |
| 6346 child_of_scroll_child->transform_tree_index())); |
| 6347 } |
| 6348 |
| 6305 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { | 6349 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
| 6306 LayerImpl* root = root_layer_for_testing(); | 6350 LayerImpl* root = root_layer_for_testing(); |
| 6307 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 6351 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 6308 LayerImpl* child = AddChild<LayerImpl>(parent); | 6352 LayerImpl* child = AddChild<LayerImpl>(parent); |
| 6309 | 6353 |
| 6310 root->SetBounds(gfx::Size(50, 50)); | 6354 root->SetBounds(gfx::Size(50, 50)); |
| 6311 root->SetDrawsContent(true); | 6355 root->SetDrawsContent(true); |
| 6312 root->Set3dSortingContextId(1); | 6356 root->Set3dSortingContextId(1); |
| 6313 parent->SetBounds(gfx::Size(30, 30)); | 6357 parent->SetBounds(gfx::Size(30, 30)); |
| 6314 parent->SetDrawsContent(true); | 6358 parent->SetDrawsContent(true); |
| (...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10534 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10578 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10535 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10579 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10536 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10580 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10537 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10581 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10538 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10582 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10539 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10583 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10540 } | 10584 } |
| 10541 | 10585 |
| 10542 } // namespace | 10586 } // namespace |
| 10543 } // namespace cc | 10587 } // namespace cc |
| OLD | NEW |