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

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

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 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/layer_impl.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 typedef int UIResourceId;
18
17 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl { 19 class CC_EXPORT ScrollbarLayerImpl : public LayerImpl {
18 public: 20 public:
19 static scoped_ptr<ScrollbarLayerImpl> Create( 21 static scoped_ptr<ScrollbarLayerImpl> Create(
20 LayerTreeImpl* tree_impl, 22 LayerTreeImpl* tree_impl,
21 int id, 23 int id,
22 ScrollbarOrientation orientation); 24 ScrollbarOrientation orientation);
23 virtual ~ScrollbarLayerImpl(); 25 virtual ~ScrollbarLayerImpl();
24 26
25 // LayerImpl implementation. 27 // LayerImpl implementation.
26 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE; 28 virtual ScrollbarLayerImpl* ToScrollbarLayer() OVERRIDE;
27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 29 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
28 OVERRIDE; 30 OVERRIDE;
29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 31 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
30 32
31 virtual bool WillDraw(DrawMode draw_mode, 33 virtual bool WillDraw(DrawMode draw_mode,
32 ResourceProvider* resource_provider) OVERRIDE; 34 ResourceProvider* resource_provider) OVERRIDE;
33 virtual void AppendQuads(QuadSink* quad_sink, 35 virtual void AppendQuads(QuadSink* quad_sink,
34 AppendQuadsData* append_quads_data) OVERRIDE; 36 AppendQuadsData* append_quads_data) OVERRIDE;
35 37
36 virtual void DidLoseOutputSurface() OVERRIDE;
37
38 int scroll_layer_id() const { return scroll_layer_id_; } 38 int scroll_layer_id() const { return scroll_layer_id_; }
39 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } 39 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; }
40 40
41 ScrollbarOrientation Orientation() const; 41 ScrollbarOrientation Orientation() const;
42 float CurrentPos() const; 42 float CurrentPos() const;
43 int Maximum() const; 43 int Maximum() const;
44 44
45 void set_thumb_thickness(int thumb_thickness) { 45 void set_thumb_thickness(int thumb_thickness) {
46 thumb_thickness_ = thumb_thickness; 46 thumb_thickness_ = thumb_thickness;
47 } 47 }
48 int thumb_thickness() const { return thumb_thickness_; } 48 int thumb_thickness() const { return thumb_thickness_; }
49 void set_thumb_length(int thumb_length) { 49 void set_thumb_length(int thumb_length) {
50 thumb_length_ = thumb_length; 50 thumb_length_ = thumb_length;
51 } 51 }
52 void set_track_start(int track_start) { 52 void set_track_start(int track_start) {
53 track_start_ = track_start; 53 track_start_ = track_start;
54 } 54 }
55 void set_track_length(int track_length) { 55 void set_track_length(int track_length) {
56 track_length_ = track_length; 56 track_length_ = track_length;
57 } 57 }
58 void set_vertical_adjust(float vertical_adjust) { 58 void set_vertical_adjust(float vertical_adjust) {
59 vertical_adjust_ = vertical_adjust; 59 vertical_adjust_ = vertical_adjust;
60 } 60 }
61 void set_track_resource_id(ResourceProvider::ResourceId id) { 61 void set_track_ui_resource_id(UIResourceId uid) {
62 track_resource_id_ = id; 62 track_ui_resource_id_ = uid;
63 } 63 }
64 void set_thumb_resource_id(ResourceProvider::ResourceId id) { 64 void set_thumb_ui_resource_id(UIResourceId uid) {
65 thumb_resource_id_ = id; 65 thumb_ui_resource_id_ = uid;
66 } 66 }
67 void set_visible_to_total_length_ratio(float ratio) { 67 void set_visible_to_total_length_ratio(float ratio) {
68 visible_to_total_length_ratio_ = ratio; 68 visible_to_total_length_ratio_ = ratio;
69 } 69 }
70 void set_is_overlay_scrollbar(bool is_overlay_scrollbar) { 70 void set_is_overlay_scrollbar(bool is_overlay_scrollbar) {
71 is_overlay_scrollbar_ = is_overlay_scrollbar; 71 is_overlay_scrollbar_ = is_overlay_scrollbar;
72 } 72 }
73 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } 73 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; }
74 74
75 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; } 75 void SetCurrentPos(float current_pos) { current_pos_ = current_pos; }
76 void SetMaximum(int maximum) { maximum_ = maximum; } 76 void SetMaximum(int maximum) { maximum_ = maximum; }
77 77
78 gfx::Rect ComputeThumbQuadRect() const; 78 gfx::Rect ComputeThumbQuadRect() const;
79 79
80 protected: 80 protected:
81 ScrollbarLayerImpl(LayerTreeImpl* tree_impl, 81 ScrollbarLayerImpl(LayerTreeImpl* tree_impl,
82 int id, 82 int id,
83 ScrollbarOrientation orientation); 83 ScrollbarOrientation orientation);
84 84
85 private: 85 private:
86 virtual const char* LayerTypeAsString() const OVERRIDE; 86 virtual const char* LayerTypeAsString() const OVERRIDE;
87 87
88 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const; 88 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const;
89 89
90 ResourceProvider::ResourceId track_resource_id_; 90 UIResourceId track_ui_resource_id_;
91 ResourceProvider::ResourceId thumb_resource_id_; 91 UIResourceId thumb_ui_resource_id_;
92 92
93 float current_pos_; 93 float current_pos_;
94 int maximum_; 94 int maximum_;
95 int thumb_thickness_; 95 int thumb_thickness_;
96 int thumb_length_; 96 int thumb_length_;
97 int track_start_; 97 int track_start_;
98 int track_length_; 98 int track_length_;
99 ScrollbarOrientation orientation_; 99 ScrollbarOrientation orientation_;
100 100
101 // Difference between the clip layer's height and the visible viewport 101 // Difference between the clip layer's height and the visible viewport
102 // height (which may differ in the presence of top-controls hiding). 102 // height (which may differ in the presence of top-controls hiding).
103 float vertical_adjust_; 103 float vertical_adjust_;
104 104
105 float visible_to_total_length_ratio_; 105 float visible_to_total_length_ratio_;
106 106
107 int scroll_layer_id_; 107 int scroll_layer_id_;
108 108
109 bool is_overlay_scrollbar_; 109 bool is_overlay_scrollbar_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl); 111 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImpl);
112 }; 112 };
113 113
114 } // namespace cc 114 } // namespace cc
115 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_ 115 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698