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

Side by Side Diff: cc/layers/painted_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: Fix Windows compile. Created 7 years, 3 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
« no previous file with comments | « cc/layers/painted_scrollbar_layer.cc ('k') | cc/layers/painted_scrollbar_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_IMPL_H_ 5 #ifndef CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_
6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_ 6 #define CC_LAYERS_PAINTED_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 #include "cc/resources/ui_resource_client.h" 11 #include "cc/resources/ui_resource_client.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class LayerTreeImpl; 15 class LayerTreeImpl;
16 class ScrollView; 16 class ScrollView;
17 17
18 class CC_EXPORT PaintedScrollbarLayerImpl : public LayerImpl { 18 class CC_EXPORT PaintedScrollbarLayerImpl : public ScrollbarLayerImplBase {
19 public: 19 public:
20 static scoped_ptr<PaintedScrollbarLayerImpl> Create( 20 static scoped_ptr<PaintedScrollbarLayerImpl> Create(
21 LayerTreeImpl* tree_impl, 21 LayerTreeImpl* tree_impl,
22 int id, 22 int id,
23 ScrollbarOrientation orientation); 23 ScrollbarOrientation orientation);
24 virtual ~PaintedScrollbarLayerImpl(); 24 virtual ~PaintedScrollbarLayerImpl();
25 25
26 // LayerImpl implementation. 26 // LayerImpl implementation.
27 virtual PaintedScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE;
28 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
29 OVERRIDE; 28 OVERRIDE;
30 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
31 30
32 virtual bool WillDraw(DrawMode draw_mode, 31 virtual bool WillDraw(DrawMode draw_mode,
33 ResourceProvider* resource_provider) OVERRIDE; 32 ResourceProvider* resource_provider) OVERRIDE;
34 virtual void AppendQuads(QuadSink* quad_sink, 33 virtual void AppendQuads(QuadSink* quad_sink,
35 AppendQuadsData* append_quads_data) OVERRIDE; 34 AppendQuadsData* append_quads_data) OVERRIDE;
36 35
37 int scroll_layer_id() const { return scroll_layer_id_; } 36 virtual void DidLoseOutputSurface() OVERRIDE;
38 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; }
39
40 ScrollbarOrientation Orientation() const;
41 float CurrentPos() const;
42 int Maximum() const;
43 37
44 void SetThumbThickness(int thumb_thickness); 38 void SetThumbThickness(int thumb_thickness);
45 int thumb_thickness() const { return thumb_thickness_; } 39 int thumb_thickness() const { return thumb_thickness_; }
46 void SetThumbLength(int thumb_length); 40 void SetThumbLength(int thumb_length);
47 void SetTrackStart(int track_start); 41 void SetTrackStart(int track_start);
48 void SetTrackLength(int track_length); 42 void SetTrackLength(int track_length);
49 void SetVerticalAdjust(float vertical_adjust); 43
50 void set_track_ui_resource_id(UIResourceId uid) { 44 void set_track_ui_resource_id(UIResourceId uid) {
51 track_ui_resource_id_ = uid; 45 track_ui_resource_id_ = uid;
52 } 46 }
53 void set_thumb_ui_resource_id(UIResourceId uid) { 47 void set_thumb_ui_resource_id(UIResourceId uid) {
54 thumb_ui_resource_id_ = uid; 48 thumb_ui_resource_id_ = uid;
55 } 49 }
56 void SetVisibleToTotalLengthRatio(float ratio);
57 void set_is_overlay_scrollbar(bool is_overlay_scrollbar) {
58 is_overlay_scrollbar_ = is_overlay_scrollbar;
59 }
60 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; }
61
62 void SetCurrentPos(float current_pos);
63 void SetMaximum(int maximum);
64
65 gfx::Rect ComputeThumbQuadRect() const;
66 50
67 protected: 51 protected:
68 PaintedScrollbarLayerImpl(LayerTreeImpl* tree_impl, 52 PaintedScrollbarLayerImpl(LayerTreeImpl* tree_impl,
69 int id, 53 int id,
70 ScrollbarOrientation orientation); 54 ScrollbarOrientation orientation);
71 55
56 // ScrollbarLayerImplBase implementation.
57 virtual int ThumbThickness() const OVERRIDE;
58 virtual int ThumbLength() const OVERRIDE;
59 virtual float TrackLength() const OVERRIDE;
60 virtual int TrackStart() const OVERRIDE;
61
72 private: 62 private:
73 virtual const char* LayerTypeAsString() const OVERRIDE; 63 virtual const char* LayerTypeAsString() const OVERRIDE;
74 64
75 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const;
76
77 UIResourceId track_ui_resource_id_; 65 UIResourceId track_ui_resource_id_;
78 UIResourceId thumb_ui_resource_id_; 66 UIResourceId thumb_ui_resource_id_;
79 67
80 float current_pos_;
81 int maximum_;
82 int thumb_thickness_; 68 int thumb_thickness_;
83 int thumb_length_; 69 int thumb_length_;
84 int track_start_; 70 int track_start_;
85 int track_length_; 71 int track_length_;
86 ScrollbarOrientation orientation_;
87 72
88 // Difference between the clip layer's height and the visible viewport 73 // Difference between the clip layer's height and the visible viewport
89 // height (which may differ in the presence of top-controls hiding). 74 // height (which may differ in the presence of top-controls hiding).
90 float vertical_adjust_; 75 float vertical_adjust_;
91 76
92 float visible_to_total_length_ratio_;
93
94 int scroll_layer_id_; 77 int scroll_layer_id_;
95 78
96 bool is_overlay_scrollbar_;
97
98 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayerImpl); 79 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayerImpl);
99 }; 80 };
100 81
101 } // namespace cc 82 } // namespace cc
102 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_ 83 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer.cc ('k') | cc/layers/painted_scrollbar_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698