Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1025)

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2894953003: Revert of cc : Don't draw animating layers which are transparent but raster them. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index c03d85566f2b142c7f69f91b3f009d2921255a75..17ffe917d699b37341a0b27fba3a2afe6bab90e4 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -4426,13 +4426,13 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
- // We should have one render surface and one layer. The child
- // layer should not be included as its transparent.
+ // We should have one render surface and two layers. The child
+ // layer should be included even though it is transparent.
ASSERT_EQ(1u, render_surface_list.size());
- ASSERT_EQ(1, GetRenderSurface(root_layer)->num_contributors());
+ ASSERT_EQ(2, GetRenderSurface(root_layer)->num_contributors());
- // If the root itself is hidden, the child should not be drawn and should not
- // raster even if it has an animating opacity.
+ // If the root itself is hidden, the child should not be drawn even if it has
+ // an animating opacity.
root_layer->test_properties()->opacity = 0.0f;
root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
RenderSurfaceList render_surface_list2;
@@ -4442,11 +4442,13 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs2);
LayerImpl* child_ptr = root_layer->layer_tree_impl()->LayerById(2);
- EXPECT_FALSE(child_ptr->contributes_to_drawn_render_surface());
- EXPECT_FALSE(child_ptr->raster_even_if_not_in_rsll());
+ EffectTree& tree =
+ root_layer->layer_tree_impl()->property_trees()->effect_tree;
+ EffectNode* node = tree.Node(child_ptr->effect_tree_index());
+ EXPECT_FALSE(node->is_drawn);
- // The child layer should not be drawn as its transparent but should raster
- // as its opacity is animating.
+ // A layer should be drawn and it should contribute to drawn surface when
+ // it has animating opacity even if it has opacity 0.
root_layer->test_properties()->opacity = 1.0f;
child_ptr->test_properties()->opacity = 0.0f;
root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
@@ -4457,19 +4459,27 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs3);
child_ptr = root_layer->layer_tree_impl()->LayerById(2);
- EXPECT_FALSE(child_ptr->contributes_to_drawn_render_surface());
- EXPECT_TRUE(child_ptr->raster_even_if_not_in_rsll());
+ tree = root_layer->layer_tree_impl()->property_trees()->effect_tree;
+ node = tree.Node(child_ptr->effect_tree_index());
+ EXPECT_TRUE(node->is_drawn);
+ EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index()));
- // The child layer should not be drawn as its transparent but should raster
- // as its opacity is animating even after activation.
+ // But if the opacity of the layer remains 0 after activation, it should not
+ // be drawn.
host_impl.ActivateSyncTree();
LayerImpl* active_root = host_impl.active_tree()->LayerById(root_layer->id());
LayerImpl* active_child = host_impl.active_tree()->LayerById(child_ptr->id());
+ EffectTree& active_effect_tree =
+ host_impl.active_tree()->property_trees()->effect_tree;
+ EXPECT_TRUE(active_effect_tree.needs_update());
+
ExecuteCalculateDrawProperties(active_root);
- EXPECT_FALSE(active_child->contributes_to_drawn_render_surface());
- EXPECT_TRUE(active_child->raster_even_if_not_in_rsll());
+ node = active_effect_tree.Node(active_child->effect_tree_index());
+ EXPECT_FALSE(node->is_drawn);
+ EXPECT_FALSE(active_effect_tree.ContributesToDrawnSurface(
+ active_child->effect_tree_index()));
}
using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>;
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698