| 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 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 SetDebugState(settings.initial_debug_state); | 234 SetDebugState(settings.initial_debug_state); |
| 235 | 235 |
| 236 // LTHI always has an active tree. | 236 // LTHI always has an active tree. |
| 237 active_tree_ = | 237 active_tree_ = |
| 238 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), | 238 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), |
| 239 new SyncedTopControls, new SyncedElasticOverscroll); | 239 new SyncedTopControls, new SyncedElasticOverscroll); |
| 240 | 240 |
| 241 TRACE_EVENT_OBJECT_CREATED_WITH_ID( | 241 TRACE_EVENT_OBJECT_CREATED_WITH_ID( |
| 242 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 242 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 243 | 243 |
| 244 if (settings.calculate_top_controls_position) { | 244 top_controls_manager_ = |
| 245 top_controls_manager_ = | 245 TopControlsManager::Create(this, |
| 246 TopControlsManager::Create(this, | 246 settings.top_controls_show_threshold, |
| 247 settings.top_controls_show_threshold, | 247 settings.top_controls_hide_threshold); |
| 248 settings.top_controls_hide_threshold); | |
| 249 } | |
| 250 } | 248 } |
| 251 | 249 |
| 252 LayerTreeHostImpl::~LayerTreeHostImpl() { | 250 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 253 DCHECK(proxy_->IsImplThread()); | 251 DCHECK(proxy_->IsImplThread()); |
| 254 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 252 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 255 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 253 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 256 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 254 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 257 | 255 |
| 258 if (input_handler_client_) { | 256 if (input_handler_client_) { |
| 259 input_handler_client_->WillShutdown(); | 257 input_handler_client_->WillShutdown(); |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 | 907 |
| 910 // Should only have one render pass in resourceless software mode. | 908 // Should only have one render pass in resourceless software mode. |
| 911 DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE || | 909 DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE || |
| 912 frame->render_passes.size() == 1u) | 910 frame->render_passes.size() == 1u) |
| 913 << frame->render_passes.size(); | 911 << frame->render_passes.size(); |
| 914 | 912 |
| 915 return draw_result; | 913 return draw_result; |
| 916 } | 914 } |
| 917 | 915 |
| 918 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | 916 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
| 919 if (top_controls_manager_) | 917 top_controls_manager_->MainThreadHasStoppedFlinging(); |
| 920 top_controls_manager_->MainThreadHasStoppedFlinging(); | |
| 921 if (input_handler_client_) | 918 if (input_handler_client_) |
| 922 input_handler_client_->MainThreadHasStoppedFlinging(); | 919 input_handler_client_->MainThreadHasStoppedFlinging(); |
| 923 } | 920 } |
| 924 | 921 |
| 925 void LayerTreeHostImpl::DidAnimateScrollOffset() { | 922 void LayerTreeHostImpl::DidAnimateScrollOffset() { |
| 926 client_->SetNeedsCommitOnImplThread(); | 923 client_->SetNeedsCommitOnImplThread(); |
| 927 client_->RenewTreePriority(); | 924 client_->RenewTreePriority(); |
| 928 } | 925 } |
| 929 | 926 |
| 930 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { | 927 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 } | 1413 } |
| 1417 | 1414 |
| 1418 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1415 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| 1419 CompositorFrameMetadata metadata; | 1416 CompositorFrameMetadata metadata; |
| 1420 metadata.device_scale_factor = device_scale_factor_; | 1417 metadata.device_scale_factor = device_scale_factor_; |
| 1421 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1418 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
| 1422 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1419 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
| 1423 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1420 metadata.root_layer_size = active_tree_->ScrollableSize(); |
| 1424 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1421 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
| 1425 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1422 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
| 1426 if (top_controls_manager_) { | 1423 metadata.location_bar_offset = |
| 1427 metadata.location_bar_offset = | 1424 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); |
| 1428 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); | 1425 metadata.location_bar_content_translation = |
| 1429 metadata.location_bar_content_translation = | 1426 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); |
| 1430 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); | |
| 1431 } | |
| 1432 | 1427 |
| 1433 active_tree_->GetViewportSelection(&metadata.selection_start, | 1428 active_tree_->GetViewportSelection(&metadata.selection_start, |
| 1434 &metadata.selection_end); | 1429 &metadata.selection_end); |
| 1435 | 1430 |
| 1436 LayerImpl* root_layer_for_overflow = OuterViewportScrollLayer() | 1431 LayerImpl* root_layer_for_overflow = OuterViewportScrollLayer() |
| 1437 ? OuterViewportScrollLayer() | 1432 ? OuterViewportScrollLayer() |
| 1438 : InnerViewportScrollLayer(); | 1433 : InnerViewportScrollLayer(); |
| 1439 if (root_layer_for_overflow) { | 1434 if (root_layer_for_overflow) { |
| 1440 metadata.root_overflow_x_hidden = | 1435 metadata.root_overflow_x_hidden = |
| 1441 !root_layer_for_overflow->user_scrollable_horizontal(); | 1436 !root_layer_for_overflow->user_scrollable_horizontal(); |
| 1442 metadata.root_overflow_y_hidden = | 1437 metadata.root_overflow_y_hidden = |
| 1443 !root_layer_for_overflow->user_scrollable_vertical(); | 1438 !root_layer_for_overflow->user_scrollable_vertical(); |
| 1444 } | 1439 } |
| 1445 | 1440 |
| 1446 if (!InnerViewportScrollLayer()) | 1441 if (!InnerViewportScrollLayer()) |
| 1447 return metadata; | 1442 return metadata; |
| 1448 | 1443 |
| 1449 // TODO(miletus) : Change the metadata to hold ScrollOffset. | 1444 // TODO(miletus) : Change the metadata to hold ScrollOffset. |
| 1450 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF( | 1445 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF( |
| 1451 active_tree_->TotalScrollOffset()); | 1446 active_tree_->TotalScrollOffset()); |
| 1452 | 1447 |
| 1453 return metadata; | 1448 return metadata; |
| 1454 } | 1449 } |
| 1455 | 1450 |
| 1456 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { | |
| 1457 layer->DidBeginTracing(); | |
| 1458 } | |
| 1459 | |
| 1460 void LayerTreeHostImpl::DrawLayers(FrameData* frame, | 1451 void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
| 1461 base::TimeTicks frame_begin_time) { | 1452 base::TimeTicks frame_begin_time) { |
| 1462 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 1453 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
| 1463 DCHECK(CanDraw()); | 1454 DCHECK(CanDraw()); |
| 1464 | 1455 |
| 1465 if (!frame->composite_events.empty()) { | 1456 if (!frame->composite_events.empty()) { |
| 1466 frame_timing_tracker_->SaveTimeStamps(frame_begin_time, | 1457 frame_timing_tracker_->SaveTimeStamps(frame_begin_time, |
| 1467 frame->composite_events); | 1458 frame->composite_events); |
| 1468 } | 1459 } |
| 1469 | 1460 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1499 paint_time_counter_->SavePaintTime( | 1490 paint_time_counter_->SavePaintTime( |
| 1500 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta()); | 1491 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta()); |
| 1501 } | 1492 } |
| 1502 | 1493 |
| 1503 bool is_new_trace; | 1494 bool is_new_trace; |
| 1504 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); | 1495 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
| 1505 if (is_new_trace) { | 1496 if (is_new_trace) { |
| 1506 if (pending_tree_) { | 1497 if (pending_tree_) { |
| 1507 LayerTreeHostCommon::CallFunctionForSubtree( | 1498 LayerTreeHostCommon::CallFunctionForSubtree( |
| 1508 pending_tree_->root_layer(), | 1499 pending_tree_->root_layer(), |
| 1509 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); | 1500 [](LayerImpl* layer) { layer->DidBeginTracing(); }); |
| 1510 } | 1501 } |
| 1511 LayerTreeHostCommon::CallFunctionForSubtree( | 1502 LayerTreeHostCommon::CallFunctionForSubtree( |
| 1512 active_tree_->root_layer(), | 1503 active_tree_->root_layer(), |
| 1513 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); | 1504 [](LayerImpl* layer) { layer->DidBeginTracing(); }); |
| 1514 } | 1505 } |
| 1515 | 1506 |
| 1516 { | 1507 { |
| 1517 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); | 1508 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); |
| 1518 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1509 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| 1519 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," | 1510 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," |
| 1520 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") "," | 1511 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") "," |
| 1521 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"), | 1512 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"), |
| 1522 "cc::LayerTreeHostImpl", | 1513 "cc::LayerTreeHostImpl", |
| 1523 id_, | 1514 id_, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 // to complete its work so that we can draw new tiles within the impl frame | 1646 // to complete its work so that we can draw new tiles within the impl frame |
| 1656 // we are beginning now. | 1647 // we are beginning now. |
| 1657 SetNeedsRedraw(); | 1648 SetNeedsRedraw(); |
| 1658 } | 1649 } |
| 1659 } | 1650 } |
| 1660 | 1651 |
| 1661 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1652 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
| 1662 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1653 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
| 1663 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1654 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
| 1664 | 1655 |
| 1665 if (!inner_container || !top_controls_manager_) | 1656 if (!inner_container) |
| 1666 return; | 1657 return; |
| 1667 | 1658 |
| 1668 ViewportAnchor anchor(InnerViewportScrollLayer(), | 1659 ViewportAnchor anchor(InnerViewportScrollLayer(), |
| 1669 OuterViewportScrollLayer()); | 1660 OuterViewportScrollLayer()); |
| 1670 | 1661 |
| 1671 // Adjust the inner viewport by shrinking/expanding the container to account | 1662 // Adjust the inner viewport by shrinking/expanding the container to account |
| 1672 // for the change in top controls height since the last Resize from Blink. | 1663 // for the change in top controls height since the last Resize from Blink. |
| 1673 float top_controls_layout_height = | 1664 float top_controls_layout_height = |
| 1674 active_tree_->top_controls_shrink_blink_size() | 1665 active_tree_->top_controls_shrink_blink_size() |
| 1675 ? active_tree_->top_controls_height() | 1666 ? active_tree_->top_controls_height() |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 return ancestor == scroll_ancestor; | 2344 return ancestor == scroll_ancestor; |
| 2354 } | 2345 } |
| 2355 return false; | 2346 return false; |
| 2356 } | 2347 } |
| 2357 | 2348 |
| 2358 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2349 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 2359 const gfx::Point& viewport_point, | 2350 const gfx::Point& viewport_point, |
| 2360 InputHandler::ScrollInputType type) { | 2351 InputHandler::ScrollInputType type) { |
| 2361 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2352 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 2362 | 2353 |
| 2363 if (top_controls_manager_) | 2354 top_controls_manager_->ScrollBegin(); |
| 2364 top_controls_manager_->ScrollBegin(); | |
| 2365 | 2355 |
| 2366 DCHECK(!CurrentlyScrollingLayer()); | 2356 DCHECK(!CurrentlyScrollingLayer()); |
| 2367 ClearCurrentlyScrollingLayer(); | 2357 ClearCurrentlyScrollingLayer(); |
| 2368 | 2358 |
| 2369 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2359 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
| 2370 device_scale_factor_); | 2360 device_scale_factor_); |
| 2371 LayerImpl* layer_impl = | 2361 LayerImpl* layer_impl = |
| 2372 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2362 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 2373 | 2363 |
| 2374 if (layer_impl) { | 2364 if (layer_impl) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 layer_impl->ScrollBy(delta); | 2555 layer_impl->ScrollBy(delta); |
| 2566 gfx::ScrollOffset scrolled = | 2556 gfx::ScrollOffset scrolled = |
| 2567 layer_impl->CurrentScrollOffset() - previous_offset; | 2557 layer_impl->CurrentScrollOffset() - previous_offset; |
| 2568 return gfx::Vector2dF(scrolled.x(), scrolled.y()); | 2558 return gfx::Vector2dF(scrolled.x(), scrolled.y()); |
| 2569 } | 2559 } |
| 2570 | 2560 |
| 2571 bool LayerTreeHostImpl::ShouldTopControlsConsumeScroll( | 2561 bool LayerTreeHostImpl::ShouldTopControlsConsumeScroll( |
| 2572 const gfx::Vector2dF& scroll_delta) const { | 2562 const gfx::Vector2dF& scroll_delta) const { |
| 2573 DCHECK(CurrentlyScrollingLayer()); | 2563 DCHECK(CurrentlyScrollingLayer()); |
| 2574 | 2564 |
| 2575 if (!top_controls_manager_) | |
| 2576 return false; | |
| 2577 | |
| 2578 // Always consume if it's in the direction to show the top controls. | 2565 // Always consume if it's in the direction to show the top controls. |
| 2579 if (scroll_delta.y() < 0) | 2566 if (scroll_delta.y() < 0) |
| 2580 return true; | 2567 return true; |
| 2581 | 2568 |
| 2582 if (active_tree()->TotalScrollOffset().y() < | 2569 if (active_tree()->TotalScrollOffset().y() < |
| 2583 active_tree()->TotalMaxScrollOffset().y()) | 2570 active_tree()->TotalMaxScrollOffset().y()) |
| 2584 return true; | 2571 return true; |
| 2585 | 2572 |
| 2586 return false; | 2573 return false; |
| 2587 } | 2574 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2808 } | 2795 } |
| 2809 | 2796 |
| 2810 void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() { | 2797 void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() { |
| 2811 active_tree_->ClearCurrentlyScrollingLayer(); | 2798 active_tree_->ClearCurrentlyScrollingLayer(); |
| 2812 did_lock_scrolling_layer_ = false; | 2799 did_lock_scrolling_layer_ = false; |
| 2813 scroll_affects_scroll_handler_ = false; | 2800 scroll_affects_scroll_handler_ = false; |
| 2814 accumulated_root_overscroll_ = gfx::Vector2dF(); | 2801 accumulated_root_overscroll_ = gfx::Vector2dF(); |
| 2815 } | 2802 } |
| 2816 | 2803 |
| 2817 void LayerTreeHostImpl::ScrollEnd() { | 2804 void LayerTreeHostImpl::ScrollEnd() { |
| 2818 if (top_controls_manager_) | 2805 top_controls_manager_->ScrollEnd(); |
| 2819 top_controls_manager_->ScrollEnd(); | |
| 2820 ClearCurrentlyScrollingLayer(); | 2806 ClearCurrentlyScrollingLayer(); |
| 2821 } | 2807 } |
| 2822 | 2808 |
| 2823 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 2809 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
| 2824 if (!active_tree_->CurrentlyScrollingLayer()) | 2810 if (!active_tree_->CurrentlyScrollingLayer()) |
| 2825 return SCROLL_IGNORED; | 2811 return SCROLL_IGNORED; |
| 2826 | 2812 |
| 2827 if (settings_.ignore_root_layer_flings && | 2813 if (settings_.ignore_root_layer_flings && |
| 2828 (active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() || | 2814 (active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() || |
| 2829 active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) { | 2815 active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2930 previous_pinch_anchor_ = gfx::Point(); | 2916 previous_pinch_anchor_ = gfx::Point(); |
| 2931 client_->RenewTreePriority(); | 2917 client_->RenewTreePriority(); |
| 2932 pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer(); | 2918 pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer(); |
| 2933 if (active_tree_->OuterViewportScrollLayer()) { | 2919 if (active_tree_->OuterViewportScrollLayer()) { |
| 2934 active_tree_->SetCurrentlyScrollingLayer( | 2920 active_tree_->SetCurrentlyScrollingLayer( |
| 2935 active_tree_->OuterViewportScrollLayer()); | 2921 active_tree_->OuterViewportScrollLayer()); |
| 2936 } else { | 2922 } else { |
| 2937 active_tree_->SetCurrentlyScrollingLayer( | 2923 active_tree_->SetCurrentlyScrollingLayer( |
| 2938 active_tree_->InnerViewportScrollLayer()); | 2924 active_tree_->InnerViewportScrollLayer()); |
| 2939 } | 2925 } |
| 2940 if (top_controls_manager_) | 2926 top_controls_manager_->PinchBegin(); |
| 2941 top_controls_manager_->PinchBegin(); | |
| 2942 } | 2927 } |
| 2943 | 2928 |
| 2944 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, | 2929 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, |
| 2945 const gfx::Point& anchor) { | 2930 const gfx::Point& anchor) { |
| 2946 if (!InnerViewportScrollLayer()) | 2931 if (!InnerViewportScrollLayer()) |
| 2947 return; | 2932 return; |
| 2948 | 2933 |
| 2949 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); | 2934 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); |
| 2950 | 2935 |
| 2951 // For a moment the scroll offset ends up being outside of the max range. This | 2936 // For a moment the scroll offset ends up being outside of the max range. This |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2990 SetNeedsRedraw(); | 2975 SetNeedsRedraw(); |
| 2991 client_->RenewTreePriority(); | 2976 client_->RenewTreePriority(); |
| 2992 } | 2977 } |
| 2993 | 2978 |
| 2994 void LayerTreeHostImpl::PinchGestureEnd() { | 2979 void LayerTreeHostImpl::PinchGestureEnd() { |
| 2995 pinch_gesture_active_ = false; | 2980 pinch_gesture_active_ = false; |
| 2996 if (pinch_gesture_end_should_clear_scrolling_layer_) { | 2981 if (pinch_gesture_end_should_clear_scrolling_layer_) { |
| 2997 pinch_gesture_end_should_clear_scrolling_layer_ = false; | 2982 pinch_gesture_end_should_clear_scrolling_layer_ = false; |
| 2998 ClearCurrentlyScrollingLayer(); | 2983 ClearCurrentlyScrollingLayer(); |
| 2999 } | 2984 } |
| 3000 if (top_controls_manager_) | 2985 top_controls_manager_->PinchEnd(); |
| 3001 top_controls_manager_->PinchEnd(); | |
| 3002 client_->SetNeedsCommitOnImplThread(); | 2986 client_->SetNeedsCommitOnImplThread(); |
| 3003 // When a pinch ends, we may be displaying content cached at incorrect scales, | 2987 // When a pinch ends, we may be displaying content cached at incorrect scales, |
| 3004 // so updating draw properties and drawing will ensure we are using the right | 2988 // so updating draw properties and drawing will ensure we are using the right |
| 3005 // scales that we want when we're not inside a pinch. | 2989 // scales that we want when we're not inside a pinch. |
| 3006 active_tree_->set_needs_update_draw_properties(); | 2990 active_tree_->set_needs_update_draw_properties(); |
| 3007 SetNeedsRedraw(); | 2991 SetNeedsRedraw(); |
| 3008 } | 2992 } |
| 3009 | 2993 |
| 3010 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 2994 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
| 3011 LayerImpl* layer_impl) { | 2995 LayerImpl* layer_impl) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 page_scale_animation_ = nullptr; | 3070 page_scale_animation_ = nullptr; |
| 3087 client_->SetNeedsCommitOnImplThread(); | 3071 client_->SetNeedsCommitOnImplThread(); |
| 3088 client_->RenewTreePriority(); | 3072 client_->RenewTreePriority(); |
| 3089 client_->DidCompletePageScaleAnimationOnImplThread(); | 3073 client_->DidCompletePageScaleAnimationOnImplThread(); |
| 3090 } else { | 3074 } else { |
| 3091 SetNeedsAnimate(); | 3075 SetNeedsAnimate(); |
| 3092 } | 3076 } |
| 3093 } | 3077 } |
| 3094 | 3078 |
| 3095 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { | 3079 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { |
| 3096 if (!top_controls_manager_ || !top_controls_manager_->animation()) | 3080 if (!top_controls_manager_->animation()) |
| 3097 return; | 3081 return; |
| 3098 | 3082 |
| 3099 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); | 3083 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); |
| 3100 | 3084 |
| 3101 if (top_controls_manager_->animation()) | 3085 if (top_controls_manager_->animation()) |
| 3102 SetNeedsAnimate(); | 3086 SetNeedsAnimate(); |
| 3103 | 3087 |
| 3104 if (active_tree_->TotalScrollOffset().y() == 0.f) | 3088 if (active_tree_->TotalScrollOffset().y() == 0.f) |
| 3105 return; | 3089 return; |
| 3106 | 3090 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3466 (*it)->OnSetNeedsRedrawOnImpl(); | 3450 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3467 } | 3451 } |
| 3468 | 3452 |
| 3469 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3453 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
| 3470 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3454 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3471 for (; it != swap_promise_monitor_.end(); it++) | 3455 for (; it != swap_promise_monitor_.end(); it++) |
| 3472 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3456 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
| 3473 } | 3457 } |
| 3474 | 3458 |
| 3475 } // namespace cc | 3459 } // namespace cc |
| OLD | NEW |