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..029da1183f6fb146ef25f4638f1da17b8d503614 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; |
+ IsSolidColor(); |
} |
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 (IsSolidColor()) { |
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
quad->SetNew(shared_quad_state, |
thumb_quad_rect, |
@@ -150,6 +156,16 @@ ScrollbarOrientation ScrollbarLayerImpl::Orientation() const { |
return orientation_; |
} |
+bool ScrollbarLayerImpl::IsSolidColor() const { |
+ return is_solid_color_ || |
+ (layer_tree_impl() && |
aelias_OOO_until_Jul13
2013/06/21 23:34:35
DCHECK(layer_tree_impl()). (Or you could just get
wjmaclean
2013/06/24 14:06:41
I thought about pushing it as a property, though I
|
+ layer_tree_impl()->settings().force_solid_color_scrollbars); |
+} |
+ |
+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 +250,7 @@ gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const { |
if (orientation_ == VERTICAL) |
track_length += vertical_adjust_; |
- if (layer_tree_impl()->settings().solid_color_scrollbars) { |
+ if (IsSolidColor()) { |
thumb_length = std::max( |
static_cast<int>(visible_to_total_length_ratio_ * track_length), |
thumb_thickness_); |