| 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_SOLID_COLOR_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ |
| 6 #define CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ | 6 #define CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.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 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, | 15 class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, |
| 16 public Layer { | 16 public Layer { |
| 17 public: | 17 public: |
| 18 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 18 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 19 | 19 |
| 20 static scoped_refptr<SolidColorScrollbarLayer> Create( | 20 static scoped_refptr<SolidColorScrollbarLayer> Create( |
| 21 ScrollbarOrientation orientation, | 21 ScrollbarOrientation orientation, |
| 22 int thumb_thickness, | 22 int thumb_thickness, |
| 23 int track_start, | 23 int track_start, |
| 24 bool is_left_side_vertical_scrollbar, | 24 bool is_left_side_vertical_scrollbar, |
| 25 int scroll_layer_id, | |
| 26 ElementId scroll_element_id); | 25 ElementId scroll_element_id); |
| 27 | 26 |
| 28 // Layer overrides. | 27 // Layer overrides. |
| 29 bool OpacityCanAnimateOnImplThread() const override; | 28 bool OpacityCanAnimateOnImplThread() const override; |
| 30 bool AlwaysUseActiveTreeOpacity() const override; | 29 bool AlwaysUseActiveTreeOpacity() const override; |
| 31 ScrollbarLayerInterface* ToScrollbarLayer() override; | 30 ScrollbarLayerInterface* ToScrollbarLayer() override; |
| 32 | 31 |
| 33 void SetOpacity(float opacity) override; | 32 void SetOpacity(float opacity) override; |
| 34 void PushPropertiesTo(LayerImpl* layer) override; | 33 void PushPropertiesTo(LayerImpl* layer) override; |
| 35 | 34 |
| 36 void SetNeedsDisplayRect(const gfx::Rect& rect) override; | 35 void SetNeedsDisplayRect(const gfx::Rect& rect) override; |
| 37 | 36 |
| 38 // ScrollbarLayerInterface | 37 // ScrollbarLayerInterface |
| 39 ElementId scroll_element_id() const override; | 38 ElementId scroll_element_id() const override; |
| 40 // TODO(pdr): Remove layer_id and refactor scrollbars to just use element ids. | 39 void SetScrollElementId(ElementId element_id) override; |
| 41 void SetScrollInfo(int layer_id, ElementId element_id) override; | |
| 42 | 40 |
| 43 ScrollbarOrientation orientation() const override; | 41 ScrollbarOrientation orientation() const override; |
| 44 | 42 |
| 45 int thumb_thickness() const { | 43 int thumb_thickness() const { |
| 46 return solid_color_scrollbar_layer_inputs_.thumb_thickness; | 44 return solid_color_scrollbar_layer_inputs_.thumb_thickness; |
| 47 } | 45 } |
| 48 | 46 |
| 49 int track_start() const { | 47 int track_start() const { |
| 50 return solid_color_scrollbar_layer_inputs_.track_start; | 48 return solid_color_scrollbar_layer_inputs_.track_start; |
| 51 } | 49 } |
| 52 | 50 |
| 53 bool is_left_side_vertical_scrollbar() const { | 51 bool is_left_side_vertical_scrollbar() const { |
| 54 return solid_color_scrollbar_layer_inputs_.is_left_side_vertical_scrollbar; | 52 return solid_color_scrollbar_layer_inputs_.is_left_side_vertical_scrollbar; |
| 55 } | 53 } |
| 56 | 54 |
| 57 protected: | 55 protected: |
| 58 SolidColorScrollbarLayer(ScrollbarOrientation orientation, | 56 SolidColorScrollbarLayer(ScrollbarOrientation orientation, |
| 59 int thumb_thickness, | 57 int thumb_thickness, |
| 60 int track_start, | 58 int track_start, |
| 61 bool is_left_side_vertical_scrollbar, | 59 bool is_left_side_vertical_scrollbar, |
| 62 int scroll_layer_id, | |
| 63 ElementId scroll_element_id); | 60 ElementId scroll_element_id); |
| 64 ~SolidColorScrollbarLayer() override; | 61 ~SolidColorScrollbarLayer() override; |
| 65 | 62 |
| 66 private: | 63 private: |
| 67 friend class LayerSerializationTest; | 64 friend class LayerSerializationTest; |
| 68 | 65 |
| 69 // Encapsulate all data, callbacks, interfaces received from the embedder. | 66 // Encapsulate all data, callbacks, interfaces received from the embedder. |
| 70 struct SolidColorScrollbarLayerInputs { | 67 struct SolidColorScrollbarLayerInputs { |
| 71 SolidColorScrollbarLayerInputs(ScrollbarOrientation orientation, | 68 SolidColorScrollbarLayerInputs(ScrollbarOrientation orientation, |
| 72 int thumb_thickness, | 69 int thumb_thickness, |
| 73 int track_start, | 70 int track_start, |
| 74 bool is_left_side_vertical_scrollbar, | 71 bool is_left_side_vertical_scrollbar, |
| 75 int scroll_layer_id, | |
| 76 ElementId scroll_element_id); | 72 ElementId scroll_element_id); |
| 77 ~SolidColorScrollbarLayerInputs(); | 73 ~SolidColorScrollbarLayerInputs(); |
| 78 | 74 |
| 79 int scroll_layer_id; | |
| 80 ElementId scroll_element_id; | 75 ElementId scroll_element_id; |
| 81 ScrollbarOrientation orientation; | 76 ScrollbarOrientation orientation; |
| 82 int thumb_thickness; | 77 int thumb_thickness; |
| 83 int track_start; | 78 int track_start; |
| 84 bool is_left_side_vertical_scrollbar; | 79 bool is_left_side_vertical_scrollbar; |
| 85 }; | 80 }; |
| 86 | 81 |
| 87 SolidColorScrollbarLayerInputs solid_color_scrollbar_layer_inputs_; | 82 SolidColorScrollbarLayerInputs solid_color_scrollbar_layer_inputs_; |
| 88 | 83 |
| 89 DISALLOW_COPY_AND_ASSIGN(SolidColorScrollbarLayer); | 84 DISALLOW_COPY_AND_ASSIGN(SolidColorScrollbarLayer); |
| 90 }; | 85 }; |
| 91 | 86 |
| 92 } // namespace cc | 87 } // namespace cc |
| 93 | 88 |
| 94 #endif // CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ | 89 #endif // CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ |
| OLD | NEW |