Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: cc/layers/solid_color_scrollbar_layer.h

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Address reviewer comments, pull element_id.h change to another patch Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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); 25 int scroll_layer_id,
26 ElementId scroll_element_id);
26 27
27 // Layer overrides. 28 // Layer overrides.
28 bool OpacityCanAnimateOnImplThread() const override; 29 bool OpacityCanAnimateOnImplThread() const override;
29 bool AlwaysUseActiveTreeOpacity() const override; 30 bool AlwaysUseActiveTreeOpacity() const override;
30 ScrollbarLayerInterface* ToScrollbarLayer() override; 31 ScrollbarLayerInterface* ToScrollbarLayer() override;
31 32
32 void SetOpacity(float opacity) override; 33 void SetOpacity(float opacity) override;
33 void PushPropertiesTo(LayerImpl* layer) override; 34 void PushPropertiesTo(LayerImpl* layer) override;
34 35
35 void SetNeedsDisplayRect(const gfx::Rect& rect) override; 36 void SetNeedsDisplayRect(const gfx::Rect& rect) override;
36 37
37 // ScrollbarLayerInterface 38 // ScrollbarLayerInterface
38 int ScrollLayerId() const override; 39 ElementId scroll_element_id() const override;
39 void SetScrollLayer(int layer_id) override; 40 // TODO(pdr): Remove layer_id and refactor scrollbars to just use element ids.
41 void SetScrollInfo(int layer_id, ElementId element_id) override;
40 42
41 ScrollbarOrientation orientation() const override; 43 ScrollbarOrientation orientation() const override;
42 44
43 int thumb_thickness() const { 45 int thumb_thickness() const {
44 return solid_color_scrollbar_layer_inputs_.thumb_thickness; 46 return solid_color_scrollbar_layer_inputs_.thumb_thickness;
45 } 47 }
46 48
47 int track_start() const { 49 int track_start() const {
48 return solid_color_scrollbar_layer_inputs_.track_start; 50 return solid_color_scrollbar_layer_inputs_.track_start;
49 } 51 }
50 52
51 bool is_left_side_vertical_scrollbar() const { 53 bool is_left_side_vertical_scrollbar() const {
52 return solid_color_scrollbar_layer_inputs_.is_left_side_vertical_scrollbar; 54 return solid_color_scrollbar_layer_inputs_.is_left_side_vertical_scrollbar;
53 } 55 }
54 56
55 protected: 57 protected:
56 SolidColorScrollbarLayer(ScrollbarOrientation orientation, 58 SolidColorScrollbarLayer(ScrollbarOrientation orientation,
57 int thumb_thickness, 59 int thumb_thickness,
58 int track_start, 60 int track_start,
59 bool is_left_side_vertical_scrollbar, 61 bool is_left_side_vertical_scrollbar,
60 int scroll_layer_id); 62 int scroll_layer_id,
63 ElementId scroll_element_id);
61 ~SolidColorScrollbarLayer() override; 64 ~SolidColorScrollbarLayer() override;
62 65
63 private: 66 private:
64 friend class LayerSerializationTest; 67 friend class LayerSerializationTest;
65 68
66 // Encapsulate all data, callbacks, interfaces received from the embedder. 69 // Encapsulate all data, callbacks, interfaces received from the embedder.
67 struct SolidColorScrollbarLayerInputs { 70 struct SolidColorScrollbarLayerInputs {
68 SolidColorScrollbarLayerInputs(ScrollbarOrientation orientation, 71 SolidColorScrollbarLayerInputs(ScrollbarOrientation orientation,
69 int thumb_thickness, 72 int thumb_thickness,
70 int track_start, 73 int track_start,
71 bool is_left_side_vertical_scrollbar, 74 bool is_left_side_vertical_scrollbar,
72 int scroll_layer_id); 75 int scroll_layer_id,
76 ElementId scroll_element_id);
73 ~SolidColorScrollbarLayerInputs(); 77 ~SolidColorScrollbarLayerInputs();
74 78
75 int scroll_layer_id; 79 int scroll_layer_id;
80 ElementId scroll_element_id;
76 ScrollbarOrientation orientation; 81 ScrollbarOrientation orientation;
77 int thumb_thickness; 82 int thumb_thickness;
78 int track_start; 83 int track_start;
79 bool is_left_side_vertical_scrollbar; 84 bool is_left_side_vertical_scrollbar;
80 }; 85 };
81 86
82 SolidColorScrollbarLayerInputs solid_color_scrollbar_layer_inputs_; 87 SolidColorScrollbarLayerInputs solid_color_scrollbar_layer_inputs_;
83 88
84 DISALLOW_COPY_AND_ASSIGN(SolidColorScrollbarLayer); 89 DISALLOW_COPY_AND_ASSIGN(SolidColorScrollbarLayer);
85 }; 90 };
86 91
87 } // namespace cc 92 } // namespace cc
88 93
89 #endif // CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_ 94 #endif // CC_LAYERS_SOLID_COLOR_SCROLLBAR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698