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

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

Issue 2846653002: cc : Stop pushing layers from hidden subtrees at commit
Patch Set: add TODO 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 unified diff | Download patch
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('k') | cc/trees/tree_synchronizer.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/property_tree_builder.h" 5 #include "cc/trees/property_tree_builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 NumLayerOrDescendantsThatDrawContentRecursive(child_layer); 647 NumLayerOrDescendantsThatDrawContentRecursive(child_layer);
648 } 648 }
649 return num_descendants_that_draw_content; 649 return num_descendants_that_draw_content;
650 } 650 }
651 651
652 static inline float EffectiveOpacity(Layer* layer) { 652 static inline float EffectiveOpacity(Layer* layer) {
653 return layer->EffectiveOpacity(); 653 return layer->EffectiveOpacity();
654 } 654 }
655 655
656 static inline float EffectiveOpacity(LayerImpl* layer) { 656 static inline float EffectiveOpacity(LayerImpl* layer) {
657 return layer->test_properties()->hide_layer_and_subtree 657 return layer->test_properties()->opacity;
658 ? 0.f
659 : layer->test_properties()->opacity;
660 } 658 }
661 659
662 static inline float Opacity(Layer* layer) { 660 static inline float Opacity(Layer* layer) {
663 return layer->opacity(); 661 return layer->opacity();
664 } 662 }
665 663
666 static inline float Opacity(LayerImpl* layer) { 664 static inline float Opacity(LayerImpl* layer) {
667 return layer->test_properties()->opacity; 665 return layer->test_properties()->opacity;
668 } 666 }
669 667
(...skipping 19 matching lines...) Expand all
689 687
690 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { 688 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) {
691 return layer->test_properties()->background_filters; 689 return layer->test_properties()->background_filters;
692 } 690 }
693 691
694 static inline bool HideLayerAndSubtree(Layer* layer) { 692 static inline bool HideLayerAndSubtree(Layer* layer) {
695 return layer->hide_layer_and_subtree(); 693 return layer->hide_layer_and_subtree();
696 } 694 }
697 695
698 static inline bool HideLayerAndSubtree(LayerImpl* layer) { 696 static inline bool HideLayerAndSubtree(LayerImpl* layer) {
699 return layer->test_properties()->hide_layer_and_subtree; 697 return false;
700 } 698 }
701 699
702 static inline bool HasCopyRequest(Layer* layer) { 700 static inline bool HasCopyRequest(Layer* layer) {
703 return layer->HasCopyRequest(); 701 return layer->HasCopyRequest();
704 } 702 }
705 703
706 static inline bool HasCopyRequest(LayerImpl* layer) { 704 static inline bool HasCopyRequest(LayerImpl* layer) {
707 return !layer->test_properties()->copy_requests.empty(); 705 return !layer->test_properties()->copy_requests.empty();
708 } 706 }
709 707
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 copy_requests->push_back(std::move(request)); 827 copy_requests->push_back(std::move(request));
830 layer->test_properties()->copy_requests.clear(); 828 layer->test_properties()->copy_requests.clear();
831 } 829 }
832 830
833 static void SetSubtreeHasCopyRequest(Layer* layer, 831 static void SetSubtreeHasCopyRequest(Layer* layer,
834 bool subtree_has_copy_request) { 832 bool subtree_has_copy_request) {
835 layer->SetSubtreeHasCopyRequest(subtree_has_copy_request); 833 layer->SetSubtreeHasCopyRequest(subtree_has_copy_request);
836 } 834 }
837 835
838 static void SetSubtreeHasCopyRequest(LayerImpl* layer, 836 static void SetSubtreeHasCopyRequest(LayerImpl* layer,
839 bool subtree_has_copy_request) { 837 bool subtree_has_copy_request) {}
840 layer->test_properties()->subtree_has_copy_request = subtree_has_copy_request;
841 }
842 838
843 static bool SubtreeHasCopyRequest(Layer* layer) { 839 static bool SubtreeHasCopyRequest(Layer* layer) {
844 return layer->SubtreeHasCopyRequest(); 840 return layer->SubtreeHasCopyRequest();
845 } 841 }
846 842
847 static bool SubtreeHasCopyRequest(LayerImpl* layer) { 843 static bool SubtreeHasCopyRequest(LayerImpl* layer) {
848 return layer->test_properties()->subtree_has_copy_request; 844 return false;
849 } 845 }
850 846
851 template <typename LayerType> 847 template <typename LayerType>
852 bool UpdateSubtreeHasCopyRequestRecursive(LayerType* layer) { 848 bool UpdateSubtreeHasCopyRequestRecursive(LayerType* layer) {
853 bool subtree_has_copy_request = false; 849 bool subtree_has_copy_request = false;
854 if (HasCopyRequest(layer)) 850 if (HasCopyRequest(layer))
855 subtree_has_copy_request = true; 851 subtree_has_copy_request = true;
856 for (size_t i = 0; i < Children(layer).size(); ++i) { 852 for (size_t i = 0; i < Children(layer).size(); ++i) {
857 LayerType* current_child = ChildAt(layer, i); 853 LayerType* current_child = ChildAt(layer, i);
858 subtree_has_copy_request |= 854 subtree_has_copy_request |=
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 } 1127 }
1132 1128
1133 static void SetLayerPropertyChangedForChild(Layer* parent, Layer* child) { 1129 static void SetLayerPropertyChangedForChild(Layer* parent, Layer* child) {
1134 if (parent->subtree_property_changed()) 1130 if (parent->subtree_property_changed())
1135 child->SetSubtreePropertyChanged(); 1131 child->SetSubtreePropertyChanged();
1136 } 1132 }
1137 1133
1138 static void SetLayerPropertyChangedForChild(LayerImpl* parent, 1134 static void SetLayerPropertyChangedForChild(LayerImpl* parent,
1139 LayerImpl* child) {} 1135 LayerImpl* child) {}
1140 1136
1137 static bool SubtreeIsHidden(Layer* layer) {
1138 return !SubtreeHasCopyRequest(layer) && layer->parent() &&
1139 layer->hide_layer_and_subtree();
1140 }
1141
1142 static bool SubtreeIsHidden(LayerImpl* layer) {
1143 return false;
1144 }
1145
1146 static void SetIsHidden(Layer* layer, bool is_hidden) {
1147 layer->SetIsHidden(is_hidden);
1148 if (MaskLayer(layer))
enne (OOO) 2017/05/29 23:14:10 Is this required? I worry that this is one more av
1149 MaskLayer(layer)->SetIsHidden(is_hidden);
1150 }
1151
1152 static void SetIsHidden(LayerImpl* layer, bool is_hidden) {}
1153
1154 template <typename LayerType>
1155 void AddPropertyTreeNodesIfNeeded(
1156 LayerType* layer,
1157 const DataForRecursion<LayerType>& data_from_parent,
1158 DataForRecursion<LayerType>* data_for_children) {
1159 DCHECK(!data_for_children->is_hidden);
1160 layer->set_property_tree_sequence_number(
1161 data_from_parent.property_trees->sequence_number);
1162 bool created_render_surface =
1163 AddEffectNodeIfNeeded(data_from_parent, layer, data_for_children);
1164
1165 bool created_transform_node = AddTransformNodeIfNeeded(
1166 data_from_parent, layer, created_render_surface, data_for_children);
1167 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node,
1168 data_for_children);
1169
1170 AddScrollNodeIfNeeded(data_from_parent, layer, data_for_children);
1171
1172 SetBackfaceVisibilityTransform(layer, created_transform_node);
1173 SetSafeOpaqueBackgroundColor(data_from_parent, layer, data_for_children);
1174 }
1175
1141 template <typename LayerType> 1176 template <typename LayerType>
1142 void BuildPropertyTreesInternal( 1177 void BuildPropertyTreesInternal(
1143 LayerType* layer, 1178 LayerType* layer,
1144 const DataForRecursion<LayerType>& data_from_parent) { 1179 const DataForRecursion<LayerType>& data_from_parent) {
1145 layer->set_property_tree_sequence_number(
1146 data_from_parent.property_trees->sequence_number);
1147
1148 DataForRecursion<LayerType> data_for_children(data_from_parent); 1180 DataForRecursion<LayerType> data_for_children(data_from_parent);
1149 1181
1150 bool created_render_surface = 1182 data_for_children.is_hidden =
1151 AddEffectNodeIfNeeded(data_from_parent, layer, &data_for_children); 1183 data_from_parent.is_hidden || SubtreeIsHidden(layer);
1152 1184
1185 SetIsHidden(layer, data_for_children.is_hidden);
enne (OOO) 2017/05/29 23:14:10 I am not that keen on setting (more) data on layer
1153 1186
1154 bool created_transform_node = AddTransformNodeIfNeeded( 1187 // We do not create property tree nodes for hidden layers.
1155 data_from_parent, layer, created_render_surface, &data_for_children); 1188 if (!data_for_children.is_hidden)
1156 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node, 1189 AddPropertyTreeNodesIfNeeded(layer, data_from_parent, &data_for_children);
1157 &data_for_children);
1158
1159 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children);
1160
1161 SetBackfaceVisibilityTransform(layer, created_transform_node);
1162 SetSafeOpaqueBackgroundColor(data_from_parent, layer, &data_for_children);
1163 1190
1164 bool not_axis_aligned_since_last_clip = 1191 bool not_axis_aligned_since_last_clip =
1165 data_from_parent.not_axis_aligned_since_last_clip 1192 data_from_parent.not_axis_aligned_since_last_clip
1166 ? true 1193 ? true
1167 : !AnimationsPreserveAxisAlignment(layer) || 1194 : !AnimationsPreserveAxisAlignment(layer) ||
1168 !Transform(layer).Preserves2dAxisAlignment(); 1195 !Transform(layer).Preserves2dAxisAlignment();
1169 bool has_non_axis_aligned_clip = 1196 bool has_non_axis_aligned_clip =
1170 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer); 1197 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
1171 data_for_children.not_axis_aligned_since_last_clip = 1198 data_for_children.not_axis_aligned_since_last_clip =
1172 !has_non_axis_aligned_clip; 1199 !has_non_axis_aligned_clip;
(...skipping 13 matching lines...) Expand all
1186 if (ScrollChildren(layer)) { 1213 if (ScrollChildren(layer)) {
1187 for (LayerType* scroll_child : *ScrollChildren(layer)) { 1214 for (LayerType* scroll_child : *ScrollChildren(layer)) {
1188 DCHECK_EQ(ScrollParent(scroll_child), layer); 1215 DCHECK_EQ(ScrollParent(scroll_child), layer);
1189 DCHECK(Parent(scroll_child)); 1216 DCHECK(Parent(scroll_child));
1190 data_for_children.effect_tree_parent = 1217 data_for_children.effect_tree_parent =
1191 Parent(scroll_child)->effect_tree_index(); 1218 Parent(scroll_child)->effect_tree_index();
1192 BuildPropertyTreesInternal(scroll_child, data_for_children); 1219 BuildPropertyTreesInternal(scroll_child, data_for_children);
1193 } 1220 }
1194 } 1221 }
1195 1222
1223 if (data_for_children.is_hidden)
1224 return;
1225
1196 if (MaskLayer(layer)) { 1226 if (MaskLayer(layer)) {
1197 MaskLayer(layer)->set_property_tree_sequence_number( 1227 MaskLayer(layer)->set_property_tree_sequence_number(
1198 data_from_parent.property_trees->sequence_number); 1228 data_from_parent.property_trees->sequence_number);
1199 MaskLayer(layer)->set_offset_to_transform_parent( 1229 MaskLayer(layer)->set_offset_to_transform_parent(
1200 layer->offset_to_transform_parent()); 1230 layer->offset_to_transform_parent());
1201 MaskLayer(layer)->SetTransformTreeIndex(layer->transform_tree_index()); 1231 MaskLayer(layer)->SetTransformTreeIndex(layer->transform_tree_index());
1202 MaskLayer(layer)->SetClipTreeIndex(layer->clip_tree_index()); 1232 MaskLayer(layer)->SetClipTreeIndex(layer->clip_tree_index());
1203 MaskLayer(layer)->SetEffectTreeIndex(layer->effect_tree_index()); 1233 MaskLayer(layer)->SetEffectTreeIndex(layer->effect_tree_index());
1204 MaskLayer(layer)->SetScrollTreeIndex(layer->scroll_tree_index()); 1234 MaskLayer(layer)->SetScrollTreeIndex(layer->scroll_tree_index());
1205 } 1235 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1418 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1389 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1419 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1390 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1420 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1391 device_transform, property_trees, color); 1421 device_transform, property_trees, color);
1392 property_trees->effect_tree.CreateOrReuseRenderSurfaces( 1422 property_trees->effect_tree.CreateOrReuseRenderSurfaces(
1393 &render_surfaces, root_layer->layer_tree_impl()); 1423 &render_surfaces, root_layer->layer_tree_impl());
1394 property_trees->ResetCachedData(); 1424 property_trees->ResetCachedData();
1395 } 1425 }
1396 1426
1397 } // namespace cc 1427 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698