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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 horiz->SetViewportWithinScrollableArea(scrollable_viewport, | 251 horiz->SetViewportWithinScrollableArea(scrollable_viewport, |
252 ScrollableSize()); | 252 ScrollableSize()); |
253 } | 253 } |
254 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 254 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { |
255 vertical->set_vertical_adjust(vertical_adjust); | 255 vertical->set_vertical_adjust(vertical_adjust); |
256 vertical->SetViewportWithinScrollableArea(scrollable_viewport, | 256 vertical->SetViewportWithinScrollableArea(scrollable_viewport, |
257 ScrollableSize()); | 257 ScrollableSize()); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 struct UpdateTilePrioritiesForLayer { | 261 void LayerTreeImpl::UpdateDrawProperties() { |
262 void operator()(LayerImpl *layer) { | |
263 layer->UpdateTilePriorities(); | |
264 } | |
265 }; | |
266 | |
267 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | |
268 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) | 262 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) |
269 UpdateRootScrollLayerSizeDelta(); | 263 UpdateRootScrollLayerSizeDelta(); |
270 | 264 |
271 if (settings().solid_color_scrollbars && | 265 if (settings().solid_color_scrollbars && |
272 IsActiveTree() && | 266 IsActiveTree() && |
273 RootScrollLayer()) { | 267 RootScrollLayer()) { |
274 UpdateSolidColorScrollbars(); | 268 UpdateSolidColorScrollbars(); |
275 | 269 |
276 // The top controls manager is incompatible with the WebKit-created cliprect | 270 // The top controls manager is incompatible with the WebKit-created cliprect |
277 // because it can bring into view a larger amount of content when it | 271 // because it can bring into view a larger amount of content when it |
278 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars | 272 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
279 // are present. | 273 // are present. |
280 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) | 274 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) |
281 RootClipLayer()->SetMasksToBounds(false); | 275 RootClipLayer()->SetMasksToBounds(false); |
282 } | 276 } |
283 | 277 |
284 if (!needs_update_draw_properties_) { | |
285 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && root_layer()) | |
286 LayerTreeHostCommon::CallFunctionForSubtree<UpdateTilePrioritiesForLayer>( | |
287 root_layer()); | |
288 return; | |
289 } | |
290 | |
291 needs_update_draw_properties_ = false; | 278 needs_update_draw_properties_ = false; |
292 render_surface_layer_list_.clear(); | 279 render_surface_layer_list_.clear(); |
293 | 280 |
294 // For max_texture_size. | 281 // For max_texture_size. |
295 if (!layer_tree_host_impl_->renderer()) | 282 if (!layer_tree_host_impl_->renderer()) |
296 return; | 283 return; |
297 | 284 |
298 if (!root_layer()) | 285 if (!root_layer()) |
299 return; | 286 return; |
300 | 287 |
301 { | 288 { |
302 TRACE_EVENT1("cc", | 289 TRACE_EVENT1("cc", |
303 "LayerTreeImpl::UpdateDrawProperties", | 290 "LayerTreeImpl::UpdateDrawProperties", |
304 "IsActive", | 291 "IsActive", |
305 IsActiveTree()); | 292 IsActiveTree()); |
306 bool update_tile_priorities = | |
307 reason == UPDATE_PENDING_TREE || | |
308 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; | |
309 LayerTreeHostCommon::CalculateDrawProperties( | 293 LayerTreeHostCommon::CalculateDrawProperties( |
310 root_layer(), | 294 root_layer(), |
311 device_viewport_size(), | 295 device_viewport_size(), |
312 device_scale_factor(), | 296 device_scale_factor(), |
313 total_page_scale_factor(), | 297 total_page_scale_factor(), |
314 root_scroll_layer_, | 298 root_scroll_layer_, |
315 MaxTextureSize(), | 299 MaxTextureSize(), |
316 settings().can_use_lcd_text, | 300 settings().can_use_lcd_text, |
317 &render_surface_layer_list_, | 301 &render_surface_layer_list_); |
318 update_tile_priorities); | |
319 } | 302 } |
320 | 303 |
321 DCHECK(!needs_update_draw_properties_) << | 304 DCHECK(!needs_update_draw_properties_) << |
322 "calcDrawProperties should not set_needs_update_draw_properties()"; | 305 "CalcDrawProperties should not set_needs_update_draw_properties()"; |
323 } | 306 } |
324 | 307 |
325 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { | 308 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { |
326 DCHECK(current); | 309 DCHECK(current); |
327 for (size_t i = 0; i < current->children().size(); ++i) | 310 for (size_t i = 0; i < current->children().size(); ++i) |
328 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); | 311 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); |
329 current->ClearRenderSurface(); | 312 current->ClearRenderSurface(); |
330 } | 313 } |
331 | 314 |
332 void LayerTreeImpl::ClearRenderSurfaces() { | 315 void LayerTreeImpl::ClearRenderSurfaces() { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 689 |
707 const LatencyInfo& LayerTreeImpl::GetLatencyInfo() { | 690 const LatencyInfo& LayerTreeImpl::GetLatencyInfo() { |
708 return latency_info_; | 691 return latency_info_; |
709 } | 692 } |
710 | 693 |
711 void LayerTreeImpl::ClearLatencyInfo() { | 694 void LayerTreeImpl::ClearLatencyInfo() { |
712 latency_info_.Clear(); | 695 latency_info_.Clear(); |
713 } | 696 } |
714 | 697 |
715 } // namespace cc | 698 } // namespace cc |
OLD | NEW |