Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Mark OverscrollRefresh() as protected. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 3177
3178 gfx::Vector2dF scroll_delta = 3178 gfx::Vector2dF scroll_delta =
3179 ComputeScrollDelta(*scroll_node, pending_delta); 3179 ComputeScrollDelta(*scroll_node, pending_delta);
3180 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { 3180 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) {
3181 scroll_animating_latched_node_id_ = scroll_node->id; 3181 scroll_animating_latched_node_id_ = scroll_node->id;
3182 return scroll_status; 3182 return scroll_status;
3183 } 3183 }
3184 3184
3185 pending_delta -= scroll_delta; 3185 pending_delta -= scroll_delta;
3186 3186
3187 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) 3187 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) {
3188 scroll_state.set_scroll_chain_cut(true);
3188 break; 3189 break;
3190 }
3189 } 3191 }
3190 } 3192 }
3191 scroll_state.set_is_ending(true); 3193 scroll_state.set_is_ending(true);
3192 ScrollEnd(&scroll_state); 3194 ScrollEnd(&scroll_state);
3193 if (settings_.is_layer_tree_for_subframe && 3195 if (settings_.is_layer_tree_for_subframe &&
3194 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 3196 scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
3195 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise 3197 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise
3196 // we'll mark the scroll as handled and the scroll won't bubble. 3198 // we'll mark the scroll as handled and the scroll won't bubble.
3197 scroll_status.thread = SCROLL_IGNORED; 3199 scroll_status.thread = SCROLL_IGNORED;
3198 scroll_status.main_thread_scrolling_reasons = 3200 scroll_status.main_thread_scrolling_reasons =
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 if (CanConsumeDelta(*scroll_node, *scroll_state)) 3443 if (CanConsumeDelta(*scroll_node, *scroll_state))
3442 current_scroll_chain.push_front(scroll_node); 3444 current_scroll_chain.push_front(scroll_node);
3443 3445
3444 float delta_x = scroll_state->is_beginning() 3446 float delta_x = scroll_state->is_beginning()
3445 ? scroll_state->delta_x_hint() 3447 ? scroll_state->delta_x_hint()
3446 : scroll_state->delta_x(); 3448 : scroll_state->delta_x();
3447 float delta_y = scroll_state->is_beginning() 3449 float delta_y = scroll_state->is_beginning()
3448 ? scroll_state->delta_y_hint() 3450 ? scroll_state->delta_y_hint()
3449 : scroll_state->delta_y(); 3451 : scroll_state->delta_y();
3450 3452
3451 if (!CanPropagate(scroll_node, delta_x, delta_y)) 3453 if (!CanPropagate(scroll_node, delta_x, delta_y)) {
3454 scroll_state->set_scroll_chain_cut(true);
3452 break; 3455 break;
3456 }
3453 } 3457 }
3454 } 3458 }
3455 active_tree_->SetCurrentlyScrollingNode( 3459 active_tree_->SetCurrentlyScrollingNode(
3456 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); 3460 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back());
3457 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, 3461 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,
3458 active_tree()); 3462 active_tree());
3459 scroll_state->DistributeToScrollChainDescendant(); 3463 scroll_state->DistributeToScrollChainDescendant();
3460 } 3464 }
3461 3465
3462 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, 3466 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3561 3565
3562 bool did_scroll_top_controls = 3566 bool did_scroll_top_controls =
3563 initial_top_controls_offset != 3567 initial_top_controls_offset !=
3564 browser_controls_offset_manager_->ControlsTopOffset(); 3568 browser_controls_offset_manager_->ControlsTopOffset();
3565 3569
3566 InputHandlerScrollResult scroll_result; 3570 InputHandlerScrollResult scroll_result;
3567 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; 3571 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls;
3568 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); 3572 scroll_result.did_overscroll_root = !unused_root_delta.IsZero();
3569 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; 3573 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_;
3570 scroll_result.unused_scroll_delta = unused_root_delta; 3574 scroll_result.unused_scroll_delta = unused_root_delta;
3575 scroll_result.scroll_boundary_behavior =
3576 scroll_state->is_scroll_chain_cut()
3577 ? ScrollBoundaryBehavior(
3578 ScrollBoundaryBehavior::ScrollBoundaryBehaviorType::
3579 kScrollBoundaryBehaviorTypeNone)
3580 : active_tree()->scroll_boundary_behavior();
3571 3581
3572 if (scroll_result.did_scroll) { 3582 if (scroll_result.did_scroll) {
3573 // Scrolling can change the root scroll offset, so inform the synchronous 3583 // Scrolling can change the root scroll offset, so inform the synchronous
3574 // input handler. 3584 // input handler.
3575 UpdateRootLayerStateForSynchronousInputHandler(); 3585 UpdateRootLayerStateForSynchronousInputHandler();
3576 } 3586 }
3577 3587
3578 // Run animations which need to respond to updated scroll offset. 3588 // Run animations which need to respond to updated scroll offset.
3579 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time); 3589 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time);
3580 3590
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
4451 4461
4452 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { 4462 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) {
4453 if (!element_id) 4463 if (!element_id)
4454 return; 4464 return;
4455 if (ScrollbarAnimationController* animation_controller = 4465 if (ScrollbarAnimationController* animation_controller =
4456 ScrollbarAnimationControllerForElementId(element_id)) 4466 ScrollbarAnimationControllerForElementId(element_id))
4457 animation_controller->DidScrollUpdate(); 4467 animation_controller->DidScrollUpdate();
4458 } 4468 }
4459 4469
4460 } // namespace cc 4470 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698