Compute solid-color scrollbar properties on all platforms.

It's unnecessary to gate solid-color scrollbar properties on whether
the root container masks to bounds, since the vertical adjust should
resolve to zero in this case anyway.  It's necessary to set VisibleToTotalLengthRatio
for desktop overlay scrollbars to be sized correctly.

BUG=331605
TEST=None
R=aelias

Review URL: https://codereview.chromium.org/106733005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243721 0039d316-1c4b-4281-b951-d872f2087c98
parent 7049bab8
...@@ -169,6 +169,10 @@ float PaintedScrollbarLayerImpl::TrackLength() const { ...@@ -169,6 +169,10 @@ float PaintedScrollbarLayerImpl::TrackLength() const {
return track_length_ + (orientation() == VERTICAL ? vertical_adjust() : 0); return track_length_ + (orientation() == VERTICAL ? vertical_adjust() : 0);
} }
bool PaintedScrollbarLayerImpl::IsThumbResizable() const {
return false;
}
const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const {
return "cc::PaintedScrollbarLayerImpl"; return "cc::PaintedScrollbarLayerImpl";
} }
......
...@@ -55,6 +55,7 @@ class CC_EXPORT PaintedScrollbarLayerImpl : public ScrollbarLayerImplBase { ...@@ -55,6 +55,7 @@ class CC_EXPORT PaintedScrollbarLayerImpl : public ScrollbarLayerImplBase {
virtual int ThumbLength() const OVERRIDE; virtual int ThumbLength() const OVERRIDE;
virtual float TrackLength() const OVERRIDE; virtual float TrackLength() const OVERRIDE;
virtual int TrackStart() const OVERRIDE; virtual int TrackStart() const OVERRIDE;
virtual bool IsThumbResizable() const OVERRIDE;
private: private:
virtual const char* LayerTypeAsString() const OVERRIDE; virtual const char* LayerTypeAsString() const OVERRIDE;
......
...@@ -66,6 +66,9 @@ void ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) { ...@@ -66,6 +66,9 @@ void ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) {
} }
void ScrollbarLayerImplBase::SetVisibleToTotalLengthRatio(float ratio) { void ScrollbarLayerImplBase::SetVisibleToTotalLengthRatio(float ratio) {
if (!IsThumbResizable())
return;
if (visible_to_total_length_ratio_ == ratio) if (visible_to_total_length_ratio_ == ratio)
return; return;
visible_to_total_length_ratio_ = ratio; visible_to_total_length_ratio_ = ratio;
......
...@@ -64,6 +64,9 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { ...@@ -64,6 +64,9 @@ class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl {
virtual int ThumbLength() const = 0; virtual int ThumbLength() const = 0;
virtual float TrackLength() const = 0; virtual float TrackLength() const = 0;
virtual int TrackStart() const = 0; virtual int TrackStart() const = 0;
// Indicates whether the thumb length can be changed without going back to the
// main thread.
virtual bool IsThumbResizable() const = 0;
private: private:
int scroll_layer_id_; int scroll_layer_id_;
......
...@@ -72,6 +72,10 @@ int SolidColorScrollbarLayerImpl::TrackStart() const { ...@@ -72,6 +72,10 @@ int SolidColorScrollbarLayerImpl::TrackStart() const {
return 0; return 0;
} }
bool SolidColorScrollbarLayerImpl::IsThumbResizable() const {
return true;
}
void SolidColorScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink, void SolidColorScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) { AppendQuadsData* append_quads_data) {
gfx::Rect thumb_quad_rect = ComputeThumbQuadRect(); gfx::Rect thumb_quad_rect = ComputeThumbQuadRect();
......
...@@ -41,6 +41,7 @@ class CC_EXPORT SolidColorScrollbarLayerImpl : public ScrollbarLayerImplBase { ...@@ -41,6 +41,7 @@ class CC_EXPORT SolidColorScrollbarLayerImpl : public ScrollbarLayerImplBase {
virtual int ThumbLength() const OVERRIDE; virtual int ThumbLength() const OVERRIDE;
virtual float TrackLength() const OVERRIDE; virtual float TrackLength() const OVERRIDE;
virtual int TrackStart() const OVERRIDE; virtual int TrackStart() const OVERRIDE;
virtual bool IsThumbResizable() const OVERRIDE;
private: private:
int thumb_thickness_; int thumb_thickness_;
......
...@@ -353,11 +353,8 @@ void LayerTreeImpl::UpdateDrawProperties() { ...@@ -353,11 +353,8 @@ void LayerTreeImpl::UpdateDrawProperties() {
if (IsActiveTree() && RootScrollLayer() && RootContainerLayer()) if (IsActiveTree() && RootScrollLayer() && RootContainerLayer())
UpdateRootScrollLayerSizeDelta(); UpdateRootScrollLayerSizeDelta();
if (IsActiveTree() && if (IsActiveTree() && RootContainerLayer())
RootContainerLayer()
&& !RootContainerLayer()->masks_to_bounds()) {
UpdateSolidColorScrollbars(); UpdateSolidColorScrollbars();
}
needs_update_draw_properties_ = false; needs_update_draw_properties_ = false;
render_surface_layer_list_.clear(); render_surface_layer_list_.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment