| 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/contents_scaling_layer.h" | 10 #include "cc/layers/contents_scaling_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 ContentsScalingLayer { | 20 public ContentsScalingLayer { |
| 21 public: | 21 public: |
| 22 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 22 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 23 override; | |
| 24 | 23 |
| 25 static scoped_refptr<PaintedScrollbarLayer> Create( | 24 static scoped_refptr<PaintedScrollbarLayer> Create( |
| 26 scoped_ptr<Scrollbar> scrollbar, | 25 scoped_ptr<Scrollbar> scrollbar, |
| 27 int scroll_layer_id); | 26 int scroll_layer_id); |
| 28 | 27 |
| 29 virtual bool OpacityCanAnimateOnImplThread() const override; | 28 bool OpacityCanAnimateOnImplThread() const override; |
| 30 virtual ScrollbarLayerInterface* ToScrollbarLayer() override; | 29 ScrollbarLayerInterface* ToScrollbarLayer() override; |
| 31 | 30 |
| 32 // ScrollbarLayerInterface | 31 // ScrollbarLayerInterface |
| 33 virtual int ScrollLayerId() const override; | 32 int ScrollLayerId() const override; |
| 34 virtual void SetScrollLayer(int layer_id) override; | 33 void SetScrollLayer(int layer_id) override; |
| 35 virtual void SetClipLayer(int layer_id) override; | 34 void SetClipLayer(int layer_id) override; |
| 36 | 35 |
| 37 virtual ScrollbarOrientation orientation() const override; | 36 ScrollbarOrientation orientation() const override; |
| 38 | 37 |
| 39 // Layer interface | 38 // Layer interface |
| 40 virtual bool Update(ResourceUpdateQueue* queue, | 39 bool Update(ResourceUpdateQueue* queue, |
| 41 const OcclusionTracker<Layer>* occlusion) override; | 40 const OcclusionTracker<Layer>* occlusion) override; |
| 42 virtual void SetLayerTreeHost(LayerTreeHost* host) override; | 41 void SetLayerTreeHost(LayerTreeHost* host) override; |
| 43 virtual void PushPropertiesTo(LayerImpl* layer) override; | 42 void PushPropertiesTo(LayerImpl* layer) override; |
| 44 virtual void PushScrollClipPropertiesTo(LayerImpl* layer) override; | 43 void PushScrollClipPropertiesTo(LayerImpl* layer) override; |
| 45 virtual void CalculateContentsScale(float ideal_contents_scale, | 44 void CalculateContentsScale(float ideal_contents_scale, |
| 46 float* contents_scale_x, | 45 float* contents_scale_x, |
| 47 float* contents_scale_y, | 46 float* contents_scale_y, |
| 48 gfx::Size* content_bounds) override; | 47 gfx::Size* content_bounds) override; |
| 49 | 48 |
| 50 protected: | 49 protected: |
| 51 PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); | 50 PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); |
| 52 virtual ~PaintedScrollbarLayer(); | 51 ~PaintedScrollbarLayer() override; |
| 53 | 52 |
| 54 // For unit tests | 53 // For unit tests |
| 55 UIResourceId track_resource_id() { | 54 UIResourceId track_resource_id() { |
| 56 return track_resource_.get() ? track_resource_->id() : 0; | 55 return track_resource_.get() ? track_resource_->id() : 0; |
| 57 } | 56 } |
| 58 UIResourceId thumb_resource_id() { | 57 UIResourceId thumb_resource_id() { |
| 59 return thumb_resource_.get() ? thumb_resource_->id() : 0; | 58 return thumb_resource_.get() ? thumb_resource_->id() : 0; |
| 60 } | 59 } |
| 61 void UpdateThumbAndTrackGeometry(); | 60 void UpdateThumbAndTrackGeometry(); |
| 62 | 61 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 93 | 92 |
| 94 scoped_ptr<ScopedUIResource> track_resource_; | 93 scoped_ptr<ScopedUIResource> track_resource_; |
| 95 scoped_ptr<ScopedUIResource> thumb_resource_; | 94 scoped_ptr<ScopedUIResource> thumb_resource_; |
| 96 | 95 |
| 97 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); | 96 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 } // namespace cc | 99 } // namespace cc |
| 101 | 100 |
| 102 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 101 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
| OLD | NEW |