| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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_H_ | 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_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_impl.h" | 10 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class LayerTreeImpl; | 14 class LayerTreeImpl; |
| 15 class ScrollView; | 15 class ScrollView; |
| 16 | 16 |
| 17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { | 17 class CC_EXPORT ScrollbarLayerImpl : public ScrollbarLayerImplBase { |
| 18 public: | 18 public: |
| 19 static scoped_ptr<ScrollbarLayerImpl> Create( | 19 static scoped_ptr<ScrollbarLayerImpl> Create( |
| 20 LayerTreeImpl* tree_impl, | 20 LayerTreeImpl* tree_impl, |
| 21 int id, | 21 int id, |
| 22 ScrollbarOrientation orientation); | 22 ScrollbarOrientation orientation); |
| 23 virtual ~ScrollbarLayerImpl(); | 23 virtual ~ScrollbarLayerImpl(); |
| 24 | 24 |
| 25 // LayerImpl implementation. | 25 // LayerImpl implementation. |
| 26 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; | |
| 27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 26 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 28 OVERRIDE; | 27 OVERRIDE; |
| 29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 28 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 30 | 29 |
| 31 virtual bool WillDraw(DrawMode draw_mode, | 30 virtual bool WillDraw(DrawMode draw_mode, |
| 32 ResourceProvider* resource_provider) OVERRIDE; | 31 ResourceProvider* resource_provider) OVERRIDE; |
| 33 virtual void AppendQuads(QuadSink* quad_sink, | 32 virtual void AppendQuads(QuadSink* quad_sink, |
| 34 AppendQuadsData* append_quads_data) OVERRIDE; | 33 AppendQuadsData* append_quads_data) OVERRIDE; |
| 35 | 34 |
| 36 virtual void DidLoseOutputSurface() OVERRIDE; | 35 virtual void DidLoseOutputSurface() OVERRIDE; |
| 37 | 36 |
| 38 int scroll_layer_id() const { return scroll_layer_id_; } | |
| 39 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } | |
| 40 | |
| 41 ScrollbarOrientation Orientation() const; | |
| 42 float CurrentPos() const; | |
| 43 int Maximum() const; | |
| 44 | |
| 45 void set_thumb_thickness(int thumb_thickness) { | 37 void set_thumb_thickness(int thumb_thickness) { |
| 46 thumb_thickness_ = thumb_thickness; | 38 thumb_thickness_ = thumb_thickness; |
| 47 } | 39 } |
| 48 void set_thumb_length(int thumb_length) { | 40 void set_thumb_length(int thumb_length) { |
| 49 thumb_length_ = thumb_length; | 41 thumb_length_ = thumb_length; |
| 50 } | 42 } |
| 51 void set_track_start(int track_start) { | 43 void set_track_start(int track_start) { |
| 52 track_start_ = track_start; | 44 track_start_ = track_start; |
| 53 } | 45 } |
| 54 void set_track_length(int track_length) { | 46 void set_track_length(int track_length) { |
| 55 track_length_ = track_length; | 47 track_length_ = track_length; |
| 56 } | 48 } |
| 57 void set_vertical_adjust(float vertical_adjust) { | |
| 58 vertical_adjust_ = vertical_adjust; | |
| 59 } | |
| 60 void set_track_resource_id(ResourceProvider::ResourceId id) { | 49 void set_track_resource_id(ResourceProvider::ResourceId id) { |
| 61 track_resource_id_ = id; | 50 track_resource_id_ = id; |
| 62 } | 51 } |
| 63 void set_thumb_resource_id(ResourceProvider::ResourceId id) { | 52 void set_thumb_resource_id(ResourceProvider::ResourceId id) { |
| 64 thumb_resource_id_ = id; | 53 thumb_resource_id_ = id; |
| 65 } | 54 } |
| 66 void set_visible_to_total_length_ratio(float ratio) { | |
| 67 visible_to_total_length_ratio_ = ratio; | |
| 68 } | |
| 69 | 55 |
| 70 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } | 56 virtual gfx::Rect ComputeThumbQuadRect() const OVERRIDE; |
| 71 void SetMaximum(int maximum) { maximum_ = maximum; } | |
| 72 | |
| 73 gfx::Rect ComputeThumbQuadRect() const; | |
| 74 | 57 |
| 75 protected: | 58 protected: |
| 76 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, | 59 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
| 77 int id, | 60 int id, |
| 78 ScrollbarOrientation orientation); | 61 ScrollbarOrientation orientation); |
| 79 | 62 |
| 80 private: | 63 private: |
| 81 virtual const char* LayerTypeAsString() const OVERRIDE; | 64 virtual const char* LayerTypeAsString() const OVERRIDE; |
| 82 | 65 |
| 83 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; | |
| 84 | |
| 85 ResourceProvider::ResourceId track_resource_id_; | 66 ResourceProvider::ResourceId track_resource_id_; |
| 86 ResourceProvider::ResourceId thumb_resource_id_; | 67 ResourceProvider::ResourceId thumb_resource_id_; |
| 87 | 68 |
| 88 float current_pos_; | |
| 89 int maximum_; | |
| 90 int thumb_thickness_; | 69 int thumb_thickness_; |
| 91 int thumb_length_; | 70 int thumb_length_; |
| 92 int track_start_; | 71 int track_start_; |
| 93 int track_length_; | 72 int track_length_; |
| 94 ScrollbarOrientation orientation_; | 73 ScrollbarOrientation orientation_; |
| 95 | 74 |
| 96 // Difference between the clip layer's height and the visible viewport | |
| 97 // height (which may differ in the presence of top-controls hiding). | |
| 98 float vertical_adjust_; | |
| 99 | |
| 100 float visible_to_total_length_ratio_; | |
| 101 | |
| 102 int scroll_layer_id_; | |
| 103 | |
| 104 bool is_scrollable_area_active_; | 75 bool is_scrollable_area_active_; |
| 105 bool is_scroll_view_scrollbar_; | 76 bool is_scroll_view_scrollbar_; |
| 106 bool enabled_; | 77 bool enabled_; |
| 107 bool is_custom_scrollbar_; | 78 bool is_custom_scrollbar_; |
| 108 bool is_overlay_scrollbar_; | 79 bool is_overlay_scrollbar_; |
| 109 | 80 |
| 110 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); | 81 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); |
| 111 }; | 82 }; |
| 112 | 83 |
| 113 } // namespace cc | 84 } // namespace cc |
| 114 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ | 85 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ |
| OLD | NEW |