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

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

Issue 2832743002: Add ScrollTree::FindNodeFromElementId (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | cc/trees/property_tree.h » ('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 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // To maintain the current scrolling node we need to use element ids which 452 // To maintain the current scrolling node we need to use element ids which
453 // are stable across the property tree update in SetPropertyTrees. 453 // are stable across the property tree update in SetPropertyTrees.
454 ElementId scrolling_element_id; 454 ElementId scrolling_element_id;
455 if (ScrollNode* scrolling_node = target_tree->CurrentlyScrollingNode()) 455 if (ScrollNode* scrolling_node = target_tree->CurrentlyScrollingNode())
456 scrolling_element_id = scrolling_node->element_id; 456 scrolling_element_id = scrolling_node->element_id;
457 457
458 target_tree->SetPropertyTrees(&property_trees_); 458 target_tree->SetPropertyTrees(&property_trees_);
459 459
460 ScrollNode* scrolling_node = nullptr; 460 ScrollNode* scrolling_node = nullptr;
461 if (scrolling_element_id) { 461 if (scrolling_element_id) {
462 auto& scroll_node_index_map = 462 auto& scroll_tree = target_tree->property_trees()->scroll_tree;
463 target_tree->property_trees()->element_id_to_scroll_node_index; 463 scrolling_node = scroll_tree.FindNodeFromElementId(scrolling_element_id);
464 auto scrolling_node_it = scroll_node_index_map.find(scrolling_element_id);
465 if (scrolling_node_it != scroll_node_index_map.end()) {
466 int index = scrolling_node_it->second;
467 scrolling_node = target_tree->property_trees()->scroll_tree.Node(index);
468 }
469 } 464 }
470 target_tree->SetCurrentlyScrollingNode(scrolling_node); 465 target_tree->SetCurrentlyScrollingNode(scrolling_node);
471 466
472 target_tree->property_trees()->scroll_tree.PushScrollUpdatesFromPendingTree( 467 target_tree->property_trees()->scroll_tree.PushScrollUpdatesFromPendingTree(
473 &property_trees_, target_tree); 468 &property_trees_, target_tree);
474 469
475 // This needs to be called early so that we don't clamp with incorrect max 470 // This needs to be called early so that we don't clamp with incorrect max
476 // offsets when UpdateViewportContainerSizes is called from e.g. 471 // offsets when UpdateViewportContainerSizes is called from e.g.
477 // PushBrowserControls 472 // PushBrowserControls
478 target_tree->UpdatePropertyTreesForBoundsDelta(); 473 target_tree->UpdatePropertyTreesForBoundsDelta();
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 2179
2185 void LayerTreeImpl::ResetAllChangeTracking() { 2180 void LayerTreeImpl::ResetAllChangeTracking() {
2186 layers_that_should_push_properties_.clear(); 2181 layers_that_should_push_properties_.clear();
2187 // Iterate over all layers, including masks. 2182 // Iterate over all layers, including masks.
2188 for (auto& layer : *layers_) 2183 for (auto& layer : *layers_)
2189 layer->ResetChangeTracking(); 2184 layer->ResetChangeTracking();
2190 property_trees_.ResetAllChangeTracking(); 2185 property_trees_.ResetAllChangeTracking();
2191 } 2186 }
2192 2187
2193 } // namespace cc 2188 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698