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

Unified Diff: cc/layers/scrollbar_layer.cc

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Enne's comments. Created 7 years, 4 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 4a6383504fc5750bb706b694764e664fff59309a..1efd55a0f4bdd3e57ed95e75781442863f7c7294 100644
--- a/cc/layers/scrollbar_layer.cc
+++ b/cc/layers/scrollbar_layer.cc
@@ -34,8 +34,9 @@ scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create(
ScrollbarLayer::ScrollbarLayer(
scoped_ptr<Scrollbar> scrollbar,
int scroll_layer_id)
- : scrollbar_(scrollbar.Pass()),
- scroll_layer_id_(scroll_layer_id),
+ : scroll_layer_id_(scroll_layer_id),
+ orientation_(scrollbar->Orientation()),
+ scrollbar_(scrollbar.Pass()),
texture_format_(GL_INVALID_ENUM) {
if (!scrollbar_->IsOverlay())
SetShouldScrollOnMainThread(true);
@@ -55,8 +56,8 @@ bool ScrollbarLayer::OpacityCanAnimateOnImplThread() const {
return scrollbar_->IsOverlay();
}
-ScrollbarOrientation ScrollbarLayer::Orientation() const {
- return scrollbar_->Orientation();
+ScrollbarLayerInterface* ScrollbarLayer::ToScrollbarLayer() {
+ return this;
}
int ScrollbarLayer::MaxTextureSize() {
@@ -64,10 +65,15 @@ int ScrollbarLayer::MaxTextureSize() {
return layer_tree_host()->GetRendererCapabilities().max_texture_size;
}
-float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
- return scale;
+int ScrollbarLayer::scroll_layer_id() const {
+ return scroll_layer_id_;
+}
+
+ScrollbarOrientation ScrollbarLayer::orientation() const {
+ return orientation_;
enne (OOO) 2013/08/14 21:01:09 Does this need a separate variable? What about jus
wjmaclean 2013/08/15 20:09:40 Done.
+}
+float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
// If the scaled content_bounds() is bigger than the max texture size of the
// device, we need to clamp it by rescaling, since content_bounds() is used
// below to set the texture size.
@@ -104,23 +110,9 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer);
- if (layer_tree_host() &&
- layer_tree_host()->settings().solid_color_scrollbars) {
- int thickness_override =
- layer_tree_host()->settings().solid_color_scrollbar_thickness_dip;
- if (thickness_override != -1) {
- scrollbar_layer->set_thumb_thickness(thickness_override);
- } else {
- if (Orientation() == HORIZONTAL)
- scrollbar_layer->set_thumb_thickness(bounds().height());
- else
- scrollbar_layer->set_thumb_thickness(bounds().width());
- }
- } else {
- scrollbar_layer->set_thumb_thickness(thumb_thickness_);
- }
+ scrollbar_layer->set_thumb_thickness(thumb_thickness_);
scrollbar_layer->set_thumb_length(thumb_length_);
- if (Orientation() == HORIZONTAL) {
+ if (orientation() == HORIZONTAL) {
scrollbar_layer->set_track_start(track_rect_.x());
scrollbar_layer->set_track_length(track_rect_.width());
} else {
@@ -144,10 +136,6 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
needs_push_properties_ = true;
}
-ScrollbarLayer* ScrollbarLayer::ToScrollbarLayer() {
- return this;
-}
-
void ScrollbarLayer::SetLayerTreeHost(LayerTreeHost* host) {
if (!host || host != layer_tree_host()) {
track_updater_ = NULL;
@@ -179,9 +167,6 @@ class ScrollbarPartPainter : public LayerPainter {
};
void ScrollbarLayer::CreateUpdaterIfNeeded() {
- if (layer_tree_host()->settings().solid_color_scrollbars)
- return;
-
texture_format_ =
layer_tree_host()->GetRendererCapabilities().best_texture_format;
@@ -216,9 +201,6 @@ bool ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
LayerUpdater::Resource* resource,
gfx::Rect rect,
ResourceUpdateQueue* queue) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
- return false;
-
// Skip painting and uploading if there are no invalidations and
// we already have valid texture data.
if (resource->texture()->have_backing_texture() &&
@@ -271,9 +253,6 @@ gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
void ScrollbarLayer::SetTexturePriorities(
const PriorityCalculator& priority_calc) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
- return;
-
if (content_bounds().IsEmpty())
return;
DCHECK_LE(content_bounds().width(), MaxTextureSize());
@@ -299,9 +278,7 @@ bool ScrollbarLayer::Update(ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion) {
track_rect_ = scrollbar_->TrackRect();
- if (layer_tree_host()->settings().solid_color_scrollbars)
- return false;
-
+ // WJM: is this specific to solid color scrollbars? probably!!
enne (OOO) 2013/08/14 21:01:09 This is in ScrollbarLayer, so no longer has anythi
wjmaclean 2013/08/15 20:09:40 Yeah, picked this one off in a recent rebase ... g
bool updated = false;
{
@@ -339,7 +316,7 @@ bool ScrollbarLayer::Update(ResourceUpdateQueue* queue,
gfx::Rect ScrollbarLayer::OriginThumbRect() const {
gfx::Size thumb_size;
- if (Orientation() == HORIZONTAL) {
+ if (orientation() == HORIZONTAL) {
thumb_size = gfx::Size(scrollbar_->ThumbLength(),
scrollbar_->ThumbThickness());
} else {

Powered by Google App Engine
This is Rietveld 408576698