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

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

Issue 23983047: Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r248052. Created 6 years, 10 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_impl.cc ('k') | cc/layers/scrollbar_layer_impl_base.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_SCROLLBAR_LAYER_IMPL_BASE_H_ 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ 6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_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.h"
10 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 class LayerTreeImpl; 15 class LayerTreeImpl;
15 16
16 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl { 17 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl {
17 public: 18 public:
18 int ScrollLayerId() const { return scroll_layer_id_; } 19 int ScrollLayerId() const {
19 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; } 20 return scroll_layer_ ? scroll_layer_->id() : Layer::INVALID_ID;
21 }
22 void ClearScrollLayer() { scroll_layer_ = NULL; }
23 void SetScrollLayerById(int id);
24 int ClipLayerId() const {
25 return clip_layer_ ? clip_layer_->id() : Layer::INVALID_ID;
26 }
27 void ClearClipLayer() { clip_layer_ = NULL; }
28 void SetClipLayerById(int id);
20 29
21 float current_pos() const { return current_pos_; } 30 float current_pos() const { return current_pos_; }
22 void SetCurrentPos(float current_pos); 31 void SetCurrentPos(float current_pos);
23 int maximum() const { return maximum_; } 32 int maximum() const { return maximum_; }
24 void SetMaximum(int maximum); 33 void SetMaximum(int maximum);
25 34
26 void SetVerticalAdjust(float vertical_adjust); 35 void SetVerticalAdjust(float vertical_adjust);
27 36
28 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; } 37 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; }
29 void set_is_overlay_scrollbar(bool is_overlay) { 38 void set_is_overlay_scrollbar(bool is_overlay) {
30 is_overlay_scrollbar_ = is_overlay; 39 is_overlay_scrollbar_ = is_overlay;
31 } 40 }
32 41
33 ScrollbarOrientation orientation() const { return orientation_; } 42 ScrollbarOrientation orientation() const { return orientation_; }
34 bool is_left_side_vertical_scrollbar() { 43 bool is_left_side_vertical_scrollbar() {
35 return is_left_side_vertical_scrollbar_; 44 return is_left_side_vertical_scrollbar_;
36 } 45 }
37 46
38 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 47 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
39 virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE; 48 virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE;
49 void PushScrollClipPropertiesTo(LayerImpl* layer);
40 50
41 void SetVisibleToTotalLengthRatio(float ratio); 51 void SetVisibleToTotalLengthRatio(float ratio);
42 virtual gfx::Rect ComputeThumbQuadRect() const; 52 virtual gfx::Rect ComputeThumbQuadRect() const;
43 53
44 float thumb_thickness_scale_factor() { 54 float thumb_thickness_scale_factor() {
45 return thumb_thickness_scale_factor_; 55 return thumb_thickness_scale_factor_;
46 } 56 }
47 void SetThumbThicknessScaleFactor(float thumb_thickness_scale_factor); 57 void SetThumbThicknessScaleFactor(float thumb_thickness_scale_factor);
48 58
59 void ScrollbarParametersDidChange();
60
49 protected: 61 protected:
50 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, 62 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl,
51 int id, 63 int id,
52 ScrollbarOrientation orientation, 64 ScrollbarOrientation orientation,
53 bool is_left_side_vertical_scrollbar); 65 bool is_left_side_vertical_scrollbar,
54 virtual ~ScrollbarLayerImplBase() {} 66 bool is_overlay);
67 virtual ~ScrollbarLayerImplBase();
55 68
56 gfx::Rect ScrollbarLayerRectToContentRect(const gfx::RectF& layer_rect) const; 69 gfx::Rect ScrollbarLayerRectToContentRect(const gfx::RectF& layer_rect) const;
57 70
58 float visible_to_total_length_ratio() const { 71 float visible_to_total_length_ratio() const {
59 return visible_to_total_length_ratio_; 72 return visible_to_total_length_ratio_;
60 } 73 }
61 float vertical_adjust() const { return vertical_adjust_; } 74 float vertical_adjust() const { return vertical_adjust_; }
62 75
63 virtual int ThumbThickness() const = 0; 76 virtual int ThumbThickness() const = 0;
64 virtual int ThumbLength() const = 0; 77 virtual int ThumbLength() const = 0;
65 virtual float TrackLength() const = 0; 78 virtual float TrackLength() const = 0;
66 virtual int TrackStart() const = 0; 79 virtual int TrackStart() const = 0;
67 // Indicates whether the thumb length can be changed without going back to the 80 // Indicates whether the thumb length can be changed without going back to the
68 // main thread. 81 // main thread.
69 virtual bool IsThumbResizable() const = 0; 82 virtual bool IsThumbResizable() const = 0;
70 83
71 private: 84 private:
72 int scroll_layer_id_; 85 LayerImpl* scroll_layer_;
86 LayerImpl* clip_layer_;
73 bool is_overlay_scrollbar_; 87 bool is_overlay_scrollbar_;
74 88
75 float thumb_thickness_scale_factor_; 89 float thumb_thickness_scale_factor_;
76 float current_pos_; 90 float current_pos_;
77 int maximum_; 91 int maximum_;
78 ScrollbarOrientation orientation_; 92 ScrollbarOrientation orientation_;
79 bool is_left_side_vertical_scrollbar_; 93 bool is_left_side_vertical_scrollbar_;
80 94
81 // Difference between the clip layer's height and the visible viewport 95 // Difference between the clip layer's height and the visible viewport
82 // height (which may differ in the presence of top-controls hiding). 96 // height (which may differ in the presence of top-controls hiding).
83 float vertical_adjust_; 97 float vertical_adjust_;
84 98
85 float visible_to_total_length_ratio_; 99 float visible_to_total_length_ratio_;
86 100
87 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); 101 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase);
88 }; 102 };
89 103
90 } // namespace cc 104 } // namespace cc
91 105
92 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ 106 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl.cc ('k') | cc/layers/scrollbar_layer_impl_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698