| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 num_unclipped_descendants += data.num_unclipped_descendants; | 99 num_unclipped_descendants += data.num_unclipped_descendants; |
| 100 num_descendants_that_draw_content += data.num_descendants_that_draw_content; | 100 num_descendants_that_draw_content += data.num_descendants_that_draw_content; |
| 101 } | 101 } |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 static inline bool IsRootLayer(const Layer* layer) { | 104 static inline bool IsRootLayer(const Layer* layer) { |
| 105 return !layer->parent(); | 105 return !layer->parent(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { | 108 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { |
| 109 return layer->GetLayerTree()->needs_meta_info_recomputation(); | 109 return layer->layer_tree_host()->needs_meta_info_recomputation(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Recursively walks the layer tree(if needed) to compute any information | 112 // Recursively walks the layer tree(if needed) to compute any information |
| 113 // that is needed before doing the main recursion. | 113 // that is needed before doing the main recursion. |
| 114 static void PreCalculateMetaInformationInternal( | 114 static void PreCalculateMetaInformationInternal( |
| 115 Layer* layer, | 115 Layer* layer, |
| 116 PreCalculateMetaInformationRecursiveData* recursive_data) { | 116 PreCalculateMetaInformationRecursiveData* recursive_data) { |
| 117 if (!IsMetaInformationRecomputationNeeded(layer)) { | 117 if (!IsMetaInformationRecomputationNeeded(layer)) { |
| 118 DCHECK(IsRootLayer(layer)); | 118 DCHECK(IsRootLayer(layer)); |
| 119 return; | 119 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 133 if (layer->clip_children()) { | 133 if (layer->clip_children()) { |
| 134 size_t num_clip_children = layer->clip_children()->size(); | 134 size_t num_clip_children = layer->clip_children()->size(); |
| 135 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); | 135 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); |
| 136 recursive_data->num_unclipped_descendants -= num_clip_children; | 136 recursive_data->num_unclipped_descendants -= num_clip_children; |
| 137 } | 137 } |
| 138 | 138 |
| 139 layer->set_num_unclipped_descendants( | 139 layer->set_num_unclipped_descendants( |
| 140 recursive_data->num_unclipped_descendants); | 140 recursive_data->num_unclipped_descendants); |
| 141 | 141 |
| 142 if (IsRootLayer(layer)) | 142 if (IsRootLayer(layer)) |
| 143 layer->GetLayerTree()->SetNeedsMetaInfoRecomputation(false); | 143 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false); |
| 144 } | 144 } |
| 145 | 145 |
| 146 static void PreCalculateMetaInformationInternalForTesting( | 146 static void PreCalculateMetaInformationInternalForTesting( |
| 147 LayerImpl* layer, | 147 LayerImpl* layer, |
| 148 PreCalculateMetaInformationRecursiveData* recursive_data) { | 148 PreCalculateMetaInformationRecursiveData* recursive_data) { |
| 149 if (layer->test_properties()->clip_parent) | 149 if (layer->test_properties()->clip_parent) |
| 150 recursive_data->num_unclipped_descendants++; | 150 recursive_data->num_unclipped_descendants++; |
| 151 | 151 |
| 152 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { | 152 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { |
| 153 LayerImpl* child_layer = layer->test_properties()->children[i]; | 153 LayerImpl* child_layer = layer->test_properties()->children[i]; |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 const Layer* outer_viewport_scroll_layer, | 1502 const Layer* outer_viewport_scroll_layer, |
| 1503 const Layer* overscroll_elasticity_layer, | 1503 const Layer* overscroll_elasticity_layer, |
| 1504 const gfx::Vector2dF& elastic_overscroll, | 1504 const gfx::Vector2dF& elastic_overscroll, |
| 1505 float page_scale_factor, | 1505 float page_scale_factor, |
| 1506 float device_scale_factor, | 1506 float device_scale_factor, |
| 1507 const gfx::Rect& viewport, | 1507 const gfx::Rect& viewport, |
| 1508 const gfx::Transform& device_transform, | 1508 const gfx::Transform& device_transform, |
| 1509 PropertyTrees* property_trees) { | 1509 PropertyTrees* property_trees) { |
| 1510 property_trees->is_main_thread = true; | 1510 property_trees->is_main_thread = true; |
| 1511 property_trees->is_active = false; | 1511 property_trees->is_active = false; |
| 1512 SkColor color = root_layer->GetLayerTree()->background_color(); | 1512 SkColor color = root_layer->layer_tree_host()->background_color(); |
| 1513 if (SkColorGetA(color) != 255) | 1513 if (SkColorGetA(color) != 255) |
| 1514 color = SkColorSetA(color, 255); | 1514 color = SkColorSetA(color, 255); |
| 1515 BuildPropertyTreesTopLevelInternal( | 1515 BuildPropertyTreesTopLevelInternal( |
| 1516 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1516 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1517 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1517 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1518 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1518 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1519 device_transform, property_trees, color); | 1519 device_transform, property_trees, color); |
| 1520 #if DCHECK_IS_ON() | 1520 #if DCHECK_IS_ON() |
| 1521 for (auto* layer : *root_layer->GetLayerTree()) | 1521 for (auto* layer : *root_layer->layer_tree_host()) |
| 1522 CheckScrollAndClipPointersForLayer(layer); | 1522 CheckScrollAndClipPointersForLayer(layer); |
| 1523 #endif | 1523 #endif |
| 1524 property_trees->ResetCachedData(); | 1524 property_trees->ResetCachedData(); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 void PropertyTreeBuilder::BuildPropertyTrees( | 1527 void PropertyTreeBuilder::BuildPropertyTrees( |
| 1528 LayerImpl* root_layer, | 1528 LayerImpl* root_layer, |
| 1529 const LayerImpl* page_scale_layer, | 1529 const LayerImpl* page_scale_layer, |
| 1530 const LayerImpl* inner_viewport_scroll_layer, | 1530 const LayerImpl* inner_viewport_scroll_layer, |
| 1531 const LayerImpl* outer_viewport_scroll_layer, | 1531 const LayerImpl* outer_viewport_scroll_layer, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1543 color = SkColorSetA(color, 255); | 1543 color = SkColorSetA(color, 255); |
| 1544 BuildPropertyTreesTopLevelInternal( | 1544 BuildPropertyTreesTopLevelInternal( |
| 1545 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1545 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1546 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1546 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1547 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1547 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1548 device_transform, property_trees, color); | 1548 device_transform, property_trees, color); |
| 1549 property_trees->ResetCachedData(); | 1549 property_trees->ResetCachedData(); |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 } // namespace cc | 1552 } // namespace cc |
| OLD | NEW |