OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 horiz->SetViewportWithinScrollableArea(scrollable_viewport, | 247 horiz->SetViewportWithinScrollableArea(scrollable_viewport, |
248 ScrollableSize()); | 248 ScrollableSize()); |
249 } | 249 } |
250 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 250 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { |
251 vertical->set_vertical_adjust(vertical_adjust); | 251 vertical->set_vertical_adjust(vertical_adjust); |
252 vertical->SetViewportWithinScrollableArea(scrollable_viewport, | 252 vertical->SetViewportWithinScrollableArea(scrollable_viewport, |
253 ScrollableSize()); | 253 ScrollableSize()); |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 struct UpdateTilePrioritiesForLayer { | 257 void LayerTreeImpl::UpdateDrawProperties() { |
258 void operator()(LayerImpl *layer) { | |
259 layer->UpdateTilePriorities(); | |
260 } | |
261 }; | |
262 | |
263 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | |
264 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) | 258 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) |
265 UpdateRootScrollLayerSizeDelta(); | 259 UpdateRootScrollLayerSizeDelta(); |
266 | 260 |
267 if (settings().solid_color_scrollbars && | 261 if (settings().solid_color_scrollbars && |
268 IsActiveTree() && | 262 IsActiveTree() && |
269 RootScrollLayer()) { | 263 RootScrollLayer()) { |
270 UpdateSolidColorScrollbars(); | 264 UpdateSolidColorScrollbars(); |
271 | 265 |
272 // The top controls manager is incompatible with the WebKit-created cliprect | 266 // The top controls manager is incompatible with the WebKit-created cliprect |
273 // because it can bring into view a larger amount of content when it | 267 // because it can bring into view a larger amount of content when it |
274 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars | 268 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
275 // are present. | 269 // are present. |
276 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) | 270 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) |
277 RootClipLayer()->SetMasksToBounds(false); | 271 RootClipLayer()->SetMasksToBounds(false); |
278 } | 272 } |
279 | 273 |
280 if (!needs_update_draw_properties_) { | |
281 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && root_layer()) | |
282 LayerTreeHostCommon::CallFunctionForSubtree<UpdateTilePrioritiesForLayer>( | |
283 root_layer()); | |
284 return; | |
285 } | |
286 | |
287 needs_update_draw_properties_ = false; | 274 needs_update_draw_properties_ = false; |
288 render_surface_layer_list_.clear(); | 275 render_surface_layer_list_.clear(); |
289 | 276 |
290 // For max_texture_size. | 277 // For max_texture_size. |
291 if (!layer_tree_host_impl_->renderer()) | 278 if (!layer_tree_host_impl_->renderer()) |
292 return; | 279 return; |
293 | 280 |
294 if (!root_layer()) | 281 if (!root_layer()) |
295 return; | 282 return; |
296 | 283 |
297 if (root_scroll_layer_) { | 284 if (root_scroll_layer_) { |
298 root_scroll_layer_->SetImplTransform(ImplTransform()); | 285 root_scroll_layer_->SetImplTransform(ImplTransform()); |
299 // Setting the impl transform re-sets this. | 286 // Setting the impl transform re-sets this. |
300 needs_update_draw_properties_ = false; | 287 needs_update_draw_properties_ = false; |
301 } | 288 } |
302 | 289 |
303 { | 290 { |
304 TRACE_EVENT1("cc", | 291 TRACE_EVENT1("cc", |
305 "LayerTreeImpl::UpdateDrawProperties", | 292 "LayerTreeImpl::UpdateDrawProperties", |
306 "IsActive", | 293 "IsActive", |
307 IsActiveTree()); | 294 IsActiveTree()); |
308 bool update_tile_priorities = | |
309 reason == UPDATE_PENDING_TREE || | |
310 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; | |
311 LayerTreeHostCommon::CalculateDrawProperties( | 295 LayerTreeHostCommon::CalculateDrawProperties( |
312 root_layer(), | 296 root_layer(), |
313 device_viewport_size(), | 297 device_viewport_size(), |
314 device_scale_factor(), | 298 device_scale_factor(), |
315 total_page_scale_factor(), | 299 total_page_scale_factor(), |
316 MaxTextureSize(), | 300 MaxTextureSize(), |
317 settings().can_use_lcd_text, | 301 settings().can_use_lcd_text, |
318 &render_surface_layer_list_, | 302 &render_surface_layer_list_); |
319 update_tile_priorities); | |
320 } | 303 } |
321 | 304 |
322 DCHECK(!needs_update_draw_properties_) << | 305 DCHECK(!needs_update_draw_properties_) << |
323 "calcDrawProperties should not set_needs_update_draw_properties()"; | 306 "CalcDrawProperties should not set_needs_update_draw_properties()"; |
324 } | 307 } |
325 | 308 |
326 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { | 309 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { |
327 DCHECK(current); | 310 DCHECK(current); |
328 for (size_t i = 0; i < current->children().size(); ++i) | 311 for (size_t i = 0; i < current->children().size(); ++i) |
329 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); | 312 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); |
330 current->ClearRenderSurface(); | 313 current->ClearRenderSurface(); |
331 } | 314 } |
332 | 315 |
333 void LayerTreeImpl::ClearRenderSurfaces() { | 316 void LayerTreeImpl::ClearRenderSurfaces() { |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 | 681 |
699 const LatencyInfo& LayerTreeImpl::GetLatencyInfo() { | 682 const LatencyInfo& LayerTreeImpl::GetLatencyInfo() { |
700 return latency_info_; | 683 return latency_info_; |
701 } | 684 } |
702 | 685 |
703 void LayerTreeImpl::ClearLatencyInfo() { | 686 void LayerTreeImpl::ClearLatencyInfo() { |
704 latency_info_.Clear(); | 687 latency_info_.Clear(); |
705 } | 688 } |
706 | 689 |
707 } // namespace cc | 690 } // namespace cc |
OLD | NEW |