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

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

Issue 2827163005: Remove scroll layer ids from scrollbar layers (Closed)
Patch Set: 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_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 "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/cc_export.h" 9 #include "cc/cc_export.h"
10 #include "cc/input/scrollbar.h" 10 #include "cc/input/scrollbar.h"
11 #include "cc/layers/layer.h" 11 #include "cc/layers/layer.h"
12 #include "cc/layers/scrollbar_layer_interface.h" 12 #include "cc/layers/scrollbar_layer_interface.h"
13 #include "cc/layers/scrollbar_theme_painter.h" 13 #include "cc/layers/scrollbar_theme_painter.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 17
18 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, 18 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface,
19 public Layer { 19 public Layer {
20 public: 20 public:
21 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 21 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
22 22
23 static scoped_refptr<PaintedScrollbarLayer> Create( 23 static scoped_refptr<PaintedScrollbarLayer> Create(
24 std::unique_ptr<Scrollbar> scrollbar, 24 std::unique_ptr<Scrollbar> scrollbar,
25 int scroll_layer_id,
26 ElementId element_id = ElementId()); 25 ElementId element_id = ElementId());
27 26
28 bool OpacityCanAnimateOnImplThread() const override; 27 bool OpacityCanAnimateOnImplThread() const override;
29 bool AlwaysUseActiveTreeOpacity() const override; 28 bool AlwaysUseActiveTreeOpacity() const override;
30 ScrollbarLayerInterface* ToScrollbarLayer() override; 29 ScrollbarLayerInterface* ToScrollbarLayer() override;
31 30
32 // ScrollbarLayerInterface 31 // ScrollbarLayerInterface
33 ElementId scroll_element_id() const override; 32 ElementId scroll_element_id() const override;
34 // TODO(pdr): Remove layer_id and refactor scrollbars to just use element ids. 33 void SetScrollElementId(ElementId element_id) override;
35 void SetScrollInfo(int layer_id, ElementId element_id) override;
36 34
37 ScrollbarOrientation orientation() const override; 35 ScrollbarOrientation orientation() const override;
38 36
39 // Layer interface 37 // Layer interface
40 bool Update() override; 38 bool Update() override;
41 void SetLayerTreeHost(LayerTreeHost* host) override; 39 void SetLayerTreeHost(LayerTreeHost* host) override;
42 void PushPropertiesTo(LayerImpl* layer) override; 40 void PushPropertiesTo(LayerImpl* layer) override;
43 41
44 const gfx::Size& internal_content_bounds() const { 42 const gfx::Size& internal_content_bounds() const {
45 return internal_content_bounds_; 43 return internal_content_bounds_;
46 } 44 }
47 45
48 protected: 46 protected:
49 PaintedScrollbarLayer(std::unique_ptr<Scrollbar> scrollbar, 47 PaintedScrollbarLayer(std::unique_ptr<Scrollbar> scrollbar,
50 int scroll_layer_id,
51 ElementId scroll_element_id); 48 ElementId scroll_element_id);
52 ~PaintedScrollbarLayer() override; 49 ~PaintedScrollbarLayer() override;
53 50
54 // For unit tests 51 // For unit tests
55 UIResourceId track_resource_id() { 52 UIResourceId track_resource_id() {
56 return track_resource_.get() ? track_resource_->id() : 0; 53 return track_resource_.get() ? track_resource_->id() : 0;
57 } 54 }
58 UIResourceId thumb_resource_id() { 55 UIResourceId thumb_resource_id() {
59 return thumb_resource_.get() ? thumb_resource_->id() : 0; 56 return thumb_resource_.get() ? thumb_resource_->id() : 0;
60 } 57 }
(...skipping 11 matching lines...) Expand all
72 *prop = value; 69 *prop = value;
73 SetNeedsPushProperties(); 70 SetNeedsPushProperties();
74 return true; 71 return true;
75 } 72 }
76 73
77 UIResourceBitmap RasterizeScrollbarPart(const gfx::Rect& layer_rect, 74 UIResourceBitmap RasterizeScrollbarPart(const gfx::Rect& layer_rect,
78 const gfx::Rect& content_rect, 75 const gfx::Rect& content_rect,
79 ScrollbarPart part); 76 ScrollbarPart part);
80 77
81 std::unique_ptr<Scrollbar> scrollbar_; 78 std::unique_ptr<Scrollbar> scrollbar_;
82 int scroll_layer_id_;
83 ElementId scroll_element_id_; 79 ElementId scroll_element_id_;
84 80
85 float internal_contents_scale_; 81 float internal_contents_scale_;
86 gfx::Size internal_content_bounds_; 82 gfx::Size internal_content_bounds_;
87 83
88 // Snapshot of properties taken in UpdateThumbAndTrackGeometry and used in 84 // Snapshot of properties taken in UpdateThumbAndTrackGeometry and used in
89 // PushPropertiesTo. 85 // PushPropertiesTo.
90 int thumb_thickness_; 86 int thumb_thickness_;
91 int thumb_length_; 87 int thumb_length_;
92 gfx::Point location_; 88 gfx::Point location_;
93 gfx::Rect track_rect_; 89 gfx::Rect track_rect_;
94 bool is_overlay_; 90 bool is_overlay_;
95 bool has_thumb_; 91 bool has_thumb_;
96 92
97 std::unique_ptr<ScopedUIResource> track_resource_; 93 std::unique_ptr<ScopedUIResource> track_resource_;
98 std::unique_ptr<ScopedUIResource> thumb_resource_; 94 std::unique_ptr<ScopedUIResource> thumb_resource_;
99 95
100 float thumb_opacity_; 96 float thumb_opacity_;
101 97
102 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); 98 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer);
103 }; 99 };
104 100
105 } // namespace cc 101 } // namespace cc
106 102
107 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ 103 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698