| 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 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 | 3182 |
| 3183 gfx::Vector2dF scroll_delta = | 3183 gfx::Vector2dF scroll_delta = |
| 3184 ComputeScrollDelta(*scroll_node, pending_delta); | 3184 ComputeScrollDelta(*scroll_node, pending_delta); |
| 3185 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { | 3185 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { |
| 3186 scroll_animating_latched_node_id_ = scroll_node->id; | 3186 scroll_animating_latched_node_id_ = scroll_node->id; |
| 3187 return scroll_status; | 3187 return scroll_status; |
| 3188 } | 3188 } |
| 3189 | 3189 |
| 3190 pending_delta -= scroll_delta; | 3190 pending_delta -= scroll_delta; |
| 3191 | 3191 |
| 3192 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) | 3192 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) { |
| 3193 scroll_state.set_scroll_chain_cut(true); |
| 3193 break; | 3194 break; |
| 3195 } |
| 3194 } | 3196 } |
| 3195 } | 3197 } |
| 3196 scroll_state.set_is_ending(true); | 3198 scroll_state.set_is_ending(true); |
| 3197 ScrollEnd(&scroll_state); | 3199 ScrollEnd(&scroll_state); |
| 3198 if (settings_.is_layer_tree_for_subframe && | 3200 if (settings_.is_layer_tree_for_subframe && |
| 3199 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { | 3201 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { |
| 3200 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise | 3202 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise |
| 3201 // we'll mark the scroll as handled and the scroll won't bubble. | 3203 // we'll mark the scroll as handled and the scroll won't bubble. |
| 3202 scroll_status.thread = SCROLL_IGNORED; | 3204 scroll_status.thread = SCROLL_IGNORED; |
| 3203 scroll_status.main_thread_scrolling_reasons = | 3205 scroll_status.main_thread_scrolling_reasons = |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3446 if (CanConsumeDelta(*scroll_node, *scroll_state)) | 3448 if (CanConsumeDelta(*scroll_node, *scroll_state)) |
| 3447 current_scroll_chain.push_front(scroll_node); | 3449 current_scroll_chain.push_front(scroll_node); |
| 3448 | 3450 |
| 3449 float delta_x = scroll_state->is_beginning() | 3451 float delta_x = scroll_state->is_beginning() |
| 3450 ? scroll_state->delta_x_hint() | 3452 ? scroll_state->delta_x_hint() |
| 3451 : scroll_state->delta_x(); | 3453 : scroll_state->delta_x(); |
| 3452 float delta_y = scroll_state->is_beginning() | 3454 float delta_y = scroll_state->is_beginning() |
| 3453 ? scroll_state->delta_y_hint() | 3455 ? scroll_state->delta_y_hint() |
| 3454 : scroll_state->delta_y(); | 3456 : scroll_state->delta_y(); |
| 3455 | 3457 |
| 3456 if (!CanPropagate(scroll_node, delta_x, delta_y)) | 3458 if (!CanPropagate(scroll_node, delta_x, delta_y)) { |
| 3459 scroll_state->set_scroll_chain_cut(true); |
| 3457 break; | 3460 break; |
| 3461 } |
| 3458 } | 3462 } |
| 3459 } | 3463 } |
| 3460 active_tree_->SetCurrentlyScrollingNode( | 3464 active_tree_->SetCurrentlyScrollingNode( |
| 3461 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); | 3465 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); |
| 3462 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3466 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
| 3463 active_tree()); | 3467 active_tree()); |
| 3464 scroll_state->DistributeToScrollChainDescendant(); | 3468 scroll_state->DistributeToScrollChainDescendant(); |
| 3465 } | 3469 } |
| 3466 | 3470 |
| 3467 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, | 3471 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 | 3570 |
| 3567 bool did_scroll_top_controls = | 3571 bool did_scroll_top_controls = |
| 3568 initial_top_controls_offset != | 3572 initial_top_controls_offset != |
| 3569 browser_controls_offset_manager_->ControlsTopOffset(); | 3573 browser_controls_offset_manager_->ControlsTopOffset(); |
| 3570 | 3574 |
| 3571 InputHandlerScrollResult scroll_result; | 3575 InputHandlerScrollResult scroll_result; |
| 3572 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; | 3576 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; |
| 3573 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); | 3577 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); |
| 3574 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; | 3578 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; |
| 3575 scroll_result.unused_scroll_delta = unused_root_delta; | 3579 scroll_result.unused_scroll_delta = unused_root_delta; |
| 3580 scroll_result.scroll_boundary_behavior = |
| 3581 scroll_state->is_scroll_chain_cut() |
| 3582 ? ScrollBoundaryBehavior( |
| 3583 ScrollBoundaryBehavior::ScrollBoundaryBehaviorType:: |
| 3584 kScrollBoundaryBehaviorTypeNone) |
| 3585 : active_tree()->scroll_boundary_behavior(); |
| 3576 | 3586 |
| 3577 if (scroll_result.did_scroll) { | 3587 if (scroll_result.did_scroll) { |
| 3578 // Scrolling can change the root scroll offset, so inform the synchronous | 3588 // Scrolling can change the root scroll offset, so inform the synchronous |
| 3579 // input handler. | 3589 // input handler. |
| 3580 UpdateRootLayerStateForSynchronousInputHandler(); | 3590 UpdateRootLayerStateForSynchronousInputHandler(); |
| 3581 } | 3591 } |
| 3582 | 3592 |
| 3583 // Run animations which need to respond to updated scroll offset. | 3593 // Run animations which need to respond to updated scroll offset. |
| 3584 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time); | 3594 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time); |
| 3585 | 3595 |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4461 | 4471 |
| 4462 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4472 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4463 if (!element_id) | 4473 if (!element_id) |
| 4464 return; | 4474 return; |
| 4465 if (ScrollbarAnimationController* animation_controller = | 4475 if (ScrollbarAnimationController* animation_controller = |
| 4466 ScrollbarAnimationControllerForElementId(element_id)) | 4476 ScrollbarAnimationControllerForElementId(element_id)) |
| 4467 animation_controller->DidScrollUpdate(); | 4477 animation_controller->DidScrollUpdate(); |
| 4468 } | 4478 } |
| 4469 | 4479 |
| 4470 } // namespace cc | 4480 } // namespace cc |
| OLD | NEW |