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

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

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Enne's comments. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_SCROLLBAR_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_
6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_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_impl.h" 10 #include "cc/layers/scrollbar_layer_impl_base.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class LayerTreeImpl; 14 class LayerTreeImpl;
15 class ScrollView; 15 class ScrollView;
16 16
17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { 17 class CC_EXPORT ScrollbarLayerImpl : public ScrollbarLayerImplBase {
18 public: 18 public:
19 static scoped_ptr<ScrollbarLayerImpl> Create( 19 static scoped_ptr<ScrollbarLayerImpl> Create(
20 LayerTreeImpl* tree_impl, 20 LayerTreeImpl* tree_impl,
21 int id, 21 int id,
22 ScrollbarOrientation orientation); 22 ScrollbarOrientation orientation);
23 virtual ~ScrollbarLayerImpl(); 23 virtual ~ScrollbarLayerImpl();
24 24
25 // LayerImpl implementation. 25 // LayerImpl implementation.
26 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE;
27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 26 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
28 OVERRIDE; 27 OVERRIDE;
29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 28 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
30 29
31 virtual bool WillDraw(DrawMode draw_mode, 30 virtual bool WillDraw(DrawMode draw_mode,
32 ResourceProvider* resource_provider) OVERRIDE; 31 ResourceProvider* resource_provider) OVERRIDE;
33 virtual void AppendQuads(QuadSink* quad_sink, 32 virtual void AppendQuads(QuadSink* quad_sink,
34 AppendQuadsData* append_quads_data) OVERRIDE; 33 AppendQuadsData* append_quads_data) OVERRIDE;
35 34
36 virtual void DidLoseOutputSurface() OVERRIDE; 35 virtual void DidLoseOutputSurface() OVERRIDE;
37 36
38 int scroll_layer_id() const { return scroll_layer_id_; }
39 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; }
40
41 ScrollbarOrientation Orientation() const;
42 float CurrentPos() const;
43 int Maximum() const;
44
45 void set_thumb_thickness(int thumb_thickness) { 37 void set_thumb_thickness(int thumb_thickness) {
46 thumb_thickness_ = thumb_thickness; 38 thumb_thickness_ = thumb_thickness;
47 } 39 }
48 int thumb_thickness() const { return thumb_thickness_; } 40 int thumb_thickness() const { return thumb_thickness_; }
49 void set_thumb_length(int thumb_length) { 41 void set_thumb_length(int thumb_length) {
50 thumb_length_ = thumb_length; 42 thumb_length_ = thumb_length;
51 } 43 }
52 void set_track_start(int track_start) { 44 void set_track_start(int track_start) {
53 track_start_ = track_start; 45 track_start_ = track_start;
54 } 46 }
55 void set_track_length(int track_length) { 47 void set_track_length(int track_length) {
56 track_length_ = track_length; 48 track_length_ = track_length;
57 } 49 }
58 void set_vertical_adjust(float vertical_adjust) {
59 vertical_adjust_ = vertical_adjust;
60 }
61 void set_track_resource_id(ResourceProvider::ResourceId id) { 50 void set_track_resource_id(ResourceProvider::ResourceId id) {
62 track_resource_id_ = id; 51 track_resource_id_ = id;
63 } 52 }
64 void set_thumb_resource_id(ResourceProvider::ResourceId id) { 53 void set_thumb_resource_id(ResourceProvider::ResourceId id) {
65 thumb_resource_id_ = id; 54 thumb_resource_id_ = id;
66 } 55 }
67 void set_visible_to_total_length_ratio(float ratio) {
68 visible_to_total_length_ratio_ = ratio;
69 }
70 void set_is_overlay_scrollbar(bool is_overlay_scrollbar) {
71 is_overlay_scrollbar_ = is_overlay_scrollbar;
72 }
73 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; }
74
75 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; }
76 void SetMaximum(int maximum) { maximum_ = maximum; }
77
78 gfx::Rect ComputeThumbQuadRect() const;
79 56
80 protected: 57 protected:
81 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, 58 ScrollbarLayerImpl(LayerTreeImpl* tree_impl,
82 int id, 59 int id,
83 ScrollbarOrientation orientation); 60 ScrollbarOrientation orientation);
84 61
62 virtual int ThumbThickness() const OVERRIDE;
enne (OOO) 2013/08/14 21:01:09 Comment about what class's functions these are ove
wjmaclean 2013/08/15 20:09:40 Done.
63 virtual int ThumbLength() const OVERRIDE;
64 virtual float TrackLength() const OVERRIDE;
65 virtual int TrackStart() const OVERRIDE;
66
85 private: 67 private:
86 virtual const char* LayerTypeAsString() const OVERRIDE; 68 virtual const char* LayerTypeAsString() const OVERRIDE;
87 69
88 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const;
89
90 ResourceProvider::ResourceId track_resource_id_; 70 ResourceProvider::ResourceId track_resource_id_;
91 ResourceProvider::ResourceId thumb_resource_id_; 71 ResourceProvider::ResourceId thumb_resource_id_;
92 72
93 float current_pos_;
94 int maximum_;
95 int thumb_thickness_; 73 int thumb_thickness_;
96 int thumb_length_; 74 int thumb_length_;
97 int track_start_; 75 int track_start_;
98 int track_length_; 76 int track_length_;
99 ScrollbarOrientation orientation_; 77 ScrollbarOrientation orientation_;
enne (OOO) 2013/08/14 21:01:09 Is this shadowing ScrollbarLayerImplBase::orientat
wjmaclean 2013/08/15 20:09:40 Done. Good catch!
100 78
101 // Difference between the clip layer's height and the visible viewport 79 // Difference between the clip layer's height and the visible viewport
102 // height (which may differ in the presence of top-controls hiding). 80 // height (which may differ in the presence of top-controls hiding).
103 float vertical_adjust_; 81 float vertical_adjust_;
104 82
105 float visible_to_total_length_ratio_; 83 float visible_to_total_length_ratio_;
106 84
107 int scroll_layer_id_; 85 int scroll_layer_id_;
108 86
109 bool is_overlay_scrollbar_;
110
111 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); 87 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl);
112 }; 88 };
113 89
114 } // namespace cc 90 } // namespace cc
115 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ 91 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698