158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// found in the LICENSE file. 458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ 658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ 758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "cc/base/cc_export.h" 958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "cc/input/scrollbar.h" 1058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "cc/layers/layer_impl.h" 1158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)namespace cc { 1358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 1458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class LayerTreeImpl; 1558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 1658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { 1758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) public: 1858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int ScrollLayerId() const { return scroll_layer_id_; } 1958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } 2058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 2158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float current_pos() const { return current_pos_; } 2258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void SetCurrentPos(float current_pos); 2358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int maximum() const { return maximum_; } 2458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void SetMaximum(int maximum); 2558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 2658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void SetVerticalAdjust(float vertical_adjust); 2758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 2858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } 2958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void set_is_overlay_scrollbar(bool is_overlay) { 3058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) is_overlay_scrollbar_ = is_overlay; 3158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) } 3258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 3358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) ScrollbarOrientation orientation() const { return orientation_; } 3458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool is_left_side_vertical_scrollbar() { 3558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) return is_left_side_vertical_scrollbar_; 3658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) } 3758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 3858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 3958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE; 4058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 4158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void SetVisibleToTotalLengthRatio(float ratio); 4258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual gfx::Rect ComputeThumbQuadRect() const; 4358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 4458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float thumb_thickness_scale_factor() { 4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) return thumb_thickness_scale_factor_; 4658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) } 471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void SetThumbThicknessScaleFactor(float thumb_thickness_scale_factor); 4858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 4958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) protected: 5058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, 5158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int id, 5258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) ScrollbarOrientation orientation, 5358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool is_left_side_vertical_scrollbar); 5458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual ~ScrollbarLayerImplBase() {} 5558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 5658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; 5758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 5858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float visible_to_total_length_ratio() const { 5958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) return visible_to_total_length_ratio_; 6058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) } 6158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float vertical_adjust() const { return vertical_adjust_; } 6258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 6358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual int ThumbThickness() const = 0; 6458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual int ThumbLength() const = 0; 6558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual float TrackLength() const = 0; 6658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual int TrackStart() const = 0; 6758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 6858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) private: 6958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int scroll_layer_id_; 7058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool is_overlay_scrollbar_; 7158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float thumb_thickness_scale_factor_; 7358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float current_pos_; 7458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int maximum_; 7558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) ScrollbarOrientation orientation_; 7658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool is_left_side_vertical_scrollbar_; 7758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // Difference between the clip layer's height and the visible viewport 7958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // height (which may differ in the presence of top-controls hiding). 8058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float vertical_adjust_; 8158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) float visible_to_total_length_ratio_; 8358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); 8558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)}; 8658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)} // namespace cc 8858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ 90