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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 957703004: cc: Fix animated filter render surface check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 DCHECK(!is_root); 584 DCHECK(!is_root);
585 return true; 585 return true;
586 } 586 }
587 587
588 // If the layer uses a CSS filter. 588 // If the layer uses a CSS filter.
589 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { 589 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) {
590 DCHECK(!is_root); 590 DCHECK(!is_root);
591 return true; 591 return true;
592 } 592 }
593 593
594 // If the layer will use a CSS filter. In this case, the animation
595 // will start and add a filter to this layer, so it needs a surface.
596 if (layer->FilterIsAnimating()) {
597 DCHECK(!is_root);
598 return true;
599 }
600
594 int num_descendants_that_draw_content = 601 int num_descendants_that_draw_content =
595 layer->NumDescendantsThatDrawContent(); 602 layer->NumDescendantsThatDrawContent();
596 603
597 // If the layer flattens its subtree, but it is treated as a 3D object by its 604 // If the layer flattens its subtree, but it is treated as a 3D object by its
598 // parent (i.e. parent participates in a 3D rendering context). 605 // parent (i.e. parent participates in a 3D rendering context).
599 if (LayerIsInExisting3DRenderingContext(layer) && 606 if (LayerIsInExisting3DRenderingContext(layer) &&
600 layer->should_flatten_transform() && 607 layer->should_flatten_transform() &&
601 num_descendants_that_draw_content > 0) { 608 num_descendants_that_draw_content > 0) {
602 TRACE_EVENT_INSTANT0( 609 TRACE_EVENT_INSTANT0(
603 "cc", 610 "cc",
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 void Merge(const PreCalculateMetaInformationRecursiveData& data) { 1198 void Merge(const PreCalculateMetaInformationRecursiveData& data) {
1192 layer_or_descendant_has_copy_request |= 1199 layer_or_descendant_has_copy_request |=
1193 data.layer_or_descendant_has_copy_request; 1200 data.layer_or_descendant_has_copy_request;
1194 layer_or_descendant_has_input_handler |= 1201 layer_or_descendant_has_input_handler |=
1195 data.layer_or_descendant_has_input_handler; 1202 data.layer_or_descendant_has_input_handler;
1196 num_unclipped_descendants += 1203 num_unclipped_descendants +=
1197 data.num_unclipped_descendants; 1204 data.num_unclipped_descendants;
1198 } 1205 }
1199 }; 1206 };
1200 1207
1201 static bool ValidateRenderSurface(LayerImpl* layer) { 1208 static void ValidateRenderSurface(LayerImpl* layer) {
1202 // This test verifies that there are no cases where a LayerImpl needs 1209 // This test verifies that there are no cases where a LayerImpl needs
1203 // a render surface, but doesn't have one. 1210 // a render surface, but doesn't have one.
1204 if (layer->render_surface()) 1211 if (layer->render_surface())
1205 return true; 1212 return;
1206 1213
1207 return layer->filters().IsEmpty() && layer->background_filters().IsEmpty() && 1214 DCHECK(layer->filters().IsEmpty()) << "layer: " << layer->id();
1208 !layer->mask_layer() && !layer->replica_layer() && 1215 DCHECK(layer->background_filters().IsEmpty()) << "layer: " << layer->id();
1209 !IsRootLayer(layer) && !layer->is_root_for_isolated_group() && 1216 DCHECK(!layer->mask_layer()) << "layer: " << layer->id();
1210 !layer->HasCopyRequest(); 1217 DCHECK(!layer->replica_layer()) << "layer: " << layer->id();
1218 DCHECK(!IsRootLayer(layer)) << "layer: " << layer->id();
1219 DCHECK(!layer->is_root_for_isolated_group()) << "layer: " << layer->id();
1220 DCHECK(!layer->HasCopyRequest()) << "layer: " << layer->id();
1211 } 1221 }
1212 1222
1213 static bool ValidateRenderSurface(Layer* layer) { 1223 static void ValidateRenderSurface(Layer* layer) {
1214 return true;
1215 } 1224 }
1216 1225
1217 // Recursively walks the layer tree to compute any information that is needed 1226 // Recursively walks the layer tree to compute any information that is needed
1218 // before doing the main recursion. 1227 // before doing the main recursion.
1219 template <typename LayerType> 1228 template <typename LayerType>
1220 static void PreCalculateMetaInformation( 1229 static void PreCalculateMetaInformation(
1221 LayerType* layer, 1230 LayerType* layer,
1222 PreCalculateMetaInformationRecursiveData* recursive_data) { 1231 PreCalculateMetaInformationRecursiveData* recursive_data) {
1223 DCHECK(ValidateRenderSurface(layer)); 1232 ValidateRenderSurface(layer);
1224 1233
1225 layer->draw_properties().sorted_for_recursion = false; 1234 layer->draw_properties().sorted_for_recursion = false;
1226 layer->draw_properties().has_child_with_a_scroll_parent = false; 1235 layer->draw_properties().has_child_with_a_scroll_parent = false;
1227 layer->draw_properties().visited = false; 1236 layer->draw_properties().visited = false;
1228 1237
1229 if (!HasInvertibleOrAnimatedTransform(layer)) { 1238 if (!HasInvertibleOrAnimatedTransform(layer)) {
1230 // Layers with singular transforms should not be drawn, the whole subtree 1239 // Layers with singular transforms should not be drawn, the whole subtree
1231 // can be skipped. 1240 // can be skipped.
1232 return; 1241 return;
1233 } 1242 }
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 inputs->current_render_surface_layer_list_id); 2586 inputs->current_render_surface_layer_list_id);
2578 2587
2579 // The dummy layer list should not have been used. 2588 // The dummy layer list should not have been used.
2580 DCHECK_EQ(0u, dummy_layer_list.size()); 2589 DCHECK_EQ(0u, dummy_layer_list.size());
2581 // A root layer render_surface should always exist after 2590 // A root layer render_surface should always exist after
2582 // CalculateDrawProperties. 2591 // CalculateDrawProperties.
2583 DCHECK(inputs->root_layer->render_surface()); 2592 DCHECK(inputs->root_layer->render_surface());
2584 } 2593 }
2585 2594
2586 } // namespace cc 2595 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698