Chromium Code Reviews| Index: cc/layers/scrollbar_layer.cc |
| diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc |
| index 30e2a93ba5bf453eba0b0d1bcff9965f9dfeacab..3ba1d2384d87ac3987db3977925104d83805ef74 100644 |
| --- a/cc/layers/scrollbar_layer.cc |
| +++ b/cc/layers/scrollbar_layer.cc |
| @@ -21,21 +21,26 @@ namespace cc { |
| scoped_ptr<LayerImpl> ScrollbarLayer::CreateLayerImpl( |
| LayerTreeImpl* tree_impl) { |
| return ScrollbarLayerImpl::Create( |
| - tree_impl, id(), scrollbar_->Orientation()).PassAs<LayerImpl>(); |
| + tree_impl, id(), scrollbar_->Orientation(), is_solid_color_) |
| + .PassAs<LayerImpl>(); |
| } |
| scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create( |
| scoped_ptr<Scrollbar> scrollbar, |
| - int scroll_layer_id) { |
| + int scroll_layer_id, |
| + bool is_solid_color) { |
| return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), |
| - scroll_layer_id)); |
| + scroll_layer_id, |
| + is_solid_color)); |
| } |
| ScrollbarLayer::ScrollbarLayer( |
| scoped_ptr<Scrollbar> scrollbar, |
| - int scroll_layer_id) |
| + int scroll_layer_id, |
| + bool is_solid_color) |
| : scrollbar_(scrollbar.Pass()), |
| scroll_layer_id_(scroll_layer_id), |
| + is_solid_color_(is_solid_color), |
| texture_format_(GL_INVALID_ENUM) { |
| if (!scrollbar_->IsOverlay()) |
| SetShouldScrollOnMainThread(true); |
| @@ -59,13 +64,19 @@ ScrollbarOrientation ScrollbarLayer::Orientation() const { |
| return scrollbar_->Orientation(); |
| } |
| +bool ScrollbarLayer::IsSolidColor() const { |
| + return is_solid_color_ || |
| + (layer_tree_host() && |
|
aelias_OOO_until_Jul13
2013/06/21 23:34:35
Please DCHECK(layer_tree_host()) instead.
wjmaclean
2013/06/24 14:06:41
Actually, the only reason it's there is that there
aelias_OOO_until_Jul13
2013/06/25 06:54:57
Can we fix the unit tests instead? I feel this pr
|
| + layer_tree_host()->settings().force_solid_color_scrollbars); |
| +} |
| + |
| int ScrollbarLayer::MaxTextureSize() { |
| DCHECK(layer_tree_host()); |
| return layer_tree_host()->GetRendererCapabilities().max_texture_size; |
| } |
| float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) { |
| - if (layer_tree_host()->settings().solid_color_scrollbars) |
| + if (IsSolidColor()) |
| return scale; |
| // If the scaled content_bounds() is bigger than the max texture size of the |
| @@ -104,8 +115,7 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
| ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer); |
| - if (layer_tree_host() && |
| - layer_tree_host()->settings().solid_color_scrollbars) { |
| + if (layer_tree_host() && IsSolidColor()) { |
| int thickness_override = |
| layer_tree_host()->settings().solid_color_scrollbar_thickness_dip; |
| if (thickness_override != -1) { |
| @@ -127,6 +137,7 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
| scrollbar_layer->set_track_start(track_rect_.y()); |
| scrollbar_layer->set_track_length(track_rect_.height()); |
| } |
| + scrollbar_layer->set_is_solid_color(IsSolidColor()); |
| if (track_ && track_->texture()->have_backing_texture()) |
| scrollbar_layer->set_track_resource_id(track_->texture()->resource_id()); |
| @@ -174,7 +185,7 @@ class ScrollbarPartPainter : public LayerPainter { |
| }; |
| void ScrollbarLayer::CreateUpdaterIfNeeded() { |
| - if (layer_tree_host()->settings().solid_color_scrollbars) |
| + if (IsSolidColor()) |
| return; |
| texture_format_ = |
| @@ -212,7 +223,7 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter, |
| gfx::Rect rect, |
| ResourceUpdateQueue* queue, |
| RenderingStats* stats) { |
| - if (layer_tree_host()->settings().solid_color_scrollbars) |
| + if (IsSolidColor()) |
| return; |
| // Skip painting and uploading if there are no invalidations and |
| @@ -267,7 +278,7 @@ gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( |
| void ScrollbarLayer::SetTexturePriorities( |
| const PriorityCalculator& priority_calc) { |
| - if (layer_tree_host()->settings().solid_color_scrollbars) |
| + if (IsSolidColor()) |
| return; |
| if (content_bounds().IsEmpty()) |
| @@ -296,7 +307,7 @@ void ScrollbarLayer::Update(ResourceUpdateQueue* queue, |
| RenderingStats* stats) { |
| track_rect_ = scrollbar_->TrackRect(); |
| - if (layer_tree_host()->settings().solid_color_scrollbars) |
| + if (IsSolidColor()) |
| return; |
| { |