Index: cc/layers/painted_scrollbar_layer.cc |
diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc |
index 4466d58a3de7ac579aeb084aa4cd89287b5c7745..2a6865089f49f796e522dc43ff6a1de2e77af26f 100644 |
--- a/cc/layers/painted_scrollbar_layer.cc |
+++ b/cc/layers/painted_scrollbar_layer.cc |
@@ -28,16 +28,17 @@ scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( |
scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( |
scoped_ptr<Scrollbar> scrollbar, |
- int scroll_layer_id) { |
+ Layer* scroll_layer) { |
return make_scoped_refptr( |
- new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer_id)); |
+ new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer)); |
} |
PaintedScrollbarLayer::PaintedScrollbarLayer( |
scoped_ptr<Scrollbar> scrollbar, |
- int scroll_layer_id) |
+ Layer* scroll_layer) |
: scrollbar_(scrollbar.Pass()), |
- scroll_layer_id_(scroll_layer_id), |
+ scroll_layer_(scroll_layer), |
+ clip_layer_(NULL), |
thumb_thickness_(scrollbar_->ThumbThickness()), |
thumb_length_(scrollbar_->ThumbLength()), |
is_overlay_(scrollbar_->IsOverlay()), |
@@ -49,14 +50,22 @@ PaintedScrollbarLayer::PaintedScrollbarLayer( |
PaintedScrollbarLayer::~PaintedScrollbarLayer() {} |
int PaintedScrollbarLayer::ScrollLayerId() const { |
- return scroll_layer_id_; |
+ return scroll_layer_->id(); |
} |
-void PaintedScrollbarLayer::SetScrollLayerId(int id) { |
- if (id == scroll_layer_id_) |
+void PaintedScrollbarLayer::SetScrollLayer(scoped_refptr<Layer> layer) { |
+ if (layer == scroll_layer_) |
return; |
- scroll_layer_id_ = id; |
+ scroll_layer_ = layer; |
+ SetNeedsFullTreeSync(); |
+} |
+ |
+void PaintedScrollbarLayer::SetClipLayer(scoped_refptr<Layer> layer) { |
+ if (layer == clip_layer_) |
+ return; |
+ |
+ clip_layer_ = layer; |
SetNeedsFullTreeSync(); |
} |
@@ -109,6 +118,8 @@ void PaintedScrollbarLayer::CalculateContentsScale( |
void PaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
ContentsScalingLayer::PushPropertiesTo(layer); |
+ PushScrollClipPropertiesTo(layer); |
+ |
PaintedScrollbarLayerImpl* scrollbar_layer = |
static_cast<PaintedScrollbarLayerImpl*>(layer); |
@@ -136,6 +147,16 @@ ScrollbarLayerInterface* PaintedScrollbarLayer::ToScrollbarLayer() { |
return this; |
} |
+void PaintedScrollbarLayer::PushScrollClipPropertiesTo(LayerImpl* layer) { |
+ PaintedScrollbarLayerImpl* scrollbar_layer = |
+ static_cast<PaintedScrollbarLayerImpl*>(layer); |
+ |
+ scrollbar_layer->SetScrollLayerById(scroll_layer_ ? scroll_layer_->id() |
+ : Layer::INVALID_ID); |
+ scrollbar_layer->SetClipLayerById(clip_layer_ ? clip_layer_->id() |
+ : Layer::INVALID_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. |