OLD | NEW |
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_TREES_LAYER_TREE_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 }; | 26 }; |
27 } // namespace BASE_HASH_NAMESPACE | 27 } // namespace BASE_HASH_NAMESPACE |
28 #endif // COMPILER | 28 #endif // COMPILER |
29 | 29 |
30 namespace cc { | 30 namespace cc { |
31 | 31 |
32 class ContextProvider; | 32 class ContextProvider; |
33 class DebugRectHistory; | 33 class DebugRectHistory; |
34 class FrameRateCounter; | 34 class FrameRateCounter; |
35 class HeadsUpDisplayLayerImpl; | 35 class HeadsUpDisplayLayerImpl; |
| 36 class LayerScrollOffsetDelegateProxy; |
36 class LayerTreeDebugState; | 37 class LayerTreeDebugState; |
37 class LayerTreeHostImpl; | 38 class LayerTreeHostImpl; |
38 class LayerTreeImpl; | 39 class LayerTreeImpl; |
39 class LayerTreeSettings; | 40 class LayerTreeSettings; |
40 class MemoryHistory; | 41 class MemoryHistory; |
41 class OutputSurface; | 42 class OutputSurface; |
42 class PaintTimeCounter; | 43 class PaintTimeCounter; |
43 class Proxy; | 44 class Proxy; |
44 class ResourceProvider; | 45 class ResourceProvider; |
45 class TileManager; | 46 class TileManager; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int source_frame_number() const { return source_frame_number_; } | 106 int source_frame_number() const { return source_frame_number_; } |
106 void set_source_frame_number(int frame_number) { | 107 void set_source_frame_number(int frame_number) { |
107 source_frame_number_ = frame_number; | 108 source_frame_number_ = frame_number; |
108 } | 109 } |
109 | 110 |
110 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } | 111 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } |
111 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { | 112 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { |
112 hud_layer_ = layer_impl; | 113 hud_layer_ = layer_impl; |
113 } | 114 } |
114 | 115 |
115 LayerImpl* RootScrollLayer() const; | 116 LayerImpl* InnerViewportScrollLayer() const; |
| 117 // This function may return NULL, it is the caller's responsibility to check. |
| 118 LayerImpl* OuterViewportScrollLayer() const; |
| 119 gfx::Vector2dF TotalScrollOffset() const; |
| 120 gfx::Vector2dF TotalMaxScrollOffset() const; |
| 121 gfx::Vector2dF TotalScrollDelta() const; |
| 122 |
116 LayerImpl* RootContainerLayer() const; | 123 LayerImpl* RootContainerLayer() const; |
117 LayerImpl* CurrentlyScrollingLayer() const; | 124 LayerImpl* CurrentlyScrollingLayer() const; |
118 void SetCurrentlyScrollingLayer(LayerImpl* layer); | 125 void SetCurrentlyScrollingLayer(LayerImpl* layer); |
119 void ClearCurrentlyScrollingLayer(); | 126 void ClearCurrentlyScrollingLayer(); |
| 127 float VerticalAdjust(const LayerImpl* layer) const; |
120 | 128 |
121 void FindRootScrollLayer(); | |
122 void UpdateMaxScrollOffset(); | |
123 void SetViewportLayersFromIds(int page_scale_layer_id, | 129 void SetViewportLayersFromIds(int page_scale_layer_id, |
124 int inner_viewport_scroll_layer_id, | 130 int inner_viewport_scroll_layer_id, |
125 int outer_viewport_scroll_layer_id); | 131 int outer_viewport_scroll_layer_id); |
126 void ClearViewportLayers(); | 132 void ClearViewportLayers(); |
| 133 LayerImpl* page_scale_layer() { return page_scale_layer_; } |
127 void ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 134 void ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
128 void ApplyScrollDeltasSinceBeginMainFrame(); | 135 void ApplyScrollDeltasSinceBeginMainFrame(); |
129 | 136 |
130 SkColor background_color() const { return background_color_; } | 137 SkColor background_color() const { return background_color_; } |
131 void set_background_color(SkColor color) { background_color_ = color; } | 138 void set_background_color(SkColor color) { background_color_ = color; } |
132 | 139 |
133 bool has_transparent_background() const { | 140 bool has_transparent_background() const { |
134 return has_transparent_background_; | 141 return has_transparent_background_; |
135 } | 142 } |
136 void set_has_transparent_background(bool transparent) { | 143 void set_has_transparent_background(bool transparent) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // and the active tree's size is now out of date. | 206 // and the active tree's size is now out of date. |
200 bool ViewportSizeInvalid() const; | 207 bool ViewportSizeInvalid() const; |
201 void SetViewportSizeInvalid(); | 208 void SetViewportSizeInvalid(); |
202 void ResetViewportSizeInvalid(); | 209 void ResetViewportSizeInvalid(); |
203 | 210 |
204 // Useful for debug assertions, probably shouldn't be used for anything else. | 211 // Useful for debug assertions, probably shouldn't be used for anything else. |
205 Proxy* proxy() const; | 212 Proxy* proxy() const; |
206 | 213 |
207 void SetRootLayerScrollOffsetDelegate( | 214 void SetRootLayerScrollOffsetDelegate( |
208 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); | 215 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); |
| 216 void UpdateScrollOffsetDelegate(); |
| 217 gfx::Vector2dF GetDelegatedScrollOffset(LayerImpl* layer); |
209 | 218 |
210 // Call this function when you expect there to be a swap buffer. | 219 // Call this function when you expect there to be a swap buffer. |
211 // See swap_promise.h for how to use SwapPromise. | 220 // See swap_promise.h for how to use SwapPromise. |
212 void QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise); | 221 void QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise); |
213 | 222 |
214 // Take the |new_swap_promise| and append it to |swap_promise_list_|. | 223 // Take the |new_swap_promise| and append it to |swap_promise_list_|. |
215 void PassSwapPromises(ScopedPtrVector<SwapPromise>* new_swap_promise); | 224 void PassSwapPromises(ScopedPtrVector<SwapPromise>* new_swap_promise); |
216 void FinishSwapPromises(CompositorFrameMetadata* metadata); | 225 void FinishSwapPromises(CompositorFrameMetadata* metadata); |
217 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); | 226 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); |
218 | 227 |
219 void DidModifyTilePriorities(); | 228 void DidModifyTilePriorities(); |
220 | 229 |
221 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 230 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
222 void ProcessUIResourceRequestQueue(); | 231 void ProcessUIResourceRequestQueue(); |
223 | 232 |
224 bool IsUIResourceOpaque(UIResourceId uid) const; | 233 bool IsUIResourceOpaque(UIResourceId uid) const; |
225 | 234 |
226 void AddLayerWithCopyOutputRequest(LayerImpl* layer); | 235 void AddLayerWithCopyOutputRequest(LayerImpl* layer); |
227 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); | 236 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); |
228 const std::vector<LayerImpl*>& LayersWithCopyOutputRequest() const; | 237 const std::vector<LayerImpl*>& LayersWithCopyOutputRequest() const; |
229 | 238 |
230 protected: | 239 protected: |
231 explicit LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); | 240 explicit LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
232 | 241 |
233 void UpdateSolidColorScrollbars(); | |
234 | |
235 void UpdateRootScrollLayerSizeDelta(); | 242 void UpdateRootScrollLayerSizeDelta(); |
236 | 243 |
237 LayerTreeHostImpl* layer_tree_host_impl_; | 244 LayerTreeHostImpl* layer_tree_host_impl_; |
238 int source_frame_number_; | 245 int source_frame_number_; |
239 scoped_ptr<LayerImpl> root_layer_; | 246 scoped_ptr<LayerImpl> root_layer_; |
240 HeadsUpDisplayLayerImpl* hud_layer_; | 247 HeadsUpDisplayLayerImpl* hud_layer_; |
241 LayerImpl* root_scroll_layer_; | |
242 LayerImpl* currently_scrolling_layer_; | 248 LayerImpl* currently_scrolling_layer_; |
243 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; | 249 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; |
| 250 scoped_ptr<LayerScrollOffsetDelegateProxy> |
| 251 inner_viewport_scroll_delegate_proxy_; |
| 252 scoped_ptr<LayerScrollOffsetDelegateProxy> |
| 253 outer_viewport_scroll_delegate_proxy_; |
244 SkColor background_color_; | 254 SkColor background_color_; |
245 bool has_transparent_background_; | 255 bool has_transparent_background_; |
246 | 256 |
247 LayerImpl* page_scale_layer_; | 257 LayerImpl* page_scale_layer_; |
248 LayerImpl* inner_viewport_scroll_layer_; | 258 LayerImpl* inner_viewport_scroll_layer_; |
249 LayerImpl* outer_viewport_scroll_layer_; | 259 LayerImpl* outer_viewport_scroll_layer_; |
250 | 260 |
251 float page_scale_factor_; | 261 float page_scale_factor_; |
252 float page_scale_delta_; | 262 float page_scale_delta_; |
253 float sent_page_scale_delta_; | 263 float sent_page_scale_delta_; |
(...skipping 26 matching lines...) Expand all Loading... |
280 | 290 |
281 UIResourceRequestQueue ui_resource_request_queue_; | 291 UIResourceRequestQueue ui_resource_request_queue_; |
282 | 292 |
283 private: | 293 private: |
284 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 294 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
285 }; | 295 }; |
286 | 296 |
287 } // namespace cc | 297 } // namespace cc |
288 | 298 |
289 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 299 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |