OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void OnScrollEvent(ui::ScrollEvent* event) override; | 99 void OnScrollEvent(ui::ScrollEvent* event) override; |
100 void OnGestureEvent(ui::GestureEvent* event) override; | 100 void OnGestureEvent(ui::GestureEvent* event) override; |
101 const char* GetClassName() const override; | 101 const char* GetClassName() const override; |
102 | 102 |
103 // ScrollBarController overrides: | 103 // ScrollBarController overrides: |
104 void ScrollToPosition(ScrollBar* source, int position) override; | 104 void ScrollToPosition(ScrollBar* source, int position) override; |
105 int GetScrollIncrement(ScrollBar* source, | 105 int GetScrollIncrement(ScrollBar* source, |
106 bool is_page, | 106 bool is_page, |
107 bool is_positive) override; | 107 bool is_positive) override; |
108 | 108 |
| 109 // Activate a Layer() for the |contents_viewport_| if the passed parameter is |
| 110 // true or any of the children in the ScrollView contains a layer. |
| 111 void ActivateLayer(bool force_layer_creation); |
| 112 |
109 private: | 113 private: |
110 friend class test::ScrollViewTestApi; | 114 friend class test::ScrollViewTestApi; |
111 | 115 |
112 class Viewport; | 116 class Viewport; |
113 | 117 |
114 // Used internally by SetHeader() and SetContents() to reset the view. Sets | 118 // Used internally by SetHeader() and SetContents() to reset the view. Sets |
115 // |member| to |new_view|. If |new_view| is non-null it is added to |parent|. | 119 // |member| to |new_view|. If |new_view| is non-null it is added to |parent|. |
116 void SetHeaderOrContents(View* parent, View* new_view, View** member); | 120 void SetHeaderOrContents(View* parent, View* new_view, View** member); |
117 | 121 |
118 // Scrolls the minimum amount necessary to make the specified rectangle | 122 // Scrolls the minimum amount necessary to make the specified rectangle |
(...skipping 17 matching lines...) Expand all Loading... |
136 void UpdateScrollBarPositions(); | 140 void UpdateScrollBarPositions(); |
137 | 141 |
138 // Helpers to get and set the current scroll offset (either from the ui::Layer | 142 // Helpers to get and set the current scroll offset (either from the ui::Layer |
139 // or from the |contents_| origin offset). | 143 // or from the |contents_| origin offset). |
140 gfx::ScrollOffset CurrentOffset() const; | 144 gfx::ScrollOffset CurrentOffset() const; |
141 void ScrollToOffset(const gfx::ScrollOffset& offset); | 145 void ScrollToOffset(const gfx::ScrollOffset& offset); |
142 | 146 |
143 // Whether the ScrollView scrolls using ui::Layer APIs. | 147 // Whether the ScrollView scrolls using ui::Layer APIs. |
144 bool ScrollsWithLayers() const; | 148 bool ScrollsWithLayers() const; |
145 | 149 |
| 150 // Whether any of the children in the |child|-rooted subtree has a layer. |
| 151 bool ChildrenLayerCheck(View* child) const; |
| 152 |
146 // Callback entrypoint when hosted Layers are scrolled by the Compositor. | 153 // Callback entrypoint when hosted Layers are scrolled by the Compositor. |
147 void OnLayerScrolled(); | 154 void OnLayerScrolled(); |
148 | 155 |
149 // Horizontally scrolls the header (if any) to match the contents. | 156 // Horizontally scrolls the header (if any) to match the contents. |
150 void ScrollHeader(); | 157 void ScrollHeader(); |
151 | 158 |
152 // The current contents and its viewport. |contents_| is contained in | 159 // The current contents and its viewport. |contents_| is contained in |
153 // |contents_viewport_|. | 160 // |contents_viewport_|. |
154 View* contents_; | 161 View* contents_; |
155 View* contents_viewport_; | 162 View* contents_viewport_; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 private: | 257 private: |
251 int top_margin_; | 258 int top_margin_; |
252 int row_height_; | 259 int row_height_; |
253 | 260 |
254 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); | 261 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); |
255 }; | 262 }; |
256 | 263 |
257 } // namespace views | 264 } // namespace views |
258 | 265 |
259 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 266 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
OLD | NEW |