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

Unified Diff: cc/layers/scrollbar_layer_impl_base.cc

Issue 2827163005: Remove scroll layer ids from scrollbar layers (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.h ('k') | cc/layers/scrollbar_layer_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_impl_base.cc
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc
index e9c5514d5f9022fd7c57c9466f7f7d2ba449a586..a4981e95b2d75cbe9bf891152c788b6ac1da2985 100644
--- a/cc/layers/scrollbar_layer_impl_base.cc
+++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -18,7 +18,6 @@ ScrollbarLayerImplBase::ScrollbarLayerImplBase(
bool is_left_side_vertical_scrollbar,
bool is_overlay)
: LayerImpl(tree_impl, id),
- scroll_layer_id_(Layer::INVALID_ID),
is_overlay_scrollbar_(is_overlay),
thumb_thickness_scale_factor_(1.f),
current_pos_(0.f),
@@ -36,25 +35,19 @@ void ScrollbarLayerImplBase::PushPropertiesTo(LayerImpl* layer) {
LayerImpl::PushPropertiesTo(layer);
DCHECK(layer->ToScrollbarLayer());
layer->ToScrollbarLayer()->set_is_overlay_scrollbar(is_overlay_scrollbar_);
- layer->ToScrollbarLayer()->SetScrollInfo(ScrollLayerId(),
- scroll_element_id());
+ layer->ToScrollbarLayer()->SetScrollElementId(scroll_element_id());
}
ScrollbarLayerImplBase* ScrollbarLayerImplBase::ToScrollbarLayer() {
return this;
}
-void ScrollbarLayerImplBase::SetScrollInfo(int scroll_layer_id,
- ElementId scroll_element_id) {
- if (scroll_layer_id_ == scroll_layer_id &&
- scroll_element_id == scroll_element_id)
+void ScrollbarLayerImplBase::SetScrollElementId(ElementId scroll_element_id) {
+ if (scroll_element_id_ == scroll_element_id)
wkorman 2017/04/20 17:53:47 Can we add a unit test that would have caught this
return;
layer_tree_impl()->UnregisterScrollbar(this);
-
- scroll_layer_id_ = scroll_layer_id;
scroll_element_id_ = scroll_element_id;
-
layer_tree_impl()->RegisterScrollbar(this);
}
@@ -67,7 +60,10 @@ bool ScrollbarLayerImplBase::SetCurrentPos(float current_pos) {
}
bool ScrollbarLayerImplBase::CanScrollOrientation() const {
- LayerImpl* scroll_layer = layer_tree_impl()->LayerById(scroll_layer_id_);
+ // TODO(pdr): Refactor this to not depend on layers by using the associated
+ // scroll node's user_scrollable values.
+ LayerImpl* scroll_layer =
+ layer_tree_impl()->LayerByElementId(scroll_element_id_);
if (!scroll_layer)
return false;
return scroll_layer->user_scrollable(orientation()) &&
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.h ('k') | cc/layers/scrollbar_layer_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698