new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer_id));
}
-PaintedScrollbarLayer::PaintedScrollbarLayer(
- scoped_ptr<Scrollbar> scrollbar,
- int scroll_layer_id)
+PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar,
+ int scroll_layer_id)
: scrollbar_(scrollbar.Pass()),
scroll_layer_id_(scroll_layer_id),
+ clip_layer_id_(Layer::INVALID_ID),
thumb_thickness_(scrollbar_->ThumbThickness()),
thumb_length_(scrollbar_->ThumbLength()),
is_overlay_(scrollbar_->IsOverlay()),
return scroll_layer_id_;
}
-void PaintedScrollbarLayer::SetScrollLayerId(int id) {
- if (id == scroll_layer_id_)
+void PaintedScrollbarLayer::SetScrollLayer(int layer_id) {
+ if (layer_id == scroll_layer_id_)
+ return;
+
+ scroll_layer_id_ = layer_id;
+ SetNeedsFullTreeSync();
+}
+
+void PaintedScrollbarLayer::SetClipLayer(int layer_id) {
+ if (layer_id == clip_layer_id_)
return;
- scroll_layer_id_ = id;
+ clip_layer_id_ = layer_id;
SetNeedsFullTreeSync();
}
void PaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
ContentsScalingLayer::PushPropertiesTo(layer);
+ PushScrollClipPropertiesTo(layer);
+
PaintedScrollbarLayerImpl* scrollbar_layer =
static_cast<PaintedScrollbarLayerImpl*>(layer);
return this;
}
+void PaintedScrollbarLayer::PushScrollClipPropertiesTo(LayerImpl* layer) {
+ PaintedScrollbarLayerImpl* scrollbar_layer =
+ static_cast<PaintedScrollbarLayerImpl*>(layer);
+
+ scrollbar_layer->SetScrollLayerById(scroll_layer_id_);
+ scrollbar_layer->SetClipLayerById(clip_layer_id_);
+}
+
void PaintedScrollbarLayer::SetLayerTreeHost(LayerTreeHost* host) {
// When the LTH is set to null or has changed, then this layer should remove
// all of its associated resources.