Index: cc/layers/painted_scrollbar_layer.cc |
diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc |
index 7062bc1e9bade7910cde353e5be9697cd9922e80..b372ff480384d665cffc43fb886fd4aeddd44ed0 100644 |
--- a/cc/layers/painted_scrollbar_layer.cc |
+++ b/cc/layers/painted_scrollbar_layer.cc |
@@ -130,8 +130,12 @@ void PaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
if (track_resource_.get()) |
scrollbar_layer->set_track_ui_resource_id(track_resource_->id()); |
+ else |
+ scrollbar_layer->set_track_ui_resource_id(0); |
if (thumb_resource_.get()) |
scrollbar_layer->set_thumb_ui_resource_id(thumb_resource_->id()); |
+ else |
+ scrollbar_layer->set_thumb_ui_resource_id(0); |
scrollbar_layer->set_is_overlay_scrollbar(is_overlay_); |
} |
@@ -205,9 +209,24 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, |
gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); |
gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( |
track_layer_rect); |
+ bool needs_update = false; |
danakj
2014/09/11 20:12:56
nit: updated
MuVen
2014/09/12 14:09:12
Done.
|
+ if (track_rect_.IsEmpty() || scaled_track_rect.IsEmpty()) { |
+ if (track_resource_) { |
+ track_resource_.reset(); |
+ if (thumb_resource_) |
+ thumb_resource_.reset(); |
+ SetNeedsPushProperties(); |
+ needs_update = true; |
+ } |
+ return needs_update; |
+ } |
- if (track_rect_.IsEmpty() || scaled_track_rect.IsEmpty()) |
- return false; |
+ if (!has_thumb_ && thumb_resource_) { |
+ thumb_resource_.reset(); |
+ SetNeedsPushProperties(); |
+ needs_update = true; |
+ return needs_update; |
danakj
2014/09/11 20:12:56
not supposed to return here, you have a track rect
MuVen
2014/09/12 14:09:12
Done.
On 2014/09/11 20:12:56, danakj wrote:
|
+ } |
{ |
base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, |
@@ -216,7 +235,7 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, |
} |
if (update_rect_.IsEmpty() && track_resource_) |
- return false; |
+ return needs_update; |
track_resource_ = ScopedUIResource::Create( |
layer_tree_host(), |
@@ -233,7 +252,8 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, |
// UI resources changed so push properties is needed. |
SetNeedsPushProperties(); |
- return true; |
+ needs_update = true; |
+ return needs_update; |
} |
UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart( |