| 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 <set> | 10 #include <set> |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), | 1339 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
| 1340 gfx::PointF(), gfx::Size(10, 10), true, false, | 1340 gfx::PointF(), gfx::Size(10, 10), true, false, |
| 1341 false); | 1341 false); |
| 1342 render_surface1->SetOpacity(0.f); | 1342 render_surface1->SetOpacity(0.f); |
| 1343 render_surface1->SetDrawsContent(true); | 1343 render_surface1->SetDrawsContent(true); |
| 1344 child->SetDrawsContent(true); | 1344 child->SetDrawsContent(true); |
| 1345 FilterOperations filters; | 1345 FilterOperations filters; |
| 1346 filters.Append(FilterOperation::CreateBlurFilter(1.5f)); | 1346 filters.Append(FilterOperation::CreateBlurFilter(1.5f)); |
| 1347 render_surface1->SetBackgroundFilters(filters); | 1347 render_surface1->SetBackgroundFilters(filters); |
| 1348 | 1348 |
| 1349 LayerImplList render_surface_layer_list; | 1349 { |
| 1350 parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 1350 LayerImplList render_surface_layer_list; |
| 1351 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 1351 parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 1352 parent, parent->bounds(), &render_surface_layer_list, | 1352 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 1353 parent->layer_tree_impl()->current_render_surface_list_id()); | 1353 parent, parent->bounds(), &render_surface_layer_list, |
| 1354 inputs.can_adjust_raster_scales = true; | 1354 parent->layer_tree_impl()->current_render_surface_list_id()); |
| 1355 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1355 inputs.can_adjust_raster_scales = true; |
| 1356 | 1356 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1357 EXPECT_EQ(2U, render_surface_layer_list.size()); |
| 1358 } |
| 1357 // The layer is fully transparent, but has a background filter, so it | 1359 // The layer is fully transparent, but has a background filter, so it |
| 1358 // shouldn't be skipped. | 1360 // shouldn't be skipped and should be drawn. |
| 1359 ASSERT_TRUE(parent->render_surface()); | 1361 ASSERT_TRUE(parent->render_surface()); |
| 1360 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); | 1362 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); |
| 1361 EXPECT_EQ(2U, render_surface_layer_list.size()); | |
| 1362 EXPECT_EQ(gfx::RectF(0, 0, 10, 10), | 1363 EXPECT_EQ(gfx::RectF(0, 0, 10, 10), |
| 1363 parent->render_surface()->DrawableContentRect()); | 1364 parent->render_surface()->DrawableContentRect()); |
| 1365 EffectTree& effect_tree = |
| 1366 parent->layer_tree_impl()->property_trees()->effect_tree; |
| 1367 EffectNode* node = effect_tree.Node(render_surface1->effect_tree_index()); |
| 1368 EXPECT_TRUE(node->data.is_drawn); |
| 1369 |
| 1370 // When parent is transparent, the layer should not be drawn. |
| 1371 parent->OnOpacityAnimated(0.f); |
| 1372 render_surface1->OnOpacityAnimated(1.f); |
| 1373 { |
| 1374 LayerImplList render_surface_layer_list; |
| 1375 parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 1376 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 1377 parent, parent->bounds(), &render_surface_layer_list, |
| 1378 parent->layer_tree_impl()->current_render_surface_list_id()); |
| 1379 inputs.can_adjust_raster_scales = true; |
| 1380 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1381 } |
| 1382 |
| 1383 node = effect_tree.Node(render_surface1->effect_tree_index()); |
| 1384 EXPECT_FALSE(node->data.is_drawn); |
| 1364 } | 1385 } |
| 1365 | 1386 |
| 1366 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) { | 1387 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) { |
| 1367 LayerImpl* root = root_layer(); | 1388 LayerImpl* root = root_layer(); |
| 1368 LayerImpl* parent = AddChild<LayerImpl>(root); | 1389 LayerImpl* parent = AddChild<LayerImpl>(root); |
| 1369 LayerImpl* child1 = AddChild<LayerImpl>(parent); | 1390 LayerImpl* child1 = AddChild<LayerImpl>(parent); |
| 1370 LayerImpl* child2 = AddChild<LayerImpl>(parent); | 1391 LayerImpl* child2 = AddChild<LayerImpl>(parent); |
| 1371 child1->SetDrawsContent(true); | 1392 child1->SetDrawsContent(true); |
| 1372 child2->SetDrawsContent(true); | 1393 child2->SetDrawsContent(true); |
| 1373 | 1394 |
| (...skipping 8634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10008 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10029 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10009 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10030 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10010 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10031 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10011 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10032 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10012 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10033 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10013 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10034 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10014 } | 10035 } |
| 10015 | 10036 |
| 10016 } // namespace | 10037 } // namespace |
| 10017 } // namespace cc | 10038 } // namespace cc |
| OLD | NEW |