OLD | NEW |
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 "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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 bool is_left_side_vertical_scrollbar() { | 39 bool is_left_side_vertical_scrollbar() { |
40 return is_left_side_vertical_scrollbar_; | 40 return is_left_side_vertical_scrollbar_; |
41 } | 41 } |
42 | 42 |
43 bool CanScrollOrientation() const; | 43 bool CanScrollOrientation() const; |
44 | 44 |
45 void PushPropertiesTo(LayerImpl* layer) override; | 45 void PushPropertiesTo(LayerImpl* layer) override; |
46 ScrollbarLayerImplBase* ToScrollbarLayer() override; | 46 ScrollbarLayerImplBase* ToScrollbarLayer() override; |
47 | 47 |
48 // Thumb quad rect in layer space. | 48 // Thumb quad rect in layer space. |
49 virtual gfx::Rect ComputeThumbQuadRect() const; | 49 gfx::Rect ComputeThumbQuadRect() const; |
| 50 gfx::Rect ComputeExpandedThumbQuadRect() const; |
50 | 51 |
51 float thumb_thickness_scale_factor() { | 52 float thumb_thickness_scale_factor() { |
52 return thumb_thickness_scale_factor_; | 53 return thumb_thickness_scale_factor_; |
53 } | 54 } |
54 bool SetThumbThicknessScaleFactor(float thumb_thickness_scale_factor); | 55 bool SetThumbThicknessScaleFactor(float thumb_thickness_scale_factor); |
55 | 56 |
56 virtual int ThumbThickness() const = 0; | 57 virtual int ThumbThickness() const = 0; |
57 | 58 |
58 // TODO(crbug.com/702832): No need for this function once there is element id | 59 // TODO(crbug.com/702832): No need for this function once there is element id |
59 // on overlay scrollbar layers. | 60 // on overlay scrollbar layers. |
60 void SetOverlayScrollbarLayerOpacityAnimated(float opacity); | 61 void SetOverlayScrollbarLayerOpacityAnimated(float opacity); |
61 | 62 |
62 protected: | 63 protected: |
63 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, | 64 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl, |
64 int id, | 65 int id, |
65 ScrollbarOrientation orientation, | 66 ScrollbarOrientation orientation, |
66 bool is_left_side_vertical_scrollbar, | 67 bool is_left_side_vertical_scrollbar, |
67 bool is_overlay); | 68 bool is_overlay); |
68 ~ScrollbarLayerImplBase() override; | 69 ~ScrollbarLayerImplBase() override; |
69 | 70 |
70 virtual int ThumbLength() const = 0; | 71 virtual int ThumbLength() const = 0; |
71 virtual float TrackLength() const = 0; | 72 virtual float TrackLength() const = 0; |
72 virtual int TrackStart() const = 0; | 73 virtual int TrackStart() const = 0; |
73 // Indicates whether the thumb length can be changed without going back to the | 74 // Indicates whether the thumb length can be changed without going back to the |
74 // main thread. | 75 // main thread. |
75 virtual bool IsThumbResizable() const = 0; | 76 virtual bool IsThumbResizable() const = 0; |
76 | 77 |
77 private: | 78 private: |
| 79 gfx::Rect ComputeThumbQuadRectWithThumbThicknessScale( |
| 80 float thumb_thickness_scale_factor) const; |
| 81 |
78 ElementId scroll_element_id_; | 82 ElementId scroll_element_id_; |
79 bool is_overlay_scrollbar_; | 83 bool is_overlay_scrollbar_; |
80 | 84 |
81 float thumb_thickness_scale_factor_; | 85 float thumb_thickness_scale_factor_; |
82 float current_pos_; | 86 float current_pos_; |
83 float clip_layer_length_; | 87 float clip_layer_length_; |
84 float scroll_layer_length_; | 88 float scroll_layer_length_; |
85 ScrollbarOrientation orientation_; | 89 ScrollbarOrientation orientation_; |
86 bool is_left_side_vertical_scrollbar_; | 90 bool is_left_side_vertical_scrollbar_; |
87 | 91 |
88 // Difference between the clip layer's height and the visible viewport | 92 // Difference between the clip layer's height and the visible viewport |
89 // height (which may differ in the presence of top-controls hiding). | 93 // height (which may differ in the presence of top-controls hiding). |
90 float vertical_adjust_; | 94 float vertical_adjust_; |
91 | 95 |
92 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); | 96 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase); |
93 }; | 97 }; |
94 | 98 |
95 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet; | 99 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet; |
96 | 100 |
97 } // namespace cc | 101 } // namespace cc |
98 | 102 |
99 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ | 103 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_ |
OLD | NEW |