| OLD | NEW |
| 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 DCHECK_EQ(layer->id(), clip_node->owner_id); | 371 DCHECK_EQ(layer->id(), clip_node->owner_id); |
| 372 gfx::SizeF bounds = gfx::SizeF(layer->bounds()); | 372 gfx::SizeF bounds = gfx::SizeF(layer->bounds()); |
| 373 if (clip_node->clip.size() != bounds) { | 373 if (clip_node->clip.size() != bounds) { |
| 374 clip_node->clip.set_size(bounds); | 374 clip_node->clip.set_size(bounds); |
| 375 clip_tree->set_needs_update(true); | 375 clip_tree->set_needs_update(true); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 | 380 |
| 381 void LayerTreeImpl::SetPropertyTrees(PropertyTrees* property_trees) { | 381 void LayerTreeImpl::SetPropertyTrees(PropertyTrees* property_trees, |
| 382 PropertyTrees* test_property_trees_with_new_clip_tree) { |
| 382 property_trees_ = *property_trees; | 383 property_trees_ = *property_trees; |
| 383 property_trees->effect_tree.PushCopyRequestsTo(&property_trees_.effect_tree); | 384 property_trees->effect_tree.PushCopyRequestsTo(&property_trees_.effect_tree); |
| 384 property_trees_.is_main_thread = false; | 385 property_trees_.is_main_thread = false; |
| 385 property_trees_.is_active = IsActiveTree(); | 386 property_trees_.is_active = IsActiveTree(); |
| 386 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); | 387 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); |
| 387 // The value of some effect node properties (like is_drawn) depends on | 388 // The value of some effect node properties (like is_drawn) depends on |
| 388 // whether we are on the active tree or not. So, we need to update the | 389 // whether we are on the active tree or not. So, we need to update the |
| 389 // effect tree. | 390 // effect tree. |
| 390 if (IsActiveTree()) | 391 if (IsActiveTree()) |
| 391 property_trees_.effect_tree.set_needs_update(true); | 392 property_trees_.effect_tree.set_needs_update(true); |
| 393 if (settings().verify_clip_tree_calculations) { |
| 394 *test_property_trees_with_new_clip_tree_ = |
| 395 *test_property_trees_with_new_clip_tree; |
| 396 } |
| 392 } | 397 } |
| 393 | 398 |
| 394 void LayerTreeImpl::UpdatePropertyTreesForBoundsDelta() { | 399 void LayerTreeImpl::UpdatePropertyTreesForBoundsDelta() { |
| 395 DCHECK(IsActiveTree()); | 400 DCHECK(IsActiveTree()); |
| 396 LayerImpl* inner_container = InnerViewportContainerLayer(); | 401 LayerImpl* inner_container = InnerViewportContainerLayer(); |
| 397 LayerImpl* outer_container = OuterViewportContainerLayer(); | 402 LayerImpl* outer_container = OuterViewportContainerLayer(); |
| 398 LayerImpl* inner_scroll = InnerViewportScrollLayer(); | 403 LayerImpl* inner_scroll = InnerViewportScrollLayer(); |
| 399 | 404 |
| 400 UpdateClipTreeForBoundsDeltaOnLayer(inner_container, | 405 UpdateClipTreeForBoundsDeltaOnLayer(inner_container, |
| 401 &property_trees_.clip_tree); | 406 &property_trees_.clip_tree); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 413 if (inner_scroll) | 418 if (inner_scroll) |
| 414 property_trees_.SetInnerViewportScrollBoundsDelta( | 419 property_trees_.SetInnerViewportScrollBoundsDelta( |
| 415 inner_scroll->bounds_delta()); | 420 inner_scroll->bounds_delta()); |
| 416 } | 421 } |
| 417 | 422 |
| 418 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { | 423 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { |
| 419 // The request queue should have been processed and does not require a push. | 424 // The request queue should have been processed and does not require a push. |
| 420 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 425 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
| 421 | 426 |
| 422 LayerImpl* layer = target_tree->CurrentlyScrollingLayer(); | 427 LayerImpl* layer = target_tree->CurrentlyScrollingLayer(); |
| 423 target_tree->SetPropertyTrees(&property_trees_); | 428 target_tree->SetPropertyTrees(&property_trees_, |
| 429 test_property_trees_with_new_clip_tree_); |
| 424 target_tree->SetCurrentlyScrollingLayer(layer); | 430 target_tree->SetCurrentlyScrollingLayer(layer); |
| 425 target_tree->UpdatePropertyTreeScrollOffset(&property_trees_); | 431 target_tree->UpdatePropertyTreeScrollOffset(&property_trees_); |
| 426 | 432 |
| 427 // This needs to be called early so that we don't clamp with incorrect max | 433 // This needs to be called early so that we don't clamp with incorrect max |
| 428 // offsets when UpdateViewportContainerSizes is called from e.g. | 434 // offsets when UpdateViewportContainerSizes is called from e.g. |
| 429 // PushBrowserControls | 435 // PushBrowserControls |
| 430 target_tree->UpdatePropertyTreesForBoundsDelta(); | 436 target_tree->UpdatePropertyTreesForBoundsDelta(); |
| 431 | 437 |
| 432 if (next_activation_forces_redraw_) { | 438 if (next_activation_forces_redraw_) { |
| 433 target_tree->ForceRedrawNextActivation(); | 439 target_tree->ForceRedrawNextActivation(); |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 | 1120 |
| 1115 void LayerTreeImpl::BuildLayerListAndPropertyTreesForTesting() { | 1121 void LayerTreeImpl::BuildLayerListAndPropertyTreesForTesting() { |
| 1116 BuildLayerListForTesting(); | 1122 BuildLayerListForTesting(); |
| 1117 BuildPropertyTreesForTesting(); | 1123 BuildPropertyTreesForTesting(); |
| 1118 } | 1124 } |
| 1119 | 1125 |
| 1120 void LayerTreeImpl::BuildPropertyTreesForTesting() { | 1126 void LayerTreeImpl::BuildPropertyTreesForTesting() { |
| 1121 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(layer_list_[0]); | 1127 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(layer_list_[0]); |
| 1122 property_trees_.needs_rebuild = true; | 1128 property_trees_.needs_rebuild = true; |
| 1123 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); | 1129 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); |
| 1130 bool build_new_clip_tree = true; |
| 1124 PropertyTreeBuilder::BuildPropertyTrees( | 1131 PropertyTreeBuilder::BuildPropertyTrees( |
| 1125 layer_list_[0], PageScaleLayer(), InnerViewportScrollLayer(), | 1132 layer_list_[0], PageScaleLayer(), InnerViewportScrollLayer(), |
| 1126 OuterViewportScrollLayer(), OverscrollElasticityLayer(), | 1133 OuterViewportScrollLayer(), OverscrollElasticityLayer(), |
| 1134 elastic_overscroll()->Current(IsActiveTree()), |
| 1135 current_page_scale_factor(), device_scale_factor(), |
| 1136 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), |
| 1137 test_property_trees_with_new_clip_tree(), build_new_clip_tree); |
| 1138 PropertyTreeBuilder::BuildPropertyTrees( |
| 1139 layer_list_[0], PageScaleLayer(), InnerViewportScrollLayer(), |
| 1140 OuterViewportScrollLayer(), OverscrollElasticityLayer(), |
| 1127 elastic_overscroll()->Current(IsActiveTree()), | 1141 elastic_overscroll()->Current(IsActiveTree()), |
| 1128 current_page_scale_factor(), device_scale_factor(), | 1142 current_page_scale_factor(), device_scale_factor(), |
| 1129 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), | 1143 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), |
| 1130 &property_trees_); | 1144 &property_trees_); |
| 1131 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); | 1145 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); |
| 1132 } | 1146 } |
| 1133 | 1147 |
| 1134 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { | 1148 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { |
| 1135 // If this assert triggers, then the list is dirty. | 1149 // If this assert triggers, then the list is dirty. |
| 1136 DCHECK(!needs_update_draw_properties_); | 1150 DCHECK(!needs_update_draw_properties_); |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2086 |
| 2073 void LayerTreeImpl::ResetAllChangeTracking() { | 2087 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2074 layers_that_should_push_properties_.clear(); | 2088 layers_that_should_push_properties_.clear(); |
| 2075 // Iterate over all layers, including masks. | 2089 // Iterate over all layers, including masks. |
| 2076 for (auto& layer : *layers_) | 2090 for (auto& layer : *layers_) |
| 2077 layer->ResetChangeTracking(); | 2091 layer->ResetChangeTracking(); |
| 2078 property_trees_.ResetAllChangeTracking(); | 2092 property_trees_.ResetAllChangeTracking(); |
| 2079 } | 2093 } |
| 2080 | 2094 |
| 2081 } // namespace cc | 2095 } // namespace cc |
| OLD | NEW |