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 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3230 delta, viewport_point, scroll_state->is_direct_manipulation(), | 3230 delta, viewport_point, scroll_state->is_direct_manipulation(), |
3231 !wheel_scrolling_, scrolls_main_viewport_scroll_layer); | 3231 !wheel_scrolling_, scrolls_main_viewport_scroll_layer); |
3232 | 3232 |
3233 applied_delta = result.consumed_delta; | 3233 applied_delta = result.consumed_delta; |
3234 delta_applied_to_content = result.content_scrolled_delta; | 3234 delta_applied_to_content = result.content_scrolled_delta; |
3235 } else { | 3235 } else { |
3236 applied_delta = ScrollSingleNode( | 3236 applied_delta = ScrollSingleNode( |
3237 scroll_node, delta, viewport_point, | 3237 scroll_node, delta, viewport_point, |
3238 scroll_state->is_direct_manipulation(), | 3238 scroll_state->is_direct_manipulation(), |
3239 &scroll_state->layer_tree_impl()->property_trees()->scroll_tree); | 3239 &scroll_state->layer_tree_impl()->property_trees()->scroll_tree); |
3240 if (scroll_node->scroll_boundary_behavior.x != | |
bokan
2017/05/19 19:35:57
I believe you'll also need similar logic in LTHI::
sunyunjia
2017/05/25 20:07:10
Done.
| |
3241 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto && | |
3242 std::abs(delta.x()) > std::abs(delta.y())) | |
3243 applied_delta.set_x(delta.x()); | |
3244 if (scroll_node->scroll_boundary_behavior.y != | |
3245 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto && | |
3246 std::abs(delta.y()) > std::abs(delta.x())) | |
3247 applied_delta.set_y(delta.y()); | |
bokan
2017/05/19 19:35:57
I think we should do this in DistributeScrollDelta
sunyunjia
2017/05/25 20:07:10
Done.
| |
3240 } | 3248 } |
3241 | 3249 |
3242 // If the layer wasn't able to move, try the next one in the hierarchy. | 3250 // If the layer wasn't able to move, try the next one in the hierarchy. |
3243 bool scrolled = std::abs(applied_delta.x()) > kEpsilon; | 3251 bool scrolled = std::abs(applied_delta.x()) > kEpsilon; |
3244 scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon; | 3252 scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon; |
3245 if (!scrolled) { | 3253 if (!scrolled) { |
3246 // TODO(bokan): This preserves existing behavior by not allowing tiny | 3254 // TODO(bokan): This preserves existing behavior by not allowing tiny |
3247 // scrolls to produce overscroll but is inconsistent in how delta gets | 3255 // scrolls to produce overscroll but is inconsistent in how delta gets |
3248 // chained up. We need to clean this up. | 3256 // chained up. We need to clean this up. |
3249 if (scrolls_main_viewport_scroll_layer) | 3257 if (scrolls_main_viewport_scroll_layer) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3291 scroll_node = scroll_tree.parent(scroll_node)) { | 3299 scroll_node = scroll_tree.parent(scroll_node)) { |
3292 if (scroll_node == viewport_scroll_node) { | 3300 if (scroll_node == viewport_scroll_node) { |
3293 // Don't chain scrolls past the outer viewport scroll layer. Once we | 3301 // Don't chain scrolls past the outer viewport scroll layer. Once we |
3294 // reach that, we should scroll the viewport which is represented by the | 3302 // reach that, we should scroll the viewport which is represented by the |
3295 // main viewport scroll layer. | 3303 // main viewport scroll layer. |
3296 DCHECK(viewport_scroll_node); | 3304 DCHECK(viewport_scroll_node); |
3297 current_scroll_chain.push_front(viewport_scroll_node); | 3305 current_scroll_chain.push_front(viewport_scroll_node); |
3298 break; | 3306 break; |
3299 } | 3307 } |
3300 | 3308 |
3301 if (!scroll_node->scrollable) | 3309 if (scroll_node->scrollable) |
3302 continue; | 3310 current_scroll_chain.push_front(scroll_node); |
3303 | |
3304 current_scroll_chain.push_front(scroll_node); | |
3305 } | 3311 } |
3306 } | 3312 } |
3307 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3313 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
3308 active_tree()); | 3314 active_tree()); |
3309 scroll_state->DistributeToScrollChainDescendant(); | 3315 scroll_state->DistributeToScrollChainDescendant(); |
3310 } | 3316 } |
3311 | 3317 |
3312 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3318 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
3313 ScrollState* scroll_state) { | 3319 ScrollState* scroll_state) { |
3314 DCHECK(scroll_state); | 3320 DCHECK(scroll_state); |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4348 | 4354 |
4349 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4355 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
4350 if (!element_id) | 4356 if (!element_id) |
4351 return; | 4357 return; |
4352 if (ScrollbarAnimationController* animation_controller = | 4358 if (ScrollbarAnimationController* animation_controller = |
4353 ScrollbarAnimationControllerForElementId(element_id)) | 4359 ScrollbarAnimationControllerForElementId(element_id)) |
4354 animation_controller->DidScrollUpdate(); | 4360 animation_controller->DidScrollUpdate(); |
4355 } | 4361 } |
4356 | 4362 |
4357 } // namespace cc | 4363 } // namespace cc |
OLD | NEW |