| Index: cc/layers/scrollbar_layer_impl.cc
|
| diff --git a/cc/layers/scrollbar_layer_impl.cc b/cc/layers/scrollbar_layer_impl.cc
|
| index b8da4b65cfd362c441fae3b0ddc35dd306d2f4e9..091b2af004e3cfeee8fcaa10c71c3e0601117f66 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_);
|
| @@ -78,7 +84,7 @@ bool ScrollbarLayerImpl::WillDraw(DrawMode draw_mode,
|
| ResourceProvider* resource_provider) {
|
| LayerImpl::WillDraw(draw_mode, resource_provider);
|
| return draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE ||
|
| - layer_tree_impl()->settings().solid_color_scrollbars;
|
| + is_solid_color();
|
| }
|
|
|
| void ScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink,
|
| @@ -96,7 +102,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()) {
|
| scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
|
| quad->SetNew(shared_quad_state,
|
| thumb_quad_rect,
|
| @@ -150,6 +156,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_;
|
| }
|
| @@ -234,7 +248,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()) {
|
| thumb_length = std::max(
|
| static_cast<int>(visible_to_total_length_ratio_ * track_length),
|
| thumb_thickness_);
|
|
|