| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "cc/animation/animation_host.h" | 28 #include "cc/animation/animation_host.h" |
| 29 #include "cc/base/histograms.h" | 29 #include "cc/base/histograms.h" |
| 30 #include "cc/base/math_util.h" | 30 #include "cc/base/math_util.h" |
| 31 #include "cc/debug/benchmark_instrumentation.h" | 31 #include "cc/debug/benchmark_instrumentation.h" |
| 32 #include "cc/debug/debug_rect_history.h" | 32 #include "cc/debug/debug_rect_history.h" |
| 33 #include "cc/debug/devtools_instrumentation.h" | 33 #include "cc/debug/devtools_instrumentation.h" |
| 34 #include "cc/debug/frame_rate_counter.h" | 34 #include "cc/debug/frame_rate_counter.h" |
| 35 #include "cc/debug/frame_viewer_instrumentation.h" | 35 #include "cc/debug/frame_viewer_instrumentation.h" |
| 36 #include "cc/debug/rendering_stats_instrumentation.h" | 36 #include "cc/debug/rendering_stats_instrumentation.h" |
| 37 #include "cc/debug/traced_value.h" | 37 #include "cc/debug/traced_value.h" |
| 38 #include "cc/input/browser_controls_offset_manager.h" |
| 38 #include "cc/input/main_thread_scrolling_reason.h" | 39 #include "cc/input/main_thread_scrolling_reason.h" |
| 39 #include "cc/input/page_scale_animation.h" | 40 #include "cc/input/page_scale_animation.h" |
| 40 #include "cc/input/scroll_elasticity_helper.h" | 41 #include "cc/input/scroll_elasticity_helper.h" |
| 41 #include "cc/input/scroll_state.h" | 42 #include "cc/input/scroll_state.h" |
| 42 #include "cc/input/scrollbar_animation_controller.h" | 43 #include "cc/input/scrollbar_animation_controller.h" |
| 43 #include "cc/input/top_controls_manager.h" | |
| 44 #include "cc/layers/append_quads_data.h" | 44 #include "cc/layers/append_quads_data.h" |
| 45 #include "cc/layers/heads_up_display_layer_impl.h" | 45 #include "cc/layers/heads_up_display_layer_impl.h" |
| 46 #include "cc/layers/layer_impl.h" | 46 #include "cc/layers/layer_impl.h" |
| 47 #include "cc/layers/layer_iterator.h" | 47 #include "cc/layers/layer_iterator.h" |
| 48 #include "cc/layers/painted_scrollbar_layer_impl.h" | 48 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 49 #include "cc/layers/render_surface_impl.h" | 49 #include "cc/layers/render_surface_impl.h" |
| 50 #include "cc/layers/scrollbar_layer_impl_base.h" | 50 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 51 #include "cc/layers/surface_layer_impl.h" | 51 #include "cc/layers/surface_layer_impl.h" |
| 52 #include "cc/layers/viewport.h" | 52 #include "cc/layers/viewport.h" |
| 53 #include "cc/output/compositor_frame.h" | 53 #include "cc/output/compositor_frame.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 active_tree_ = base::MakeUnique<LayerTreeImpl>( | 255 active_tree_ = base::MakeUnique<LayerTreeImpl>( |
| 256 this, new SyncedProperty<ScaleGroup>, new SyncedTopControls, | 256 this, new SyncedProperty<ScaleGroup>, new SyncedTopControls, |
| 257 new SyncedElasticOverscroll); | 257 new SyncedElasticOverscroll); |
| 258 active_tree_->property_trees()->is_active = true; | 258 active_tree_->property_trees()->is_active = true; |
| 259 | 259 |
| 260 viewport_ = Viewport::Create(this); | 260 viewport_ = Viewport::Create(this); |
| 261 | 261 |
| 262 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 262 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 263 "cc::LayerTreeHostImpl", id_); | 263 "cc::LayerTreeHostImpl", id_); |
| 264 | 264 |
| 265 top_controls_manager_ = | 265 browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create( |
| 266 TopControlsManager::Create(this, settings.top_controls_show_threshold, | 266 this, settings.top_controls_show_threshold, |
| 267 settings.top_controls_hide_threshold); | 267 settings.top_controls_hide_threshold); |
| 268 } | 268 } |
| 269 | 269 |
| 270 LayerTreeHostImpl::~LayerTreeHostImpl() { | 270 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 271 DCHECK(task_runner_provider_->IsImplThread()); | 271 DCHECK(task_runner_provider_->IsImplThread()); |
| 272 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 272 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 273 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 273 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 274 "cc::LayerTreeHostImpl", id_); | 274 "cc::LayerTreeHostImpl", id_); |
| 275 | 275 |
| 276 // It is released before shutdown. | 276 // It is released before shutdown. |
| 277 DCHECK(!compositor_frame_sink_); | 277 DCHECK(!compositor_frame_sink_); |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 // separate render pass for the layer, which will persist until a new commit | 1028 // separate render pass for the layer, which will persist until a new commit |
| 1029 // removes it. Force a commit after copy requests, to remove extra render | 1029 // removes it. Force a commit after copy requests, to remove extra render |
| 1030 // passes. | 1030 // passes. |
| 1031 if (have_copy_request) | 1031 if (have_copy_request) |
| 1032 client_->SetNeedsCommitOnImplThread(); | 1032 client_->SetNeedsCommitOnImplThread(); |
| 1033 | 1033 |
| 1034 return draw_result; | 1034 return draw_result; |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | 1037 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
| 1038 top_controls_manager_->MainThreadHasStoppedFlinging(); | 1038 browser_controls_offset_manager_->MainThreadHasStoppedFlinging(); |
| 1039 if (input_handler_client_) | 1039 if (input_handler_client_) |
| 1040 input_handler_client_->MainThreadHasStoppedFlinging(); | 1040 input_handler_client_->MainThreadHasStoppedFlinging(); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void LayerTreeHostImpl::DidAnimateScrollOffset() { | 1043 void LayerTreeHostImpl::DidAnimateScrollOffset() { |
| 1044 client_->SetNeedsCommitOnImplThread(); | 1044 client_->SetNeedsCommitOnImplThread(); |
| 1045 client_->RenewTreePriority(); | 1045 client_->RenewTreePriority(); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { | 1048 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1535 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| 1536 CompositorFrameMetadata metadata; | 1536 CompositorFrameMetadata metadata; |
| 1537 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * | 1537 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * |
| 1538 active_tree_->device_scale_factor(); | 1538 active_tree_->device_scale_factor(); |
| 1539 | 1539 |
| 1540 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1540 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
| 1541 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1541 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
| 1542 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1542 metadata.root_layer_size = active_tree_->ScrollableSize(); |
| 1543 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1543 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
| 1544 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1544 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
| 1545 metadata.top_controls_height = top_controls_manager_->TopControlsHeight(); | 1545 metadata.top_controls_height = |
| 1546 browser_controls_offset_manager_->TopControlsHeight(); |
| 1546 metadata.top_controls_shown_ratio = | 1547 metadata.top_controls_shown_ratio = |
| 1547 top_controls_manager_->TopControlsShownRatio(); | 1548 browser_controls_offset_manager_->TopControlsShownRatio(); |
| 1548 metadata.bottom_controls_height = | 1549 metadata.bottom_controls_height = |
| 1549 top_controls_manager_->BottomControlsHeight(); | 1550 browser_controls_offset_manager_->BottomControlsHeight(); |
| 1550 metadata.bottom_controls_shown_ratio = | 1551 metadata.bottom_controls_shown_ratio = |
| 1551 top_controls_manager_->BottomControlsShownRatio(); | 1552 browser_controls_offset_manager_->BottomControlsShownRatio(); |
| 1552 metadata.root_background_color = active_tree_->background_color(); | 1553 metadata.root_background_color = active_tree_->background_color(); |
| 1553 | 1554 |
| 1554 active_tree_->GetViewportSelection(&metadata.selection); | 1555 active_tree_->GetViewportSelection(&metadata.selection); |
| 1555 | 1556 |
| 1556 if (OuterViewportScrollLayer()) { | 1557 if (OuterViewportScrollLayer()) { |
| 1557 metadata.root_overflow_x_hidden = | 1558 metadata.root_overflow_x_hidden = |
| 1558 !OuterViewportScrollLayer()->user_scrollable_horizontal(); | 1559 !OuterViewportScrollLayer()->user_scrollable_horizontal(); |
| 1559 metadata.root_overflow_y_hidden = | 1560 metadata.root_overflow_y_hidden = |
| 1560 !OuterViewportScrollLayer()->user_scrollable_vertical(); | 1561 !OuterViewportScrollLayer()->user_scrollable_vertical(); |
| 1561 } | 1562 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 if (!inner_container) | 1859 if (!inner_container) |
| 1859 return; | 1860 return; |
| 1860 | 1861 |
| 1861 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); | 1862 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); |
| 1862 | 1863 |
| 1863 float top_controls_layout_height = | 1864 float top_controls_layout_height = |
| 1864 active_tree_->top_controls_shrink_blink_size() | 1865 active_tree_->top_controls_shrink_blink_size() |
| 1865 ? active_tree_->top_controls_height() | 1866 ? active_tree_->top_controls_height() |
| 1866 : 0.f; | 1867 : 0.f; |
| 1867 float delta_from_top_controls = | 1868 float delta_from_top_controls = |
| 1868 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); | 1869 top_controls_layout_height - |
| 1870 browser_controls_offset_manager_->ContentTopOffset(); |
| 1869 float bottom_controls_layout_height = | 1871 float bottom_controls_layout_height = |
| 1870 active_tree_->top_controls_shrink_blink_size() | 1872 active_tree_->top_controls_shrink_blink_size() |
| 1871 ? active_tree_->bottom_controls_height() | 1873 ? active_tree_->bottom_controls_height() |
| 1872 : 0.f; | 1874 : 0.f; |
| 1873 delta_from_top_controls += bottom_controls_layout_height - | 1875 delta_from_top_controls += |
| 1874 top_controls_manager_->ContentBottomOffset(); | 1876 bottom_controls_layout_height - |
| 1877 browser_controls_offset_manager_->ContentBottomOffset(); |
| 1875 | 1878 |
| 1876 // Adjust the viewport layers by shrinking/expanding the container to account | 1879 // Adjust the viewport layers by shrinking/expanding the container to account |
| 1877 // for changes in the size (e.g. top controls) since the last resize from | 1880 // for changes in the size (e.g. top controls) since the last resize from |
| 1878 // Blink. | 1881 // Blink. |
| 1879 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); | 1882 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); |
| 1880 inner_container->SetBoundsDelta(amount_to_expand); | 1883 inner_container->SetBoundsDelta(amount_to_expand); |
| 1881 | 1884 |
| 1882 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { | 1885 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { |
| 1883 // Adjust the outer viewport container as well, since adjusting only the | 1886 // Adjust the outer viewport container as well, since adjusting only the |
| 1884 // inner may cause its bounds to exceed those of the outer, causing scroll | 1887 // inner may cause its bounds to exceed those of the outer, causing scroll |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 MainThreadScrollingReason::kNotScrollingOnMain; | 2609 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2607 if (!scrolling_layer_impl) { | 2610 if (!scrolling_layer_impl) { |
| 2608 scroll_status.thread = SCROLL_IGNORED; | 2611 scroll_status.thread = SCROLL_IGNORED; |
| 2609 scroll_status.main_thread_scrolling_reasons = | 2612 scroll_status.main_thread_scrolling_reasons = |
| 2610 MainThreadScrollingReason::kNoScrollingLayer; | 2613 MainThreadScrollingReason::kNoScrollingLayer; |
| 2611 return scroll_status; | 2614 return scroll_status; |
| 2612 } | 2615 } |
| 2613 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 2616 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
| 2614 ScrollAnimationAbort(scrolling_layer_impl); | 2617 ScrollAnimationAbort(scrolling_layer_impl); |
| 2615 | 2618 |
| 2616 top_controls_manager_->ScrollBegin(); | 2619 browser_controls_offset_manager_->ScrollBegin(); |
| 2617 | 2620 |
| 2618 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); | 2621 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); |
| 2619 // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation | 2622 // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation |
| 2620 // in input_handler_proxy instead. | 2623 // in input_handler_proxy instead. |
| 2621 wheel_scrolling_ = IsWheelBasedScroll(type); | 2624 wheel_scrolling_ = IsWheelBasedScroll(type); |
| 2622 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 2625 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
| 2623 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure | 2626 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure |
| 2624 // scroll customization callbacks are invoked. | 2627 // scroll customization callbacks are invoked. |
| 2625 DistributeScrollDelta(scroll_state); | 2628 DistributeScrollDelta(scroll_state); |
| 2626 | 2629 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 | 3079 |
| 3077 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3080 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
| 3078 ScrollState* scroll_state) { | 3081 ScrollState* scroll_state) { |
| 3079 DCHECK(scroll_state); | 3082 DCHECK(scroll_state); |
| 3080 | 3083 |
| 3081 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 3084 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
| 3082 if (!CurrentlyScrollingLayer()) | 3085 if (!CurrentlyScrollingLayer()) |
| 3083 return InputHandlerScrollResult(); | 3086 return InputHandlerScrollResult(); |
| 3084 | 3087 |
| 3085 float initial_top_controls_offset = | 3088 float initial_top_controls_offset = |
| 3086 top_controls_manager_->ControlsTopOffset(); | 3089 browser_controls_offset_manager_->ControlsTopOffset(); |
| 3087 | 3090 |
| 3088 scroll_state->set_delta_consumed_for_scroll_sequence( | 3091 scroll_state->set_delta_consumed_for_scroll_sequence( |
| 3089 did_lock_scrolling_layer_); | 3092 did_lock_scrolling_layer_); |
| 3090 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3093 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
| 3091 scroll_state->set_current_native_scrolling_node( | 3094 scroll_state->set_current_native_scrolling_node( |
| 3092 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); | 3095 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); |
| 3093 | 3096 |
| 3094 DistributeScrollDelta(scroll_state); | 3097 DistributeScrollDelta(scroll_state); |
| 3095 | 3098 |
| 3096 active_tree_->SetCurrentlyScrollingLayer(active_tree_->LayerById( | 3099 active_tree_->SetCurrentlyScrollingLayer(active_tree_->LayerById( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3124 if (InnerViewportScrollLayer()) { | 3127 if (InnerViewportScrollLayer()) { |
| 3125 if (!InnerViewportScrollLayer()->user_scrollable_horizontal()) | 3128 if (!InnerViewportScrollLayer()->user_scrollable_horizontal()) |
| 3126 unused_root_delta.set_x(0); | 3129 unused_root_delta.set_x(0); |
| 3127 if (!InnerViewportScrollLayer()->user_scrollable_vertical()) | 3130 if (!InnerViewportScrollLayer()->user_scrollable_vertical()) |
| 3128 unused_root_delta.set_y(0); | 3131 unused_root_delta.set_y(0); |
| 3129 } | 3132 } |
| 3130 | 3133 |
| 3131 accumulated_root_overscroll_ += unused_root_delta; | 3134 accumulated_root_overscroll_ += unused_root_delta; |
| 3132 | 3135 |
| 3133 bool did_scroll_top_controls = | 3136 bool did_scroll_top_controls = |
| 3134 initial_top_controls_offset != top_controls_manager_->ControlsTopOffset(); | 3137 initial_top_controls_offset != |
| 3138 browser_controls_offset_manager_->ControlsTopOffset(); |
| 3135 | 3139 |
| 3136 InputHandlerScrollResult scroll_result; | 3140 InputHandlerScrollResult scroll_result; |
| 3137 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; | 3141 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; |
| 3138 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); | 3142 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); |
| 3139 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; | 3143 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; |
| 3140 scroll_result.unused_scroll_delta = unused_root_delta; | 3144 scroll_result.unused_scroll_delta = unused_root_delta; |
| 3141 | 3145 |
| 3142 if (scroll_result.did_scroll) { | 3146 if (scroll_result.did_scroll) { |
| 3143 // Scrolling can change the root scroll offset, so inform the synchronous | 3147 // Scrolling can change the root scroll offset, so inform the synchronous |
| 3144 // input handler. | 3148 // input handler. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3174 did_lock_scrolling_layer_ = false; | 3178 did_lock_scrolling_layer_ = false; |
| 3175 scroll_affects_scroll_handler_ = false; | 3179 scroll_affects_scroll_handler_ = false; |
| 3176 accumulated_root_overscroll_ = gfx::Vector2dF(); | 3180 accumulated_root_overscroll_ = gfx::Vector2dF(); |
| 3177 } | 3181 } |
| 3178 | 3182 |
| 3179 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { | 3183 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { |
| 3180 DCHECK(scroll_state); | 3184 DCHECK(scroll_state); |
| 3181 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 3185 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| 3182 | 3186 |
| 3183 DistributeScrollDelta(scroll_state); | 3187 DistributeScrollDelta(scroll_state); |
| 3184 top_controls_manager_->ScrollEnd(); | 3188 browser_controls_offset_manager_->ScrollEnd(); |
| 3185 | 3189 |
| 3186 if (scroll_state->is_in_inertial_phase()) { | 3190 if (scroll_state->is_in_inertial_phase()) { |
| 3187 // Only clear the currently scrolling layer if we know the scroll is done. | 3191 // Only clear the currently scrolling layer if we know the scroll is done. |
| 3188 // A non-inertial scroll end could be followed by an inertial scroll. | 3192 // A non-inertial scroll end could be followed by an inertial scroll. |
| 3189 ClearCurrentlyScrollingLayer(); | 3193 ClearCurrentlyScrollingLayer(); |
| 3190 } | 3194 } |
| 3191 } | 3195 } |
| 3192 | 3196 |
| 3193 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 3197 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
| 3194 InputHandler::ScrollStatus scroll_status; | 3198 InputHandler::ScrollStatus scroll_status; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3307 scroll_layer_id_when_mouse_over_scrollbar_); | 3311 scroll_layer_id_when_mouse_over_scrollbar_); |
| 3308 if (new_animation_controller) | 3312 if (new_animation_controller) |
| 3309 new_animation_controller->DidMouseMoveNear(0); | 3313 new_animation_controller->DidMouseMoveNear(0); |
| 3310 } | 3314 } |
| 3311 | 3315 |
| 3312 void LayerTreeHostImpl::PinchGestureBegin() { | 3316 void LayerTreeHostImpl::PinchGestureBegin() { |
| 3313 pinch_gesture_active_ = true; | 3317 pinch_gesture_active_ = true; |
| 3314 client_->RenewTreePriority(); | 3318 client_->RenewTreePriority(); |
| 3315 pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer(); | 3319 pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer(); |
| 3316 active_tree_->SetCurrentlyScrollingLayer(viewport()->MainScrollLayer()); | 3320 active_tree_->SetCurrentlyScrollingLayer(viewport()->MainScrollLayer()); |
| 3317 top_controls_manager_->PinchBegin(); | 3321 browser_controls_offset_manager_->PinchBegin(); |
| 3318 } | 3322 } |
| 3319 | 3323 |
| 3320 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, | 3324 void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta, |
| 3321 const gfx::Point& anchor) { | 3325 const gfx::Point& anchor) { |
| 3322 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); | 3326 TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate"); |
| 3323 if (!InnerViewportScrollLayer()) | 3327 if (!InnerViewportScrollLayer()) |
| 3324 return; | 3328 return; |
| 3325 viewport()->PinchUpdate(magnify_delta, anchor); | 3329 viewport()->PinchUpdate(magnify_delta, anchor); |
| 3326 client_->SetNeedsCommitOnImplThread(); | 3330 client_->SetNeedsCommitOnImplThread(); |
| 3327 SetNeedsRedraw(); | 3331 SetNeedsRedraw(); |
| 3328 client_->RenewTreePriority(); | 3332 client_->RenewTreePriority(); |
| 3329 // Pinching can change the root scroll offset, so inform the synchronous input | 3333 // Pinching can change the root scroll offset, so inform the synchronous input |
| 3330 // handler. | 3334 // handler. |
| 3331 UpdateRootLayerStateForSynchronousInputHandler(); | 3335 UpdateRootLayerStateForSynchronousInputHandler(); |
| 3332 } | 3336 } |
| 3333 | 3337 |
| 3334 void LayerTreeHostImpl::PinchGestureEnd() { | 3338 void LayerTreeHostImpl::PinchGestureEnd() { |
| 3335 pinch_gesture_active_ = false; | 3339 pinch_gesture_active_ = false; |
| 3336 if (pinch_gesture_end_should_clear_scrolling_layer_) { | 3340 if (pinch_gesture_end_should_clear_scrolling_layer_) { |
| 3337 pinch_gesture_end_should_clear_scrolling_layer_ = false; | 3341 pinch_gesture_end_should_clear_scrolling_layer_ = false; |
| 3338 ClearCurrentlyScrollingLayer(); | 3342 ClearCurrentlyScrollingLayer(); |
| 3339 } | 3343 } |
| 3340 viewport()->PinchEnd(); | 3344 viewport()->PinchEnd(); |
| 3341 top_controls_manager_->PinchEnd(); | 3345 browser_controls_offset_manager_->PinchEnd(); |
| 3342 client_->SetNeedsCommitOnImplThread(); | 3346 client_->SetNeedsCommitOnImplThread(); |
| 3343 // When a pinch ends, we may be displaying content cached at incorrect scales, | 3347 // When a pinch ends, we may be displaying content cached at incorrect scales, |
| 3344 // so updating draw properties and drawing will ensure we are using the right | 3348 // so updating draw properties and drawing will ensure we are using the right |
| 3345 // scales that we want when we're not inside a pinch. | 3349 // scales that we want when we're not inside a pinch. |
| 3346 active_tree_->set_needs_update_draw_properties(); | 3350 active_tree_->set_needs_update_draw_properties(); |
| 3347 SetNeedsRedraw(); | 3351 SetNeedsRedraw(); |
| 3348 } | 3352 } |
| 3349 | 3353 |
| 3350 std::unique_ptr<BeginFrameCallbackList> | 3354 std::unique_ptr<BeginFrameCallbackList> |
| 3351 LayerTreeHostImpl::ProcessLayerTreeMutations() { | 3355 LayerTreeHostImpl::ProcessLayerTreeMutations() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 client_->SetNeedsCommitOnImplThread(); | 3417 client_->SetNeedsCommitOnImplThread(); |
| 3414 client_->RenewTreePriority(); | 3418 client_->RenewTreePriority(); |
| 3415 client_->DidCompletePageScaleAnimationOnImplThread(); | 3419 client_->DidCompletePageScaleAnimationOnImplThread(); |
| 3416 } else { | 3420 } else { |
| 3417 SetNeedsOneBeginImplFrame(); | 3421 SetNeedsOneBeginImplFrame(); |
| 3418 } | 3422 } |
| 3419 return true; | 3423 return true; |
| 3420 } | 3424 } |
| 3421 | 3425 |
| 3422 bool LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { | 3426 bool LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { |
| 3423 if (!top_controls_manager_->has_animation()) | 3427 if (!browser_controls_offset_manager_->has_animation()) |
| 3424 return false; | 3428 return false; |
| 3425 | 3429 |
| 3426 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); | 3430 gfx::Vector2dF scroll = browser_controls_offset_manager_->Animate(time); |
| 3427 | 3431 |
| 3428 if (top_controls_manager_->has_animation()) | 3432 if (browser_controls_offset_manager_->has_animation()) |
| 3429 SetNeedsOneBeginImplFrame(); | 3433 SetNeedsOneBeginImplFrame(); |
| 3430 | 3434 |
| 3431 if (active_tree_->TotalScrollOffset().y() == 0.f) | 3435 if (active_tree_->TotalScrollOffset().y() == 0.f) |
| 3432 return false; | 3436 return false; |
| 3433 | 3437 |
| 3434 if (scroll.IsZero()) | 3438 if (scroll.IsZero()) |
| 3435 return false; | 3439 return false; |
| 3436 | 3440 |
| 3437 DCHECK(viewport()); | 3441 DCHECK(viewport()); |
| 3438 viewport()->ScrollBy(scroll, gfx::Point(), false, false); | 3442 viewport()->ScrollBy(scroll, gfx::Point(), false, false); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4102 if (is_visible) { | 4106 if (is_visible) { |
| 4103 worker_context_visibility_ = | 4107 worker_context_visibility_ = |
| 4104 worker_context->CacheController()->ClientBecameVisible(); | 4108 worker_context->CacheController()->ClientBecameVisible(); |
| 4105 } else { | 4109 } else { |
| 4106 worker_context->CacheController()->ClientBecameNotVisible( | 4110 worker_context->CacheController()->ClientBecameNotVisible( |
| 4107 std::move(worker_context_visibility_)); | 4111 std::move(worker_context_visibility_)); |
| 4108 } | 4112 } |
| 4109 } | 4113 } |
| 4110 | 4114 |
| 4111 } // namespace cc | 4115 } // namespace cc |
| OLD | NEW |