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

Unified Diff: cc/layers/painted_scrollbar_layer_impl.cc

Issue 913133004: cc: Make PaintedScrollbarLayer not use ContentsScalingLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix thumb rects under device scale Created 5 years, 10 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/painted_scrollbar_layer_impl.cc
diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc
index 068d42f2a5f626b255cb5c9c5b058a41f68bc64c..4ee997f247d4caafe380977f64239cb82c0b28d6 100644
--- a/cc/layers/painted_scrollbar_layer_impl.cc
+++ b/cc/layers/painted_scrollbar_layer_impl.cc
@@ -32,6 +32,7 @@ PaintedScrollbarLayerImpl::PaintedScrollbarLayerImpl(
: ScrollbarLayerImplBase(tree_impl, id, orientation, false, false),
track_ui_resource_id_(0),
thumb_ui_resource_id_(0),
+ internal_content_scale_(1.f),
thumb_thickness_(0),
thumb_length_(0),
track_start_(0),
@@ -51,6 +52,9 @@ void PaintedScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) {
PaintedScrollbarLayerImpl* scrollbar_layer =
static_cast<PaintedScrollbarLayerImpl*>(layer);
+ scrollbar_layer->set_internal_content_scale_and_bounds(
+ internal_content_scale_, internal_content_bounds_);
+
scrollbar_layer->SetThumbThickness(thumb_thickness_);
scrollbar_layer->SetThumbLength(thumb_length_);
scrollbar_layer->SetTrackStart(track_start_);
@@ -76,14 +80,14 @@ void PaintedScrollbarLayerImpl::AppendQuads(
gfx::PointF uv_top_left(0.f, 0.f);
gfx::PointF uv_bottom_right(1.f, 1.f);
gfx::Rect bounds_rect(bounds());
- gfx::Rect content_bounds_rect(content_bounds());
+ gfx::Rect content_bounds_rect(internal_content_bounds_);
SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
- PopulateSharedQuadState(shared_quad_state);
+ PopulateScaledSharedQuadState(shared_quad_state, internal_content_scale_);
- AppendDebugBorderQuad(
- render_pass, content_bounds(), shared_quad_state, append_quads_data);
+ AppendDebugBorderQuad(render_pass, internal_content_bounds_,
+ shared_quad_state, append_quads_data);
gfx::Rect thumb_quad_rect = ComputeThumbQuadRect();
gfx::Rect visible_thumb_quad_rect =
@@ -184,6 +188,11 @@ bool PaintedScrollbarLayerImpl::IsThumbResizable() const {
return false;
}
+gfx::Rect PaintedScrollbarLayerImpl::ComputeThumbQuadRect() const {
+ gfx::Rect thumb_quad_rect = ScrollbarLayerImplBase::ComputeThumbQuadRect();
+ return gfx::ScaleToEnclosingRect(thumb_quad_rect, internal_content_scale_);
+}
+
const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const {
return "cc::PaintedScrollbarLayerImpl";
}

Powered by Google App Engine
This is Rietveld 408576698