| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 outer_container->bounds_delta()); | 429 outer_container->bounds_delta()); |
| 430 if (inner_scroll) | 430 if (inner_scroll) |
| 431 property_trees_.SetInnerViewportScrollBoundsDelta( | 431 property_trees_.SetInnerViewportScrollBoundsDelta( |
| 432 inner_scroll->bounds_delta()); | 432 inner_scroll->bounds_delta()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { | 435 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { |
| 436 // The request queue should have been processed and does not require a push. | 436 // The request queue should have been processed and does not require a push. |
| 437 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 437 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
| 438 | 438 |
| 439 // To maintain the correct currently scrolling node we need to use layer ids | 439 // To maintain the current scrolling node we need to use element ids which |
| 440 // which are stable across the property tree update in SetPropertyTrees. | 440 // are stable across the property tree update in SetPropertyTrees. |
| 441 // TODO(pdr): Remove the use of owning_layer_id. | 441 ElementId scrolling_element_id; |
| 442 int scrolling_layer_id = Layer::INVALID_ID; | 442 if (ScrollNode* scrolling_node = target_tree->CurrentlyScrollingNode()) |
| 443 if (ScrollNode* node = target_tree->CurrentlyScrollingNode()) | 443 scrolling_element_id = scrolling_node->element_id; |
| 444 scrolling_layer_id = node->owning_layer_id; | |
| 445 | 444 |
| 446 target_tree->SetPropertyTrees(&property_trees_); | 445 target_tree->SetPropertyTrees(&property_trees_); |
| 447 | 446 |
| 448 ScrollNode* scrolling_node = nullptr; | 447 ScrollNode* scrolling_node = nullptr; |
| 449 auto& scroll_node_index_map = | 448 if (scrolling_element_id) { |
| 450 target_tree->property_trees()->layer_id_to_scroll_node_index; | 449 auto& scroll_node_index_map = |
| 451 auto scrolling_node_it = scroll_node_index_map.find(scrolling_layer_id); | 450 target_tree->property_trees()->element_id_to_scroll_node_index; |
| 452 if (scrolling_node_it != scroll_node_index_map.end()) { | 451 auto scrolling_node_it = scroll_node_index_map.find(scrolling_element_id); |
| 453 int index = scrolling_node_it->second; | 452 if (scrolling_node_it != scroll_node_index_map.end()) { |
| 454 scrolling_node = target_tree->property_trees()->scroll_tree.Node(index); | 453 int index = scrolling_node_it->second; |
| 454 scrolling_node = target_tree->property_trees()->scroll_tree.Node(index); |
| 455 } |
| 455 } | 456 } |
| 456 target_tree->SetCurrentlyScrollingNode(scrolling_node); | 457 target_tree->SetCurrentlyScrollingNode(scrolling_node); |
| 457 | 458 |
| 458 target_tree->property_trees()->scroll_tree.PushScrollUpdatesFromPendingTree( | 459 target_tree->property_trees()->scroll_tree.PushScrollUpdatesFromPendingTree( |
| 459 &property_trees_, target_tree); | 460 &property_trees_, target_tree); |
| 460 | 461 |
| 461 // This needs to be called early so that we don't clamp with incorrect max | 462 // This needs to be called early so that we don't clamp with incorrect max |
| 462 // offsets when UpdateViewportContainerSizes is called from e.g. | 463 // offsets when UpdateViewportContainerSizes is called from e.g. |
| 463 // PushBrowserControls | 464 // PushBrowserControls |
| 464 target_tree->UpdatePropertyTreesForBoundsDelta(); | 465 target_tree->UpdatePropertyTreesForBoundsDelta(); |
| (...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 | 2135 |
| 2135 void LayerTreeImpl::ResetAllChangeTracking() { | 2136 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2136 layers_that_should_push_properties_.clear(); | 2137 layers_that_should_push_properties_.clear(); |
| 2137 // Iterate over all layers, including masks. | 2138 // Iterate over all layers, including masks. |
| 2138 for (auto& layer : *layers_) | 2139 for (auto& layer : *layers_) |
| 2139 layer->ResetChangeTracking(); | 2140 layer->ResetChangeTracking(); |
| 2140 property_trees_.ResetAllChangeTracking(); | 2141 property_trees_.ResetAllChangeTracking(); |
| 2141 } | 2142 } |
| 2142 | 2143 |
| 2143 } // namespace cc | 2144 } // namespace cc |
| OLD | NEW |