| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ | 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
| 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ | 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
| 10 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 class LayerTreeImpl; | 15 class LayerTreeImpl; |
| 15 | 16 |
| 16 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { | 17 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { |
| 17 public: | 18 public: |
| 18 int ScrollLayerId() const { return scroll_layer_id_; } | 19 int ScrollLayerId() const { |
| 19 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } | 20 return scroll_layer_ ? scroll_layer_->id() : Layer::INVALID_ID; |
| 21 } |
| 22 void ClearScrollLayer() { scroll_layer_ = NULL; } |
| 23 void SetScrollLayerById(int id); |
| 24 int ClipLayerId() const { |
| 25 return clip_layer_ ? clip_layer_->id() : Layer::INVALID_ID; |
| 26 } |
| 27 void ClearClipLayer() { clip_layer_ = NULL; } |
| 28 void SetClipLayerById(int id); |
| 20 | 29 |
| 21 float current_pos() const { return current_pos_; } | 30 float current_pos() const { return current_pos_; } |
| 22 void SetCurrentPos(float current_pos); | 31 void SetCurrentPos(float current_pos); |
| 23 int maximum() const { return maximum_; } | 32 int maximum() const { return maximum_; } |
| 24 void SetMaximum(int maximum); | 33 void SetMaximum(int maximum); |
| 25 | 34 |
| 26 void SetVerticalAdjust(float vertical_adjust); | 35 void SetVerticalAdjust(float vertical_adjust); |
| 27 | 36 |
| 28 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } | 37 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } |
| 29 void set_is_overlay_scrollbar(bool is_overlay) { | 38 void set_is_overlay_scrollbar(bool is_overlay) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 void SetVisibleToTotalLengthRatio(float ratio); | 50 void SetVisibleToTotalLengthRatio(float ratio); |
| 42 virtual gfx::Rect ComputeThumbQuadRect() const; | 51 virtual gfx::Rect ComputeThumbQuadRect() const; |
| 43 | 52 |
| 44 float thumb_thickness_scale_factor() { | 53 float thumb_thickness_scale_factor() { |
| 45 return thumb_thickness_scale_factor_; | 54 return thumb_thickness_scale_factor_; |
| 46 } | 55 } |
| 47 void set_thumb_thickness_scale_factor(float thumb_thickness_scale_factor) { | 56 void set_thumb_thickness_scale_factor(float thumb_thickness_scale_factor) { |
| 48 thumb_thickness_scale_factor_ = thumb_thickness_scale_factor; | 57 thumb_thickness_scale_factor_ = thumb_thickness_scale_factor; |
| 49 } | 58 } |
| 50 | 59 |
| 60 void ScrollbarParametersDidChange(); |
| 61 bool opacity_can_animate() { return opacity_can_animate_; } |
| 62 |
| 51 protected: | 63 protected: |
| 52 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, | 64 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, |
| 53 int id, | 65 int id, |
| 54 ScrollbarOrientation orientation, | 66 ScrollbarOrientation orientation, |
| 55 bool is_left_side_vertical_scrollbar); | 67 bool is_left_side_vertical_scrollbar); |
| 56 virtual ~ScrollbarLayerImplBase() {} | 68 virtual ~ScrollbarLayerImplBase(); |
| 57 | 69 |
| 58 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; | 70 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; |
| 59 | 71 |
| 60 float visible_to_total_length_ratio() const { | 72 float visible_to_total_length_ratio() const { |
| 61 return visible_to_total_length_ratio_; | 73 return visible_to_total_length_ratio_; |
| 62 } | 74 } |
| 63 float vertical_adjust() const { return vertical_adjust_; } | 75 float vertical_adjust() const { return vertical_adjust_; } |
| 64 | 76 |
| 65 virtual int ThumbThickness() const = 0; | 77 virtual int ThumbThickness() const = 0; |
| 66 virtual int ThumbLength() const = 0; | 78 virtual int ThumbLength() const = 0; |
| 67 virtual float TrackLength() const = 0; | 79 virtual float TrackLength() const = 0; |
| 68 virtual int TrackStart() const = 0; | 80 virtual int TrackStart() const = 0; |
| 69 | 81 |
| 70 private: | 82 private: |
| 71 int scroll_layer_id_; | 83 LayerImpl* scroll_layer_; |
| 84 LayerImpl* clip_layer_; |
| 72 bool is_overlay_scrollbar_; | 85 bool is_overlay_scrollbar_; |
| 73 | 86 |
| 74 float thumb_thickness_scale_factor_; | 87 float thumb_thickness_scale_factor_; |
| 75 float current_pos_; | 88 float current_pos_; |
| 76 int maximum_; | 89 int maximum_; |
| 77 ScrollbarOrientation orientation_; | 90 ScrollbarOrientation orientation_; |
| 78 bool is_left_side_vertical_scrollbar_; | 91 bool is_left_side_vertical_scrollbar_; |
| 79 | 92 |
| 80 // Difference between the clip layer's height and the visible viewport | 93 // Difference between the clip layer's height and the visible viewport |
| 81 // height (which may differ in the presence of top-controls hiding). | 94 // height (which may differ in the presence of top-controls hiding). |
| 82 float vertical_adjust_; | 95 float vertical_adjust_; |
| 83 | 96 |
| 84 float visible_to_total_length_ratio_; | 97 float visible_to_total_length_ratio_; |
| 85 | 98 |
| 99 |
| 86 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); | 100 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); |
| 101 |
| 102 protected: |
| 103 bool opacity_can_animate_; |
| 87 }; | 104 }; |
| 88 | 105 |
| 89 } // namespace cc | 106 } // namespace cc |
| 90 | 107 |
| 91 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ | 108 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
| OLD | NEW |