OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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.h" |
| 11 #include "cc/layers/layer_impl.h" |
| 12 |
| 13 namespace cc { |
| 14 |
| 15 class LayerTreeImpl; |
| 16 |
| 17 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { |
| 18 public: |
| 19 int scroll_layer_id() const { return scroll_layer_id_; } |
| 20 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } |
| 21 |
| 22 float CurrentPos() const { return current_pos_; } |
| 23 void SetCurrentPos(float pos) { current_pos_ = pos; } |
| 24 int Maximum() const { return maximum_; } |
| 25 void SetMaximum(int maximum) { maximum_ = maximum; } |
| 26 |
| 27 void set_visible_to_total_length_ratio(float ratio) { |
| 28 visible_to_total_length_ratio_ = ratio; |
| 29 } |
| 30 |
| 31 void set_vertical_adjust(float vertical_adjust) { |
| 32 vertical_adjust_ = vertical_adjust; |
| 33 } |
| 34 |
| 35 ScrollbarOrientation Orientation() const { return orientation_; } |
| 36 |
| 37 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 38 virtual ScrollbarLayerImplBase* ToScrollbarLayerBase() OVERRIDE; |
| 39 |
| 40 virtual gfx::Rect ComputeThumbQuadRect() const = 0; |
| 41 |
| 42 protected: |
| 43 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, |
| 44 int id, |
| 45 ScrollbarOrientation orientation) |
| 46 : LayerImpl(tree_impl, id), |
| 47 scroll_layer_id_(Layer::INVALID_ID), |
| 48 current_pos_(0.f), |
| 49 maximum_(0), |
| 50 orientation_(orientation), |
| 51 visible_to_total_length_ratio_(1.f), |
| 52 vertical_adjust_(0.f) {} |
| 53 virtual ~ScrollbarLayerImplBase() {} |
| 54 |
| 55 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
| 56 gfx::Rect ComputeThumbQuadRectInternal(int thumb_length, |
| 57 float track_length, |
| 58 int track_start, |
| 59 int thumb_thickness) const; |
| 60 |
| 61 int scroll_layer_id_; |
| 62 |
| 63 float current_pos_; |
| 64 int maximum_; |
| 65 ScrollbarOrientation orientation_; |
| 66 |
| 67 float visible_to_total_length_ratio_; |
| 68 // Difference between the clip layer's height and the visible viewport |
| 69 // height (which may differ in the presence of top-controls hiding). |
| 70 float vertical_adjust_; |
| 71 }; |
| 72 |
| 73 } // namespace cc |
| 74 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
OLD | NEW |