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_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) { | 336 bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) { |
337 if (!EnsureRenderSurfaceLayerList()) | 337 if (!EnsureRenderSurfaceLayerList()) |
338 return false; | 338 return false; |
339 | 339 |
340 gfx::PointF device_viewport_point = | 340 gfx::PointF device_viewport_point = |
341 gfx::ScalePoint(viewport_point, device_scale_factor_); | 341 gfx::ScalePoint(viewport_point, device_scale_factor_); |
342 | 342 |
343 // First find out which layer was hit from the saved list of visible layers | 343 // First find out which layer was hit from the saved list of visible layers |
344 // in the most recent frame. | 344 // in the most recent frame. |
345 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 345 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint( |
346 device_viewport_point, | 346 device_viewport_point, |
347 active_tree_->RenderSurfaceLayerList()); | 347 active_tree_->RenderSurfaceLayerList()); |
348 | 348 |
349 // Walk up the hierarchy and look for a layer with a touch event handler | 349 // Walk up the hierarchy and look for a layer with a touch event handler |
350 // region that the given point hits. | 350 // region that the given point hits. |
351 for (; layer_impl; layer_impl = layer_impl->parent()) { | 351 for (; layer_impl; layer_impl = layer_impl->parent()) { |
352 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, | 352 if (LayerTreeHostCommon::layerHasTouchEventHandlersAt(device_viewport_point, |
353 layer_impl)) | 353 layer_impl)) |
354 return true; | 354 return true; |
355 } | 355 } |
356 | 356 |
357 return false; | 357 return false; |
358 } | 358 } |
359 | 359 |
360 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 360 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
361 LayerImpl* root_draw_layer, | 361 LayerImpl* root_draw_layer, |
362 const LayerList& render_surface_layer_list) { | 362 const LayerList& render_surface_layer_list) { |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 ClearCurrentlyScrollingLayer(); | 1368 ClearCurrentlyScrollingLayer(); |
1369 | 1369 |
1370 if (!EnsureRenderSurfaceLayerList()) | 1370 if (!EnsureRenderSurfaceLayerList()) |
1371 return ScrollIgnored; | 1371 return ScrollIgnored; |
1372 | 1372 |
1373 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 1373 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
1374 device_scale_factor_); | 1374 device_scale_factor_); |
1375 | 1375 |
1376 // First find out which layer was hit from the saved list of visible layers | 1376 // First find out which layer was hit from the saved list of visible layers |
1377 // in the most recent frame. | 1377 // in the most recent frame. |
1378 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 1378 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint( |
1379 device_viewport_point, active_tree_->RenderSurfaceLayerList()); | 1379 device_viewport_point, active_tree_->RenderSurfaceLayerList()); |
1380 | 1380 |
1381 // Walk up the hierarchy and look for a scrollable layer. | 1381 // Walk up the hierarchy and look for a scrollable layer. |
1382 LayerImpl* potentially_scrolling_layer_impl = 0; | 1382 LayerImpl* potentially_scrolling_layer_impl = 0; |
1383 for (; layer_impl; layer_impl = layer_impl->parent()) { | 1383 for (; layer_impl; layer_impl = layer_impl->parent()) { |
1384 // The content layer can also block attempts to scroll outside the main | 1384 // The content layer can also block attempts to scroll outside the main |
1385 // thread. | 1385 // thread. |
1386 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); | 1386 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); |
1387 if (status == ScrollOnMainThread) { | 1387 if (status == ScrollOnMainThread) { |
1388 rendering_stats_instrumentation_->IncrementMainThreadScrolls(); | 1388 rendering_stats_instrumentation_->IncrementMainThreadScrolls(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 | 1695 |
1696 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 1696 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
1697 LayerImpl* layer_impl) { | 1697 LayerImpl* layer_impl) { |
1698 if (!layer_impl) | 1698 if (!layer_impl) |
1699 return; | 1699 return; |
1700 | 1700 |
1701 gfx::Vector2d scroll_delta = | 1701 gfx::Vector2d scroll_delta = |
1702 gfx::ToFlooredVector2d(layer_impl->scroll_delta()); | 1702 gfx::ToFlooredVector2d(layer_impl->scroll_delta()); |
1703 if (!scroll_delta.IsZero()) { | 1703 if (!scroll_delta.IsZero()) { |
1704 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 1704 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
1705 scroll.layer_id = layer_impl->id(); | 1705 scroll.layerId = layer_impl->id(); |
1706 scroll.scroll_delta = scroll_delta; | 1706 scroll.scrollDelta = scroll_delta; |
1707 scroll_info->scrolls.push_back(scroll); | 1707 scroll_info->scrolls.push_back(scroll); |
1708 layer_impl->SetSentScrollDelta(scroll_delta); | 1708 layer_impl->SetSentScrollDelta(scroll_delta); |
1709 } | 1709 } |
1710 | 1710 |
1711 for (size_t i = 0; i < layer_impl->children().size(); ++i) | 1711 for (size_t i = 0; i < layer_impl->children().size(); ++i) |
1712 CollectScrollDeltas(scroll_info, layer_impl->children()[i]); | 1712 CollectScrollDeltas(scroll_info, layer_impl->children()[i]); |
1713 } | 1713 } |
1714 | 1714 |
1715 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 1715 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
1716 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 1716 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
1717 | 1717 |
1718 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); | 1718 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); |
1719 scroll_info->page_scale_delta = active_tree_->page_scale_delta(); | 1719 scroll_info->pageScaleDelta = active_tree_->page_scale_delta(); |
1720 active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); | 1720 active_tree_->set_sent_page_scale_delta(scroll_info->pageScaleDelta); |
1721 | 1721 |
1722 return scroll_info.Pass(); | 1722 return scroll_info.Pass(); |
1723 } | 1723 } |
1724 | 1724 |
1725 void LayerTreeHostImpl::SetFullRootLayerDamage() { | 1725 void LayerTreeHostImpl::SetFullRootLayerDamage() { |
1726 if (active_tree_->root_layer()) { | 1726 if (active_tree_->root_layer()) { |
1727 RenderSurfaceImpl* render_surface = | 1727 RenderSurfaceImpl* render_surface = |
1728 active_tree_->root_layer()->render_surface(); | 1728 active_tree_->root_layer()->render_surface(); |
1729 if (render_surface) | 1729 if (render_surface) |
1730 render_surface->damage_tracker()->ForceFullDamageNextUpdate(); | 1730 render_surface->damage_tracker()->ForceFullDamageNextUpdate(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 debug_state_ = debug_state; | 2022 debug_state_ = debug_state; |
2023 } | 2023 } |
2024 | 2024 |
2025 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, | 2025 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, |
2026 int commit_number) { | 2026 int commit_number) { |
2027 DCHECK(debug_state_.continuous_painting); | 2027 DCHECK(debug_state_.continuous_painting); |
2028 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); | 2028 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); |
2029 } | 2029 } |
2030 | 2030 |
2031 } // namespace cc | 2031 } // namespace cc |
OLD | NEW |