OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
| 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
| 7 |
| 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/input/scrollbar.h" |
| 10 #include "cc/layers/layer_impl.h" |
| 11 |
| 12 namespace cc { |
| 13 |
| 14 class LayerTreeImpl; |
| 15 |
| 16 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { |
| 17 public: |
| 18 int ScrollLayerId() const { return scroll_layer_id_; } |
| 19 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } |
| 20 |
| 21 float current_pos() const { return current_pos_; } |
| 22 void SetCurrentPos(float current_pos); |
| 23 int maximum() const { return maximum_; } |
| 24 void SetMaximum(int maximum); |
| 25 |
| 26 void SetVerticalAdjust(float vertical_adjust); |
| 27 |
| 28 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } |
| 29 void set_is_overlay_scrollbar(bool is_overlay) { |
| 30 is_overlay_scrollbar_ = is_overlay; |
| 31 } |
| 32 |
| 33 ScrollbarOrientation orientation() const { return orientation_; } |
| 34 |
| 35 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 36 virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE; |
| 37 |
| 38 void SetVisibleToTotalLengthRatio(float ratio); |
| 39 virtual gfx::Rect ComputeThumbQuadRect() const; |
| 40 |
| 41 protected: |
| 42 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, |
| 43 int id, |
| 44 ScrollbarOrientation orientation); |
| 45 virtual ~ScrollbarLayerImplBase() {} |
| 46 |
| 47 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
| 48 |
| 49 float visible_to_total_length_ratio() const { |
| 50 return visible_to_total_length_ratio_; |
| 51 } |
| 52 float vertical_adjust() const { return vertical_adjust_; } |
| 53 |
| 54 virtual int ThumbThickness() const = 0; |
| 55 virtual int ThumbLength() const = 0; |
| 56 virtual float TrackLength() const = 0; |
| 57 virtual int TrackStart() const = 0; |
| 58 |
| 59 private: |
| 60 int scroll_layer_id_; |
| 61 bool is_overlay_scrollbar_; |
| 62 |
| 63 float current_pos_; |
| 64 int maximum_; |
| 65 ScrollbarOrientation orientation_; |
| 66 |
| 67 // Difference between the clip layer's height and the visible viewport |
| 68 // height (which may differ in the presence of top-controls hiding). |
| 69 float vertical_adjust_; |
| 70 |
| 71 float visible_to_total_length_ratio_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); |
| 74 }; |
| 75 |
| 76 } // namespace cc |
| 77 |
| 78 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
OLD | NEW |