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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Fix flaky LayerTreeHostImplTestScrollbarOpacity.Android 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 f7f0304ee5f74064c75be4de70aa691da4cd3487..cd6e766b2e34f04d5f6345b8092a3685d7824c5d 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -275,7 +275,7 @@ 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);
+ 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_->ScrollbarAnimationControllerForId(
+ layer->element_id());
if (controller) {
controller->DidRequestShowFromMainThread();
layer->set_needs_show_scrollbars(false);
@@ -736,14 +737,10 @@ 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_->ScrollbarAnimationControllerForId(old_element_id);
wkorman 2017/04/14 18:17:30 Future change -- suggest renaming this method to q
pdr. 2017/04/15 06:02:00 +1, going to include that in this change since we
ScrollbarAnimationController* new_animation_controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForId(
- LayerIdByElementId(new_element_id));
+ layer_tree_host_impl_->ScrollbarAnimationControllerForId(new_element_id);
if (old_animation_controller)
old_animation_controller->DidScrollEnd();
@@ -1727,9 +1724,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->ScrollElementId());
+ }
DidUpdateScrollState(scrollbar_layer->ScrollLayerId());
}
@@ -1747,9 +1746,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->ScrollElementId());
+ }
}
ScrollbarSet LayerTreeImpl::ScrollbarsFor(int scroll_layer_id) const {
« cc/layers/scrollbar_layer_interface.h ('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