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

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: Rebase Created 3 years, 3 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
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3206 3206
3207 gfx::Vector2dF scroll_delta = 3207 gfx::Vector2dF scroll_delta =
3208 ComputeScrollDelta(*scroll_node, pending_delta); 3208 ComputeScrollDelta(*scroll_node, pending_delta);
3209 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { 3209 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) {
3210 scroll_animating_latched_node_id_ = scroll_node->id; 3210 scroll_animating_latched_node_id_ = scroll_node->id;
3211 return scroll_status; 3211 return scroll_status;
3212 } 3212 }
3213 3213
3214 pending_delta -= scroll_delta; 3214 pending_delta -= scroll_delta;
3215 3215
3216 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) 3216 if (!CanPropagate(scroll_node, pending_delta.x(), pending_delta.y())) {
3217 scroll_state.set_is_scroll_chain_cut(true);
3217 break; 3218 break;
3219 }
3218 } 3220 }
3219 } 3221 }
3220 scroll_state.set_is_ending(true); 3222 scroll_state.set_is_ending(true);
3221 ScrollEnd(&scroll_state); 3223 ScrollEnd(&scroll_state);
3222 if (settings_.is_layer_tree_for_subframe && 3224 if (settings_.is_layer_tree_for_subframe &&
3223 scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 3225 scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
3224 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise 3226 // If we get to here, we shouldn't return SCROLL_ON_IMPL_THREAD as otherwise
3225 // we'll mark the scroll as handled and the scroll won't bubble. 3227 // we'll mark the scroll as handled and the scroll won't bubble.
3226 scroll_status.thread = SCROLL_IGNORED; 3228 scroll_status.thread = SCROLL_IGNORED;
3227 scroll_status.main_thread_scrolling_reasons = 3229 scroll_status.main_thread_scrolling_reasons =
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 if (CanConsumeDelta(*scroll_node, *scroll_state)) 3472 if (CanConsumeDelta(*scroll_node, *scroll_state))
3471 current_scroll_chain.push_front(scroll_node); 3473 current_scroll_chain.push_front(scroll_node);
3472 3474
3473 float delta_x = scroll_state->is_beginning() 3475 float delta_x = scroll_state->is_beginning()
3474 ? scroll_state->delta_x_hint() 3476 ? scroll_state->delta_x_hint()
3475 : scroll_state->delta_x(); 3477 : scroll_state->delta_x();
3476 float delta_y = scroll_state->is_beginning() 3478 float delta_y = scroll_state->is_beginning()
3477 ? scroll_state->delta_y_hint() 3479 ? scroll_state->delta_y_hint()
3478 : scroll_state->delta_y(); 3480 : scroll_state->delta_y();
3479 3481
3480 if (!CanPropagate(scroll_node, delta_x, delta_y)) 3482 if (!CanPropagate(scroll_node, delta_x, delta_y)) {
3483 scroll_state->set_is_scroll_chain_cut(true);
3481 break; 3484 break;
3485 }
3482 } 3486 }
3483 } 3487 }
3484 active_tree_->SetCurrentlyScrollingNode( 3488 active_tree_->SetCurrentlyScrollingNode(
3485 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back()); 3489 current_scroll_chain.empty() ? nullptr : current_scroll_chain.back());
3486 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, 3490 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,
3487 active_tree()); 3491 active_tree());
3488 scroll_state->DistributeToScrollChainDescendant(); 3492 scroll_state->DistributeToScrollChainDescendant();
3489 } 3493 }
3490 3494
3491 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node, 3495 bool LayerTreeHostImpl::CanConsumeDelta(const ScrollNode& scroll_node,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 3598
3595 bool did_scroll_top_controls = 3599 bool did_scroll_top_controls =
3596 initial_top_controls_offset != 3600 initial_top_controls_offset !=
3597 browser_controls_offset_manager_->ControlsTopOffset(); 3601 browser_controls_offset_manager_->ControlsTopOffset();
3598 3602
3599 InputHandlerScrollResult scroll_result; 3603 InputHandlerScrollResult scroll_result;
3600 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; 3604 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls;
3601 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); 3605 scroll_result.did_overscroll_root = !unused_root_delta.IsZero();
3602 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; 3606 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_;
3603 scroll_result.unused_scroll_delta = unused_root_delta; 3607 scroll_result.unused_scroll_delta = unused_root_delta;
3608 scroll_result.scroll_boundary_behavior =
3609 scroll_state->is_scroll_chain_cut()
3610 ? ScrollBoundaryBehavior(
3611 ScrollBoundaryBehavior::ScrollBoundaryBehaviorType::
3612 kScrollBoundaryBehaviorTypeNone)
3613 : active_tree()->scroll_boundary_behavior();
3604 3614
3605 if (scroll_result.did_scroll) { 3615 if (scroll_result.did_scroll) {
3606 // Scrolling can change the root scroll offset, so inform the synchronous 3616 // Scrolling can change the root scroll offset, so inform the synchronous
3607 // input handler. 3617 // input handler.
3608 UpdateRootLayerStateForSynchronousInputHandler(); 3618 UpdateRootLayerStateForSynchronousInputHandler();
3609 } 3619 }
3610 3620
3611 // Run animations which need to respond to updated scroll offset. 3621 // Run animations which need to respond to updated scroll offset.
3612 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time); 3622 mutator_host_->TickScrollAnimations(CurrentBeginFrameArgs().frame_time);
3613 3623
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
4514 return; 4524 return;
4515 } 4525 }
4516 if (!element_id) 4526 if (!element_id)
4517 return; 4527 return;
4518 if (ScrollbarAnimationController* animation_controller = 4528 if (ScrollbarAnimationController* animation_controller =
4519 ScrollbarAnimationControllerForElementId(element_id)) 4529 ScrollbarAnimationControllerForElementId(element_id))
4520 animation_controller->DidScrollUpdate(); 4530 animation_controller->DidScrollUpdate();
4521 } 4531 }
4522 4532
4523 } // namespace cc 4533 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698