Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Unified Diff: cc/layers/scrollbar_layer.cc

Issue 17550008: Make IsSolidColor() a property on CC scrollbar layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Jochen's comments. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/scrollbar_layer.cc
diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc
index f2c46a82202a200833511ae8750b4f5b44a637e4..5743ccbe302c626d6d32ecb946978aa3835ee9f4 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);
@@ -65,7 +70,7 @@ int ScrollbarLayer::MaxTextureSize() {
}
float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (is_solid_color())
return scale;
// If the scaled content_bounds() is bigger than the max texture size of the
@@ -104,8 +109,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() && is_solid_color()) {
int thickness_override =
layer_tree_host()->settings().solid_color_scrollbar_thickness_dip;
if (thickness_override != -1) {
@@ -127,6 +131,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(is_solid_color());
if (track_ && track_->texture()->have_backing_texture())
scrollbar_layer->set_track_resource_id(track_->texture()->resource_id());
@@ -174,7 +179,7 @@ class ScrollbarPartPainter : public LayerPainter {
};
void ScrollbarLayer::CreateUpdaterIfNeeded() {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (is_solid_color())
return;
texture_format_ =
@@ -211,7 +216,7 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
LayerUpdater::Resource* resource,
gfx::Rect rect,
ResourceUpdateQueue* queue) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (is_solid_color())
return;
// Skip painting and uploading if there are no invalidations and
@@ -265,7 +270,7 @@ gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
void ScrollbarLayer::SetTexturePriorities(
const PriorityCalculator& priority_calc) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (is_solid_color())
return;
if (content_bounds().IsEmpty())
@@ -293,7 +298,7 @@ void ScrollbarLayer::Update(ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion) {
track_rect_ = scrollbar_->TrackRect();
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (is_solid_color())
return;
{

Powered by Google App Engine
This is Rietveld 408576698