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 8464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8475 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect_for_testing()); | 8475 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect_for_testing()); |
8476 | 8476 |
8477 // This time, flattening does not make |animated|'s transform invertible. This | 8477 // This time, flattening does not make |animated|'s transform invertible. This |
8478 // means the clip cannot be projected into |surface|'s space, so we treat | 8478 // means the clip cannot be projected into |surface|'s space, so we treat |
8479 // |surface| and layers that draw into it as having empty visible rect. | 8479 // |surface| and layers that draw into it as having empty visible rect. |
8480 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect_for_testing()); | 8480 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect_for_testing()); |
8481 EXPECT_EQ(gfx::Rect(), | 8481 EXPECT_EQ(gfx::Rect(), |
8482 descendant_of_animation->visible_layer_rect_for_testing()); | 8482 descendant_of_animation->visible_layer_rect_for_testing()); |
8483 } | 8483 } |
8484 | 8484 |
| 8485 // Verify that having animated opacity but current opacity 1 still creates |
| 8486 // a render surface. |
| 8487 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { |
| 8488 LayerImpl* root = root_layer_for_testing(); |
| 8489 LayerImpl* child = AddChild<LayerImpl>(root); |
| 8490 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
| 8491 child->SetDrawsContent(true); |
| 8492 grandchild->SetDrawsContent(true); |
| 8493 |
| 8494 gfx::Transform identity_transform; |
| 8495 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
| 8496 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8497 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), |
| 8498 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8499 SetLayerPropertiesForTesting(grandchild, identity_transform, gfx::Point3F(), |
| 8500 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8501 |
| 8502 SetElementIdsForTesting(); |
| 8503 AddOpacityTransitionToElementWithPlayer(child->element_id(), timeline_impl(), |
| 8504 10.0, 1.f, 0.2f, false); |
| 8505 ExecuteCalculateDrawProperties(root); |
| 8506 |
| 8507 EXPECT_EQ(1.f, child->Opacity()); |
| 8508 EXPECT_TRUE(root->has_render_surface()); |
| 8509 EXPECT_TRUE(child->has_render_surface()); |
| 8510 EXPECT_FALSE(grandchild->has_render_surface()); |
| 8511 } |
| 8512 |
8485 // Verify that having an animated filter (but no current filter, as these | 8513 // Verify that having an animated filter (but no current filter, as these |
8486 // are mutually exclusive) correctly creates a render surface. | 8514 // are mutually exclusive) correctly creates a render surface. |
8487 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { | 8515 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
8488 LayerImpl* root = root_layer_for_testing(); | 8516 LayerImpl* root = root_layer_for_testing(); |
8489 LayerImpl* child = AddChild<LayerImpl>(root); | 8517 LayerImpl* child = AddChild<LayerImpl>(root); |
8490 LayerImpl* grandchild = AddChild<LayerImpl>(child); | 8518 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
8491 | 8519 |
8492 gfx::Transform identity_transform; | 8520 gfx::Transform identity_transform; |
8493 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), | 8521 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
8494 gfx::PointF(), gfx::Size(50, 50), true, false); | 8522 gfx::PointF(), gfx::Size(50, 50), true, false); |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10521 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10549 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10522 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10550 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10523 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10551 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10524 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10552 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10525 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10553 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10526 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10554 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10527 } | 10555 } |
10528 | 10556 |
10529 } // namespace | 10557 } // namespace |
10530 } // namespace cc | 10558 } // namespace cc |
OLD | NEW |