Chromium Code Reviews| Index: cc/layers/scrollbar_layer_impl.cc |
| diff --git a/cc/layers/scrollbar_layer_impl.cc b/cc/layers/scrollbar_layer_impl.cc |
| index 4160bf0f5b4ff800e480e0312fbc3227174da93b..6c81d2fa38681a2c14d8e28579053fdf342d9685 100644 |
| --- a/cc/layers/scrollbar_layer_impl.cc |
| +++ b/cc/layers/scrollbar_layer_impl.cc |
| @@ -18,16 +18,19 @@ namespace cc { |
| scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::Create( |
| LayerTreeImpl* tree_impl, |
| int id, |
| - ScrollbarOrientation orientation) { |
| + ScrollbarOrientation orientation, |
| + bool is_solid_color) { |
| return make_scoped_ptr(new ScrollbarLayerImpl(tree_impl, |
| id, |
| - orientation)); |
| + orientation, |
| + is_solid_color)); |
| } |
| ScrollbarLayerImpl::ScrollbarLayerImpl( |
| LayerTreeImpl* tree_impl, |
| int id, |
| - ScrollbarOrientation orientation) |
| + ScrollbarOrientation orientation, |
| + bool is_solid_color) |
| : LayerImpl(tree_impl, id), |
| track_resource_id_(0), |
| thumb_resource_id_(0), |
| @@ -45,7 +48,9 @@ ScrollbarLayerImpl::ScrollbarLayerImpl( |
| is_scroll_view_scrollbar_(false), |
| enabled_(false), |
| is_custom_scrollbar_(false), |
| - is_overlay_scrollbar_(false) {} |
| + is_overlay_scrollbar_(false), |
| + is_solid_color_(is_solid_color) { |
| +} |
| ScrollbarLayerImpl::~ScrollbarLayerImpl() {} |
| @@ -55,9 +60,8 @@ ScrollbarLayerImpl* ScrollbarLayerImpl::ToScrollbarLayer() { |
| scoped_ptr<LayerImpl> ScrollbarLayerImpl::CreateLayerImpl( |
| LayerTreeImpl* tree_impl) { |
| - return ScrollbarLayerImpl::Create(tree_impl, |
| - id(), |
| - orientation_).PassAs<LayerImpl>(); |
| + return ScrollbarLayerImpl::Create( |
| + tree_impl, id(), orientation_, is_solid_color_).PassAs<LayerImpl>(); |
| } |
| void ScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| @@ -65,6 +69,8 @@ void ScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer); |
| + scrollbar_layer->set_is_solid_color(is_solid_color_); |
| + |
| scrollbar_layer->set_thumb_thickness(thumb_thickness_); |
| scrollbar_layer->set_thumb_length(thumb_length_); |
| scrollbar_layer->set_track_start(track_start_); |
| @@ -77,7 +83,7 @@ void ScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| bool ScrollbarLayerImpl::WillDraw(DrawMode draw_mode, |
| ResourceProvider* resource_provider) { |
| if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE && |
| - !layer_tree_impl()->settings().solid_color_scrollbars) |
| + !is_solid_color()) |
|
jamesr
2013/07/03 21:26:24
no need to use a getter here, just access the bool
|
| return false; |
| return LayerImpl::WillDraw(draw_mode, resource_provider); |
| } |
| @@ -97,7 +103,7 @@ void ScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink, |
| gfx::Rect thumb_quad_rect = ComputeThumbQuadRect(); |
| - if (layer_tree_impl()->settings().solid_color_scrollbars) { |
| + if (is_solid_color()) { |
|
jamesr
2013/07/03 21:26:24
ditto
|
| scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
| quad->SetNew(shared_quad_state, |
| thumb_quad_rect, |
| @@ -151,6 +157,14 @@ ScrollbarOrientation ScrollbarLayerImpl::Orientation() const { |
| return orientation_; |
| } |
| +bool ScrollbarLayerImpl::is_solid_color() const { |
| + return is_solid_color_; |
| +} |
| + |
| +void ScrollbarLayerImpl::set_is_solid_color(bool is_solid_color) { |
| + is_solid_color_ = is_solid_color; |
| +} |
| + |
| float ScrollbarLayerImpl::CurrentPos() const { |
| return current_pos_; |
| } |
| @@ -235,7 +249,7 @@ gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const { |
| if (orientation_ == VERTICAL) |
| track_length += vertical_adjust_; |
| - if (layer_tree_impl()->settings().solid_color_scrollbars) { |
| + if (is_solid_color()) { |
|
jamesr
2013/07/03 21:26:24
ditto
|
| thumb_length = std::max( |
| static_cast<int>(visible_to_total_length_ratio_ * track_length), |
| thumb_thickness_); |