| 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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which | 3096 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which |
| 3097 // is not the case here. We eventually want to have the same behaviour on both | 3097 // is not the case here. We eventually want to have the same behaviour on both |
| 3098 // sides but it may become a non issue if we get rid of scroll chaining (see | 3098 // sides but it may become a non issue if we get rid of scroll chaining (see |
| 3099 // crbug.com/526462) | 3099 // crbug.com/526462) |
| 3100 std::list<const ScrollNode*> current_scroll_chain; | 3100 std::list<const ScrollNode*> current_scroll_chain; |
| 3101 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3101 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 3102 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3102 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 3103 if (scroll_node) { | 3103 if (scroll_node) { |
| 3104 for (; scroll_tree.parent(scroll_node); | 3104 for (; scroll_tree.parent(scroll_node); |
| 3105 scroll_node = scroll_tree.parent(scroll_node)) { | 3105 scroll_node = scroll_tree.parent(scroll_node)) { |
| 3106 // Skip the outer viewport scroll layer so that we try to scroll the | 3106 if (scroll_node->is_outer_viewport_scroll_layer) { |
| 3107 // viewport only once. i.e. The inner viewport layer represents the | 3107 // Don't chain scrolls past the outer viewport scroll layer. Once we |
| 3108 // viewport. | 3108 // reach that, we should scroll the viewport, which is represented by |
| 3109 if (!scroll_node->scrollable || | 3109 // the inner viewport scroll layer. |
| 3110 scroll_node->is_outer_viewport_scroll_layer) | 3110 ScrollNode* inner_viewport_scroll_node = |
| 3111 scroll_tree.Node(InnerViewportScrollLayer()->scroll_tree_index()); |
| 3112 current_scroll_chain.push_front(inner_viewport_scroll_node); |
| 3113 break; |
| 3114 } |
| 3115 |
| 3116 if (!scroll_node->scrollable) |
| 3111 continue; | 3117 continue; |
| 3118 |
| 3112 current_scroll_chain.push_front(scroll_node); | 3119 current_scroll_chain.push_front(scroll_node); |
| 3113 } | 3120 } |
| 3114 } | 3121 } |
| 3115 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3122 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
| 3116 active_tree()); | 3123 active_tree()); |
| 3117 scroll_state->DistributeToScrollChainDescendant(); | 3124 scroll_state->DistributeToScrollChainDescendant(); |
| 3118 } | 3125 } |
| 3119 | 3126 |
| 3120 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3127 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
| 3121 ScrollState* scroll_state) { | 3128 ScrollState* scroll_state) { |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4101 return task_runner_provider_->HasImplThread(); | 4108 return task_runner_provider_->HasImplThread(); |
| 4102 } | 4109 } |
| 4103 | 4110 |
| 4104 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4111 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4105 // In single threaded mode we skip the pending tree and commit directly to the | 4112 // In single threaded mode we skip the pending tree and commit directly to the |
| 4106 // active tree. | 4113 // active tree. |
| 4107 return !task_runner_provider_->HasImplThread(); | 4114 return !task_runner_provider_->HasImplThread(); |
| 4108 } | 4115 } |
| 4109 | 4116 |
| 4110 } // namespace cc | 4117 } // namespace cc |
| OLD | NEW |