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_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_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.h" |
11 #include "cc/layers/scrollbar_layer_interface.h" | 11 #include "cc/layers/scrollbar_layer_interface.h" |
12 #include "cc/layers/scrollbar_theme_painter.h" | 12 #include "cc/layers/scrollbar_theme_painter.h" |
13 #include "cc/resources/layer_updater.h" | 13 #include "cc/resources/layer_updater.h" |
14 #include "cc/resources/scoped_ui_resource.h" | 14 #include "cc/resources/scoped_ui_resource.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 class ScrollbarThemeComposite; | 17 class ScrollbarThemeComposite; |
18 | 18 |
19 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, | 19 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, |
20 public Layer { | 20 public Layer { |
21 public: | 21 public: |
22 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 22 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
23 | 23 |
24 static scoped_refptr<PaintedScrollbarLayer> Create( | 24 static scoped_refptr<PaintedScrollbarLayer> Create( |
| 25 const LayerSettings& settings, |
25 scoped_ptr<Scrollbar> scrollbar, | 26 scoped_ptr<Scrollbar> scrollbar, |
26 int scroll_layer_id); | 27 int scroll_layer_id); |
27 | 28 |
28 bool OpacityCanAnimateOnImplThread() const override; | 29 bool OpacityCanAnimateOnImplThread() const override; |
29 ScrollbarLayerInterface* ToScrollbarLayer() override; | 30 ScrollbarLayerInterface* ToScrollbarLayer() override; |
30 | 31 |
31 // ScrollbarLayerInterface | 32 // ScrollbarLayerInterface |
32 int ScrollLayerId() const override; | 33 int ScrollLayerId() const override; |
33 void SetScrollLayer(int layer_id) override; | 34 void SetScrollLayer(int layer_id) override; |
34 void SetClipLayer(int layer_id) override; | 35 void SetClipLayer(int layer_id) override; |
35 | 36 |
36 ScrollbarOrientation orientation() const override; | 37 ScrollbarOrientation orientation() const override; |
37 | 38 |
38 // Layer interface | 39 // Layer interface |
39 bool Update(ResourceUpdateQueue* queue, | 40 bool Update(ResourceUpdateQueue* queue, |
40 const OcclusionTracker<Layer>* occlusion) override; | 41 const OcclusionTracker<Layer>* occlusion) override; |
41 void SetLayerTreeHost(LayerTreeHost* host) override; | 42 void SetLayerTreeHost(LayerTreeHost* host) override; |
42 void PushPropertiesTo(LayerImpl* layer) override; | 43 void PushPropertiesTo(LayerImpl* layer) override; |
43 void PushScrollClipPropertiesTo(LayerImpl* layer) override; | 44 void PushScrollClipPropertiesTo(LayerImpl* layer) override; |
44 | 45 |
45 const gfx::Size& internal_content_bounds() const { | 46 const gfx::Size& internal_content_bounds() const { |
46 return internal_content_bounds_; | 47 return internal_content_bounds_; |
47 } | 48 } |
48 | 49 |
49 protected: | 50 protected: |
50 PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); | 51 PaintedScrollbarLayer(const LayerSettings& settings, |
| 52 scoped_ptr<Scrollbar> scrollbar, |
| 53 int scroll_layer_id); |
51 ~PaintedScrollbarLayer() override; | 54 ~PaintedScrollbarLayer() override; |
52 | 55 |
53 // For unit tests | 56 // For unit tests |
54 UIResourceId track_resource_id() { | 57 UIResourceId track_resource_id() { |
55 return track_resource_.get() ? track_resource_->id() : 0; | 58 return track_resource_.get() ? track_resource_->id() : 0; |
56 } | 59 } |
57 UIResourceId thumb_resource_id() { | 60 UIResourceId thumb_resource_id() { |
58 return thumb_resource_.get() ? thumb_resource_->id() : 0; | 61 return thumb_resource_.get() ? thumb_resource_->id() : 0; |
59 } | 62 } |
60 void UpdateInternalContentScale(); | 63 void UpdateInternalContentScale(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 101 |
99 scoped_ptr<ScopedUIResource> track_resource_; | 102 scoped_ptr<ScopedUIResource> track_resource_; |
100 scoped_ptr<ScopedUIResource> thumb_resource_; | 103 scoped_ptr<ScopedUIResource> thumb_resource_; |
101 | 104 |
102 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); | 105 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); |
103 }; | 106 }; |
104 | 107 |
105 } // namespace cc | 108 } // namespace cc |
106 | 109 |
107 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 110 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
OLD | NEW |