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 9332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9343 | 9343 |
9344 node = tree.Node(between_targets->transform_tree_index()); | 9344 node = tree.Node(between_targets->transform_tree_index()); |
9345 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); | 9345 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); |
9346 | 9346 |
9347 node = tree.Node(render_surface2->transform_tree_index()); | 9347 node = tree.Node(render_surface2->transform_tree_index()); |
9348 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); | 9348 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); |
9349 | 9349 |
9350 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); | 9350 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); |
9351 } | 9351 } |
9352 | 9352 |
9353 TEST_F(LayerTreeHostCommonTest, NoisyTransform) { | |
Alexander Potapenko
2016/08/25 09:43:28
Did you intend to submit this test as well?
jaydasika
2016/08/26 17:39:31
Yes. To ensure that no one adds back the DCHECK th
| |
9354 LayerImpl* root = root_layer_for_testing(); | |
9355 LayerImpl* render_surface = AddChild<LayerImpl>(root); | |
9356 LayerImpl* scroll_child = AddChild<LayerImpl>(render_surface); | |
9357 LayerImpl* scroll_clip = AddChild<LayerImpl>(render_surface); | |
9358 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_clip); | |
9359 | |
9360 scroll_child->test_properties()->scroll_parent = scroll_parent; | |
9361 scroll_parent->test_properties()->scroll_children = | |
9362 base::MakeUnique<std::set<LayerImpl*>>(); | |
9363 scroll_parent->test_properties()->scroll_children->insert(scroll_child); | |
9364 scroll_parent->SetScrollClipLayer(scroll_clip->id()); | |
9365 | |
9366 scroll_parent->SetDrawsContent(true); | |
9367 scroll_child->SetDrawsContent(true); | |
9368 render_surface->test_properties()->force_render_surface = true; | |
9369 | |
9370 // A noisy transform that's invertible. | |
9371 gfx::Transform transform; | |
9372 transform.matrix().setDouble(0, 0, 6.12323e-17); | |
9373 transform.matrix().setDouble(0, 2, 1); | |
9374 transform.matrix().setDouble(2, 2, 6.12323e-17); | |
9375 transform.matrix().setDouble(2, 0, -1); | |
9376 | |
9377 scroll_child->test_properties()->transform = transform; | |
9378 render_surface->test_properties()->transform = transform; | |
9379 | |
9380 root->SetBounds(gfx::Size(30, 30)); | |
9381 scroll_child->SetBounds(gfx::Size(30, 30)); | |
9382 scroll_parent->SetBounds(gfx::Size(30, 30)); | |
9383 ExecuteCalculateDrawProperties(root); | |
9384 | |
9385 gfx::Transform expected; | |
9386 expected.matrix().setDouble(0, 0, 3.749395e-33); | |
9387 expected.matrix().setDouble(0, 2, 6.12323e-17); | |
9388 expected.matrix().setDouble(2, 0, -1); | |
9389 expected.matrix().setDouble(2, 2, 6.12323e-17); | |
9390 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, | |
9391 scroll_child->ScreenSpaceTransform()); | |
9392 } | |
9393 | |
9353 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { | 9394 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { |
9354 LayerImpl* root = root_layer_for_testing(); | 9395 LayerImpl* root = root_layer_for_testing(); |
9355 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); | 9396 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); |
9356 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 9397 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
9357 | 9398 |
9358 child->SetDrawsContent(true); | 9399 child->SetDrawsContent(true); |
9359 child->SetMasksToBounds(true); | 9400 child->SetMasksToBounds(true); |
9360 | 9401 |
9361 gfx::Transform large_transform; | 9402 gfx::Transform large_transform; |
9362 large_transform.Scale(99999999999999999999.f, 99999999999999999999.f); | 9403 large_transform.Scale(99999999999999999999.f, 99999999999999999999.f); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9768 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9809 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
9769 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9810 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
9770 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9811 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
9771 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9812 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
9772 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9813 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
9773 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9814 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
9774 } | 9815 } |
9775 | 9816 |
9776 } // namespace | 9817 } // namespace |
9777 } // namespace cc | 9818 } // namespace cc |
OLD | NEW |