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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Address reviewer comments, pull element_id.h change to another patch 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 6ac6ecf20478ef3713fb1e754d9dfa010781c11d..62e63b3ac94f16eadd6894016e0ef78d8858da03 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -274,8 +274,8 @@ void LayerTreeImpl::UpdateScrollbars(int scroll_layer_id, int clip_layer_id) {
if (scrollbar_needs_animation) {
ScrollbarAnimationController* controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForId(
- scroll_layer_id);
+ layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
+ scroll_layer->element_id());
if (!controller)
return;
@@ -552,7 +552,8 @@ void LayerTreeImpl::ShowScrollbars() {
if (!layer->needs_show_scrollbars())
return;
ScrollbarAnimationController* controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForId(layer->id());
+ layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
+ layer->element_id());
if (controller) {
controller->DidRequestShowFromMainThread();
layer->set_needs_show_scrollbars(false);
@@ -736,14 +737,12 @@ void LayerTreeImpl::SetCurrentlyScrollingNode(ScrollNode* node) {
if (old_element_id == new_element_id)
return;
- // TODO(pdr): Make the scrollbar animation controller lookup based on
- // element ids instead of layer ids.
ScrollbarAnimationController* old_animation_controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForId(
- LayerIdByElementId(old_element_id));
+ layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
+ old_element_id);
ScrollbarAnimationController* new_animation_controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForId(
- LayerIdByElementId(new_element_id));
+ layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
+ new_element_id);
if (old_animation_controller)
old_animation_controller->DidScrollEnd();
@@ -1726,9 +1725,11 @@ void LayerTreeImpl::RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer) {
scrollbar_map_.insert(std::pair<int, int>(scrollbar_layer->ScrollLayerId(),
scrollbar_layer->id()));
- if (IsActiveTree() && scrollbar_layer->is_overlay_scrollbar())
+ if (IsActiveTree() && scrollbar_layer->is_overlay_scrollbar()) {
+ auto scroll_layer_id = scrollbar_layer->ScrollLayerId();
layer_tree_host_impl_->RegisterScrollbarAnimationController(
- scrollbar_layer->ScrollLayerId());
+ scroll_layer_id, scrollbar_layer->scroll_element_id());
+ }
DidUpdateScrollState(scrollbar_layer->ScrollLayerId());
}
@@ -1746,9 +1747,10 @@ void LayerTreeImpl::UnregisterScrollbar(
break;
}
- if (IsActiveTree() && scrollbar_map_.count(scroll_layer_id) == 0)
+ if (IsActiveTree() && scrollbar_map_.count(scroll_layer_id) == 0) {
layer_tree_host_impl_->UnregisterScrollbarAnimationController(
- scroll_layer_id);
+ scrollbar_layer->scroll_element_id());
+ }
}
ScrollbarSet LayerTreeImpl::ScrollbarsFor(int scroll_layer_id) const {
« cc/layers/scrollbar_layer_impl_base.cc ('K') | « cc/trees/layer_tree_host_unittest_damage.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698