| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 int LayerTreeImpl::LastScrolledScrollNodeIndex() const { | 661 int LayerTreeImpl::LastScrolledScrollNodeIndex() const { |
| 662 return last_scrolled_scroll_node_index_; | 662 return last_scrolled_scroll_node_index_; |
| 663 } | 663 } |
| 664 | 664 |
| 665 void LayerTreeImpl::SetCurrentlyScrollingNode(ScrollNode* node) { | 665 void LayerTreeImpl::SetCurrentlyScrollingNode(ScrollNode* node) { |
| 666 if (node) | 666 if (node) |
| 667 last_scrolled_scroll_node_index_ = node->id; | 667 last_scrolled_scroll_node_index_ = node->id; |
| 668 | 668 |
| 669 ScrollTree& scroll_tree = property_trees()->scroll_tree; | 669 ScrollTree& scroll_tree = property_trees()->scroll_tree; |
| 670 ScrollNode* old_node = scroll_tree.CurrentlyScrollingNode(); | 670 ScrollNode* old_node = scroll_tree.CurrentlyScrollingNode(); |
| 671 // TODO(pdr): Refactor these to not use owning_layer_id. | 671 |
| 672 ElementId old_element_id = old_node ? old_node->element_id : ElementId(); |
| 673 ElementId new_element_id = node ? node->element_id : ElementId(); |
| 674 |
| 675 #if DCHECK_IS_ON() |
| 672 int old_layer_id = old_node ? old_node->owning_layer_id : Layer::INVALID_ID; | 676 int old_layer_id = old_node ? old_node->owning_layer_id : Layer::INVALID_ID; |
| 673 int new_layer_id = node ? node->owning_layer_id : Layer::INVALID_ID; | 677 int new_layer_id = node ? node->owning_layer_id : Layer::INVALID_ID; |
| 678 DCHECK(old_layer_id == LayerIdByElementId(old_element_id)); |
| 679 DCHECK(new_layer_id == LayerIdByElementId(new_element_id)); |
| 680 #endif |
| 674 | 681 |
| 675 if (old_layer_id == new_layer_id) | 682 if (old_element_id == new_element_id) |
| 676 return; | 683 return; |
| 677 | 684 |
| 685 // TODO(pdr): Make the scrollbar animation controller lookup based on |
| 686 // element ids instead of layer ids. |
| 678 ScrollbarAnimationController* old_animation_controller = | 687 ScrollbarAnimationController* old_animation_controller = |
| 679 layer_tree_host_impl_->ScrollbarAnimationControllerForId(old_layer_id); | 688 layer_tree_host_impl_->ScrollbarAnimationControllerForId( |
| 689 LayerIdByElementId(old_element_id)); |
| 680 ScrollbarAnimationController* new_animation_controller = | 690 ScrollbarAnimationController* new_animation_controller = |
| 681 layer_tree_host_impl_->ScrollbarAnimationControllerForId(new_layer_id); | 691 layer_tree_host_impl_->ScrollbarAnimationControllerForId( |
| 692 LayerIdByElementId(new_element_id)); |
| 682 | 693 |
| 683 if (old_animation_controller) | 694 if (old_animation_controller) |
| 684 old_animation_controller->DidScrollEnd(); | 695 old_animation_controller->DidScrollEnd(); |
| 685 scroll_tree.set_currently_scrolling_node(node ? node->id | 696 scroll_tree.set_currently_scrolling_node(node ? node->id |
| 686 : ScrollTree::kInvalidNodeId); | 697 : ScrollTree::kInvalidNodeId); |
| 687 if (new_animation_controller) | 698 if (new_animation_controller) |
| 688 new_animation_controller->DidScrollBegin(); | 699 new_animation_controller->DidScrollBegin(); |
| 689 } | 700 } |
| 690 | 701 |
| 691 void LayerTreeImpl::ClearCurrentlyScrollingNode() { | 702 void LayerTreeImpl::ClearCurrentlyScrollingNode() { |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 | 2149 |
| 2139 void LayerTreeImpl::ResetAllChangeTracking() { | 2150 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2140 layers_that_should_push_properties_.clear(); | 2151 layers_that_should_push_properties_.clear(); |
| 2141 // Iterate over all layers, including masks. | 2152 // Iterate over all layers, including masks. |
| 2142 for (auto& layer : *layers_) | 2153 for (auto& layer : *layers_) |
| 2143 layer->ResetChangeTracking(); | 2154 layer->ResetChangeTracking(); |
| 2144 property_trees_.ResetAllChangeTracking(); | 2155 property_trees_.ResetAllChangeTracking(); |
| 2145 } | 2156 } |
| 2146 | 2157 |
| 2147 } // namespace cc | 2158 } // namespace cc |
| OLD | NEW |