| 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_SCROLLBAR_LAYER_IMPL_H_ | 5 #ifndef CC_SCROLLBAR_LAYER_IMPL_H_ |
| 6 #define CC_SCROLLBAR_LAYER_IMPL_H_ | 6 #define CC_SCROLLBAR_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
| 9 #include "cc/scrollbar_geometry_fixed_thumb.h" | 9 #include "cc/scrollbar_geometry_fixed_thumb.h" |
| 10 #include "cc/scrollbar_layer_impl_base.h" | 10 #include "cc/scrollbar_layer_impl_base.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class ScrollView; | 16 class ScrollView; |
| 17 | 17 |
| 18 class CC_EXPORT ScrollbarLayerImpl : public ScrollbarLayerImplBase { | 18 class CC_EXPORT ScrollbarLayerImpl : public ScrollbarLayerImplBase { |
| 19 public: | 19 public: |
| 20 static scoped_ptr<ScrollbarLayerImpl> Create( | 20 static scoped_ptr<ScrollbarLayerImpl> Create( |
| 21 LayerTreeImpl* tree_impl, | 21 LayerTreeImpl* tree_impl, |
| 22 int id, | 22 int id, |
| 23 scoped_ptr<ScrollbarGeometryFixedThumb> geometry); | 23 scoped_ptr<ScrollbarGeometryFixedThumb> geometry); |
| 24 virtual ~ScrollbarLayerImpl(); | 24 virtual ~ScrollbarLayerImpl(); |
| 25 | 25 |
| 26 virtual ScrollbarLayerImpl* toScrollbarLayer() OVERRIDE; | 26 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; |
| 27 int scroll_layer_id() const { return scroll_layer_id_; } | 27 int scroll_layer_id() const { return scroll_layer_id_; } |
| 28 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } | 28 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } |
| 29 | 29 |
| 30 void SetScrollbarData(WebKit::WebScrollbar* scrollbar); | 30 void SetScrollbarData(WebKit::WebScrollbar* scrollbar); |
| 31 void SetThumbSize(gfx::Size size); | 31 void SetThumbSize(gfx::Size size); |
| 32 | 32 |
| 33 void set_back_track_resource_id(ResourceProvider::ResourceId id) { | 33 void set_back_track_resource_id(ResourceProvider::ResourceId id) { |
| 34 back_track_resource_id_ = id; | 34 back_track_resource_id_ = id; |
| 35 } | 35 } |
| 36 void set_fore_track_resource_id(ResourceProvider::ResourceId id) { | 36 void set_fore_track_resource_id(ResourceProvider::ResourceId id) { |
| 37 fore_track_resource_id_ = id; | 37 fore_track_resource_id_ = id; |
| 38 } | 38 } |
| 39 void set_thumb_resource_id(ResourceProvider::ResourceId id) { | 39 void set_thumb_resource_id(ResourceProvider::ResourceId id) { |
| 40 thumb_resource_id_ = id; | 40 thumb_resource_id_ = id; |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 // ScrollbarLayerImplBase implementation. | 44 // ScrollbarLayerImplBase implementation. |
| 45 virtual float CurrentPos() const OVERRIDE; | 45 virtual float CurrentPos() const OVERRIDE; |
| 46 virtual int TotalSize() const OVERRIDE; | 46 virtual int TotalSize() const OVERRIDE; |
| 47 virtual int Maximum() const OVERRIDE; | 47 virtual int Maximum() const OVERRIDE; |
| 48 | 48 |
| 49 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } | 49 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } |
| 50 void SetTotalSize(int total_size) { total_size_ = total_size; } | 50 void SetTotalSize(int total_size) { total_size_ = total_size; } |
| 51 void SetMaximum(int maximum) { maximum_ = maximum; } | 51 void SetMaximum(int maximum) { maximum_ = maximum; } |
| 52 | 52 |
| 53 virtual WebKit::WebScrollbar::Orientation Orientation() const OVERRIDE; | 53 virtual WebKit::WebScrollbar::Orientation Orientation() const OVERRIDE; |
| 54 | 54 |
| 55 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* tree_impl) | 55 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 56 OVERRIDE; | 56 OVERRIDE; |
| 57 virtual void pushPropertiesTo(LayerImpl* layer) OVERRIDE; | 57 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 58 | 58 |
| 59 virtual void appendQuads(QuadSink& quad_sink, | 59 virtual void AppendQuads(QuadSink* quad_sink, |
| 60 AppendQuadsData& append_quads_data) OVERRIDE; | 60 AppendQuadsData* append_quads_data) OVERRIDE; |
| 61 | 61 |
| 62 virtual void didLoseOutputSurface() OVERRIDE; | 62 virtual void DidLoseOutputSurface() OVERRIDE; |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, | 65 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, |
| 66 int id, | 66 int id, |
| 67 scoped_ptr<ScrollbarGeometryFixedThumb> geometry); | 67 scoped_ptr<ScrollbarGeometryFixedThumb> geometry); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // nested class only to avoid namespace problem | 70 // nested class only to avoid namespace problem |
| 71 class Scrollbar : public WebKit::WebScrollbar { | 71 class Scrollbar : public WebKit::WebScrollbar { |
| 72 public: | 72 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 virtual WebScrollbar::ScrollbarPart hoveredPart() const; | 89 virtual WebScrollbar::ScrollbarPart hoveredPart() const; |
| 90 virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const; | 90 virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const; |
| 91 virtual WebScrollbar::Orientation orientation() const; | 91 virtual WebScrollbar::Orientation orientation() const; |
| 92 virtual bool isCustomScrollbar() const; | 92 virtual bool isCustomScrollbar() const; |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 ScrollbarLayerImpl* owner_; | 95 ScrollbarLayerImpl* owner_; |
| 96 | 96 |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 virtual const char* layerTypeAsString() const OVERRIDE; | 99 virtual const char* LayerTypeAsString() const OVERRIDE; |
| 100 | 100 |
| 101 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; | 101 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; |
| 102 | 102 |
| 103 Scrollbar scrollbar_; | 103 Scrollbar scrollbar_; |
| 104 | 104 |
| 105 ResourceProvider::ResourceId back_track_resource_id_; | 105 ResourceProvider::ResourceId back_track_resource_id_; |
| 106 ResourceProvider::ResourceId fore_track_resource_id_; | 106 ResourceProvider::ResourceId fore_track_resource_id_; |
| 107 ResourceProvider::ResourceId thumb_resource_id_; | 107 ResourceProvider::ResourceId thumb_resource_id_; |
| 108 | 108 |
| 109 scoped_ptr<ScrollbarGeometryFixedThumb> geometry_; | 109 scoped_ptr<ScrollbarGeometryFixedThumb> geometry_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 | 125 |
| 126 bool is_scrollable_area_active_; | 126 bool is_scrollable_area_active_; |
| 127 bool is_scroll_view_scrollbar_; | 127 bool is_scroll_view_scrollbar_; |
| 128 bool enabled_; | 128 bool enabled_; |
| 129 bool is_custom_scrollbar_; | 129 bool is_custom_scrollbar_; |
| 130 bool is_overlay_scrollbar_; | 130 bool is_overlay_scrollbar_; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } | 133 } |
| 134 #endif // CC_SCROLLBAR_LAYER_IMPL_H_ | 134 #endif // CC_SCROLLBAR_LAYER_IMPL_H_ |
| OLD | NEW |