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 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 | 3200 |
3201 gfx::Vector2dF scroll_delta = | 3201 gfx::Vector2dF scroll_delta = |
3202 ComputeScrollDelta(*scroll_node, pending_delta); | 3202 ComputeScrollDelta(*scroll_node, pending_delta); |
3203 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { | 3203 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { |
3204 scroll_animating_latched_node_id_ = scroll_node->id; | 3204 scroll_animating_latched_node_id_ = scroll_node->id; |
3205 return scroll_status; | 3205 return scroll_status; |
3206 } | 3206 } |
3207 | 3207 |
3208 pending_delta -= scroll_delta; | 3208 pending_delta -= scroll_delta; |
3209 | 3209 |
3210 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) | 3210 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) { |
| 3211 scroll_state.set_scroll_chain_cut(true); |
3211 break; | 3212 break; |
| 3213 } |
3212 } | 3214 } |
3213 } | 3215 } |
3214 scroll_state.set_is_ending(true); | 3216 scroll_state.set_is_ending(true); |
3215 ScrollEnd(&scroll_state); | 3217 ScrollEnd(&scroll_state); |
3216 if (settings_.is_layer_tree_for_subframe && | 3218 if (settings_.is_layer_tree_for_subframe && |
3217 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { | 3219 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { |
3218 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise | 3220 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise |
3219 // we'll mark the scroll as handled and the scroll won't bubble. | 3221 // we'll mark the scroll as handled and the scroll won't bubble. |
3220 scroll_status.thread = SCROLL_IGNORED; | 3222 scroll_status.thread = SCROLL_IGNORED; |
3221 scroll_status.main_thread_scrolling_reasons = | 3223 scroll_status.main_thread_scrolling_reasons = |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 if (CanConsumeDelta(*scroll_node, *scroll_state)) | 3466 if (CanConsumeDelta(*scroll_node, *scroll_state)) |
3465 current_scroll_chain.push_front(scroll_node); | 3467 current_scroll_chain.push_front(scroll_node); |
3466 | 3468 |
3467 float delta_x = scroll_state->is_beginning() | 3469 float delta_x = scroll_state->is_beginning() |
3468 ? scroll_state->delta_x_hint() | 3470 ? scroll_state->delta_x_hint() |
3469 : scroll_state->delta_x(); | 3471 : scroll_state->delta_x(); |
3470 float delta_y = scroll_state->is_beginning() | 3472 float delta_y = scroll_state->is_beginning() |
3471 ? scroll_state->delta_y_hint() | 3473 ? scroll_state->delta_y_hint() |
3472 : scroll_state->delta_y(); | 3474 : scroll_state->delta_y(); |
3473 | 3475 |
3474 if (!CanPropagate(scroll_node, delta_x, delta_y)) | 3476 if (!CanPropagate(scroll_node, delta_x, delta_y)) { |
| 3477 scroll_state->set_scroll_chain_cut(true); |
3475 break; | 3478 break; |
| 3479 } |
3476 } | 3480 } |
3477 } | 3481 } |
3478 active_tree_->SetCurrentlyScrollingNode( | 3482 active_tree_->SetCurrentlyScrollingNode( |
3479 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); | 3483 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); |
3480 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3484 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
3481 active_tree()); | 3485 active_tree()); |
3482 scroll_state->DistributeToScrollChainDescendant(); | 3486 scroll_state->DistributeToScrollChainDescendant(); |
3483 } | 3487 } |
3484 | 3488 |
3485 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, | 3489 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3584 | 3588 |
3585 bool did_scroll_top_controls = | 3589 bool did_scroll_top_controls = |
3586 initial_top_controls_offset != | 3590 initial_top_controls_offset != |
3587 browser_controls_offset_manager_->ControlsTopOffset(); | 3591 browser_controls_offset_manager_->ControlsTopOffset(); |
3588 | 3592 |
3589 InputHandlerScrollResult scroll_result; | 3593 InputHandlerScrollResult scroll_result; |
3590 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; | 3594 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; |
3591 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); | 3595 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); |
3592 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; | 3596 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; |
3593 scroll_result.unused_scroll_delta = unused_root_delta; | 3597 scroll_result.unused_scroll_delta = unused_root_delta; |
| 3598 scroll_result.scroll_boundary_behavior = |
| 3599 scroll_state->is_scroll_chain_cut() |
| 3600 ? ScrollBoundaryBehavior( |
| 3601 ScrollBoundaryBehavior::ScrollBoundaryBehaviorType:: |
| 3602 kScrollBoundaryBehaviorTypeNone) |
| 3603 : active_tree()->scroll_boundary_behavior(); |
3594 | 3604 |
3595 if (scroll_result.did_scroll) { | 3605 if (scroll_result.did_scroll) { |
3596 // Scrolling can change the root scroll offset, so inform the synchronous | 3606 // Scrolling can change the root scroll offset, so inform the synchronous |
3597 // input handler. | 3607 // input handler. |
3598 UpdateRootLayerStateForSynchronousInputHandler(); | 3608 UpdateRootLayerStateForSynchronousInputHandler(); |
3599 } | 3609 } |
3600 | 3610 |
3601 // Update compositor worker mutations which may respond to scrolling. | 3611 // Update compositor worker mutations which may respond to scrolling. |
3602 Mutate(CurrentBeginFrameArgs().frame_time); | 3612 Mutate(CurrentBeginFrameArgs().frame_time); |
3603 | 3613 |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4483 | 4493 |
4484 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4494 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
4485 if (!element_id) | 4495 if (!element_id) |
4486 return; | 4496 return; |
4487 if (ScrollbarAnimationController* animation_controller = | 4497 if (ScrollbarAnimationController* animation_controller = |
4488 ScrollbarAnimationControllerForElementId(element_id)) | 4498 ScrollbarAnimationControllerForElementId(element_id)) |
4489 animation_controller->DidScrollUpdate(); | 4499 animation_controller->DidScrollUpdate(); |
4490 } | 4500 } |
4491 | 4501 |
4492 } // namespace cc | 4502 } // namespace cc |
OLD | NEW |