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

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

Issue 2846653002: cc : Stop pushing layers from hidden subtrees at commit
Patch Set: rebase Created 3 years, 6 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 NumLayerOrDescendantsThatDrawContentRecursive(child_layer); 640 NumLayerOrDescendantsThatDrawContentRecursive(child_layer);
641 } 641 }
642 return num_descendants_that_draw_content; 642 return num_descendants_that_draw_content;
643 } 643 }
644 644
645 static inline float EffectiveOpacity(Layer* layer) { 645 static inline float EffectiveOpacity(Layer* layer) {
646 return layer->EffectiveOpacity(); 646 return layer->EffectiveOpacity();
647 } 647 }
648 648
649 static inline float EffectiveOpacity(LayerImpl* layer) { 649 static inline float EffectiveOpacity(LayerImpl* layer) {
650 return layer->test_properties()->hide_layer_and_subtree 650 return layer->test_properties()->opacity;
651 ? 0.f
652 : layer->test_properties()->opacity;
653 } 651 }
654 652
655 static inline float Opacity(Layer* layer) { 653 static inline float Opacity(Layer* layer) {
656 return layer->opacity(); 654 return layer->opacity();
657 } 655 }
658 656
659 static inline float Opacity(LayerImpl* layer) { 657 static inline float Opacity(LayerImpl* layer) {
660 return layer->test_properties()->opacity; 658 return layer->test_properties()->opacity;
661 } 659 }
662 660
(...skipping 19 matching lines...) Expand all
682 680
683 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { 681 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) {
684 return layer->test_properties()->background_filters; 682 return layer->test_properties()->background_filters;
685 } 683 }
686 684
687 static inline bool HideLayerAndSubtree(Layer* layer) { 685 static inline bool HideLayerAndSubtree(Layer* layer) {
688 return layer->hide_layer_and_subtree(); 686 return layer->hide_layer_and_subtree();
689 } 687 }
690 688
691 static inline bool HideLayerAndSubtree(LayerImpl* layer) { 689 static inline bool HideLayerAndSubtree(LayerImpl* layer) {
692 return layer->test_properties()->hide_layer_and_subtree; 690 return false;
693 } 691 }
694 692
695 static inline bool HasCopyRequest(Layer* layer) { 693 static inline bool HasCopyRequest(Layer* layer) {
696 return layer->HasCopyRequest(); 694 return layer->HasCopyRequest();
697 } 695 }
698 696
699 static inline bool HasCopyRequest(LayerImpl* layer) { 697 static inline bool HasCopyRequest(LayerImpl* layer) {
700 return !layer->test_properties()->copy_requests.empty(); 698 return !layer->test_properties()->copy_requests.empty();
701 } 699 }
702 700
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 copy_requests->push_back(std::move(request)); 820 copy_requests->push_back(std::move(request));
823 layer->test_properties()->copy_requests.clear(); 821 layer->test_properties()->copy_requests.clear();
824 } 822 }
825 823
826 static void SetSubtreeHasCopyRequest(Layer* layer, 824 static void SetSubtreeHasCopyRequest(Layer* layer,
827 bool subtree_has_copy_request) { 825 bool subtree_has_copy_request) {
828 layer->SetSubtreeHasCopyRequest(subtree_has_copy_request); 826 layer->SetSubtreeHasCopyRequest(subtree_has_copy_request);
829 } 827 }
830 828
831 static void SetSubtreeHasCopyRequest(LayerImpl* layer, 829 static void SetSubtreeHasCopyRequest(LayerImpl* layer,
832 bool subtree_has_copy_request) { 830 bool subtree_has_copy_request) {}
833 layer->test_properties()->subtree_has_copy_request = subtree_has_copy_request;
834 }
835 831
836 static bool SubtreeHasCopyRequest(Layer* layer) { 832 static bool SubtreeHasCopyRequest(Layer* layer) {
837 return layer->SubtreeHasCopyRequest(); 833 return layer->SubtreeHasCopyRequest();
838 } 834 }
839 835
840 static bool SubtreeHasCopyRequest(LayerImpl* layer) { 836 static bool SubtreeHasCopyRequest(LayerImpl* layer) {
841 return layer->test_properties()->subtree_has_copy_request; 837 return false;
842 } 838 }
843 839
844 template <typename LayerType> 840 template <typename LayerType>
845 bool UpdateSubtreeHasCopyRequestRecursive(LayerType* layer) { 841 bool UpdateSubtreeHasCopyRequestRecursive(LayerType* layer) {
846 bool subtree_has_copy_request = false; 842 bool subtree_has_copy_request = false;
847 if (HasCopyRequest(layer)) 843 if (HasCopyRequest(layer))
848 subtree_has_copy_request = true; 844 subtree_has_copy_request = true;
849 for (size_t i = 0; i < Children(layer).size(); ++i) { 845 for (size_t i = 0; i < Children(layer).size(); ++i) {
850 LayerType* current_child = ChildAt(layer, i); 846 LayerType* current_child = ChildAt(layer, i);
851 subtree_has_copy_request |= 847 subtree_has_copy_request |=
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1123 }
1128 1124
1129 static void SetLayerPropertyChangedForChild(Layer* parent, Layer* child) { 1125 static void SetLayerPropertyChangedForChild(Layer* parent, Layer* child) {
1130 if (parent->subtree_property_changed()) 1126 if (parent->subtree_property_changed())
1131 child->SetSubtreePropertyChanged(); 1127 child->SetSubtreePropertyChanged();
1132 } 1128 }
1133 1129
1134 static void SetLayerPropertyChangedForChild(LayerImpl* parent, 1130 static void SetLayerPropertyChangedForChild(LayerImpl* parent,
1135 LayerImpl* child) {} 1131 LayerImpl* child) {}
1136 1132
1133 static bool SubtreeIsHidden(Layer* layer) {
1134 return !SubtreeHasCopyRequest(layer) && layer->parent() &&
1135 layer->hide_layer_and_subtree();
1136 }
1137
1138 static bool SubtreeIsHidden(LayerImpl* layer) {
1139 return false;
1140 }
1141
1142 static void SetIsHidden(Layer* layer, bool is_hidden) {
1143 layer->SetIsHidden(is_hidden);
1144 if (MaskLayer(layer))
1145 MaskLayer(layer)->SetIsHidden(is_hidden);
1146 }
1147
1148 static void SetIsHidden(LayerImpl* layer, bool is_hidden) {}
1149
1150 template <typename LayerType>
1151 void AddPropertyTreeNodesIfNeeded(
1152 LayerType* layer,
1153 const DataForRecursion<LayerType>& data_from_parent,
1154 DataForRecursion<LayerType>* data_for_children) {
1155 DCHECK(!data_for_children->is_hidden);
1156 layer->set_property_tree_sequence_number(
1157 data_from_parent.property_trees->sequence_number);
1158 bool created_render_surface =
1159 AddEffectNodeIfNeeded(data_from_parent, layer, data_for_children);
1160
1161 bool created_transform_node = AddTransformNodeIfNeeded(
1162 data_from_parent, layer, created_render_surface, data_for_children);
1163 SetHasTransformNode(layer, created_transform_node);
1164 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node,
1165 data_for_children);
1166
1167 AddScrollNodeIfNeeded(data_from_parent, layer, data_for_children);
1168
1169 SetBackfaceVisibilityTransform(layer, created_transform_node);
1170 SetSafeOpaqueBackgroundColor(data_from_parent, layer, data_for_children);
1171 }
1172
1137 template <typename LayerType> 1173 template <typename LayerType>
1138 void BuildPropertyTreesInternal( 1174 void BuildPropertyTreesInternal(
1139 LayerType* layer, 1175 LayerType* layer,
1140 const DataForRecursion<LayerType>& data_from_parent) { 1176 const DataForRecursion<LayerType>& data_from_parent) {
1141 layer->set_property_tree_sequence_number(
1142 data_from_parent.property_trees->sequence_number);
1143
1144 DataForRecursion<LayerType> data_for_children(data_from_parent); 1177 DataForRecursion<LayerType> data_for_children(data_from_parent);
1145 1178
1146 bool created_render_surface = 1179 data_for_children.is_hidden =
1147 AddEffectNodeIfNeeded(data_from_parent, layer, &data_for_children); 1180 data_from_parent.is_hidden || SubtreeIsHidden(layer);
1148 1181
1182 SetIsHidden(layer, data_for_children.is_hidden);
1149 1183
1150 bool created_transform_node = AddTransformNodeIfNeeded( 1184 // We do not create property tree nodes for hidden layers.
1151 data_from_parent, layer, created_render_surface, &data_for_children); 1185 if (!data_for_children.is_hidden)
1152 SetHasTransformNode(layer, created_transform_node); 1186 AddPropertyTreeNodesIfNeeded(layer, data_from_parent, &data_for_children);
1153 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node,
1154 &data_for_children);
1155
1156 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children);
1157
1158 SetBackfaceVisibilityTransform(layer, created_transform_node);
1159 SetSafeOpaqueBackgroundColor(data_from_parent, layer, &data_for_children);
1160 1187
1161 bool not_axis_aligned_since_last_clip = 1188 bool not_axis_aligned_since_last_clip =
1162 data_from_parent.not_axis_aligned_since_last_clip 1189 data_from_parent.not_axis_aligned_since_last_clip
1163 ? true 1190 ? true
1164 : !AnimationsPreserveAxisAlignment(layer) || 1191 : !AnimationsPreserveAxisAlignment(layer) ||
1165 !Transform(layer).Preserves2dAxisAlignment(); 1192 !Transform(layer).Preserves2dAxisAlignment();
1166 bool has_non_axis_aligned_clip = 1193 bool has_non_axis_aligned_clip =
1167 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer); 1194 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
1168 data_for_children.not_axis_aligned_since_last_clip = 1195 data_for_children.not_axis_aligned_since_last_clip =
1169 !has_non_axis_aligned_clip; 1196 !has_non_axis_aligned_clip;
(...skipping 13 matching lines...) Expand all
1183 if (ScrollChildren(layer)) { 1210 if (ScrollChildren(layer)) {
1184 for (LayerType* scroll_child : *ScrollChildren(layer)) { 1211 for (LayerType* scroll_child : *ScrollChildren(layer)) {
1185 DCHECK_EQ(ScrollParent(scroll_child), layer); 1212 DCHECK_EQ(ScrollParent(scroll_child), layer);
1186 DCHECK(Parent(scroll_child)); 1213 DCHECK(Parent(scroll_child));
1187 data_for_children.effect_tree_parent = 1214 data_for_children.effect_tree_parent =
1188 Parent(scroll_child)->effect_tree_index(); 1215 Parent(scroll_child)->effect_tree_index();
1189 BuildPropertyTreesInternal(scroll_child, data_for_children); 1216 BuildPropertyTreesInternal(scroll_child, data_for_children);
1190 } 1217 }
1191 } 1218 }
1192 1219
1220 if (data_for_children.is_hidden)
1221 return;
1222
1193 if (MaskLayer(layer)) { 1223 if (MaskLayer(layer)) {
1194 MaskLayer(layer)->set_property_tree_sequence_number( 1224 MaskLayer(layer)->set_property_tree_sequence_number(
1195 data_from_parent.property_trees->sequence_number); 1225 data_from_parent.property_trees->sequence_number);
1196 MaskLayer(layer)->set_offset_to_transform_parent( 1226 MaskLayer(layer)->set_offset_to_transform_parent(
1197 layer->offset_to_transform_parent()); 1227 layer->offset_to_transform_parent());
1198 MaskLayer(layer)->SetTransformTreeIndex(layer->transform_tree_index()); 1228 MaskLayer(layer)->SetTransformTreeIndex(layer->transform_tree_index());
1199 MaskLayer(layer)->SetClipTreeIndex(layer->clip_tree_index()); 1229 MaskLayer(layer)->SetClipTreeIndex(layer->clip_tree_index());
1200 MaskLayer(layer)->SetEffectTreeIndex(layer->effect_tree_index()); 1230 MaskLayer(layer)->SetEffectTreeIndex(layer->effect_tree_index());
1201 MaskLayer(layer)->SetScrollTreeIndex(layer->scroll_tree_index()); 1231 MaskLayer(layer)->SetScrollTreeIndex(layer->scroll_tree_index());
1202 } 1232 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1415 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1386 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1416 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1387 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1417 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1388 device_transform, property_trees, color); 1418 device_transform, property_trees, color);
1389 property_trees->effect_tree.CreateOrReuseRenderSurfaces( 1419 property_trees->effect_tree.CreateOrReuseRenderSurfaces(
1390 &render_surfaces, root_layer->layer_tree_impl()); 1420 &render_surfaces, root_layer->layer_tree_impl());
1391 property_trees->ResetCachedData(); 1421 property_trees->ResetCachedData();
1392 } 1422 }
1393 1423
1394 } // namespace cc 1424 } // 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