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 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3008 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which | 3008 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which |
3009 // is not the case here. We eventually want to have the same behaviour on both | 3009 // is not the case here. We eventually want to have the same behaviour on both |
3010 // sides but it may become a non issue if we get rid of scroll chaining (see | 3010 // sides but it may become a non issue if we get rid of scroll chaining (see |
3011 // crbug.com/526462) | 3011 // crbug.com/526462) |
3012 std::list<const ScrollNode*> current_scroll_chain; | 3012 std::list<const ScrollNode*> current_scroll_chain; |
3013 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3013 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
3014 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3014 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
3015 if (scroll_node) { | 3015 if (scroll_node) { |
3016 for (; scroll_tree.parent(scroll_node); | 3016 for (; scroll_tree.parent(scroll_node); |
3017 scroll_node = scroll_tree.parent(scroll_node)) { | 3017 scroll_node = scroll_tree.parent(scroll_node)) { |
3018 // Skip the outer viewport scroll layer so that we try to scroll the | 3018 if (scroll_node->is_outer_viewport_scroll_layer) { |
3019 // viewport only once. i.e. The inner viewport layer represents the | 3019 // Don't chain scrolls past the outer viewport scroll layer. Once we |
3020 // viewport. | 3020 // reach that, we should scroll the viewport, which is represented by |
3021 if (!scroll_node->scrollable || | 3021 // the inner viewport scroll layer. |
3022 scroll_node->is_outer_viewport_scroll_layer) | 3022 ScrollNode* inner_scroll_node = |
tdresser
2016/08/15 13:37:41
Maybe inner_viewport_scroll_node?
bokan
2016/08/20 22:13:58
Done.
| |
3023 scroll_tree.Node(InnerViewportScrollLayer()->scroll_tree_index()); | |
3024 current_scroll_chain.push_front(inner_scroll_node); | |
3025 break; | |
3026 } | |
3027 | |
3028 if (!scroll_node->scrollable) | |
3023 continue; | 3029 continue; |
3030 | |
3024 current_scroll_chain.push_front(scroll_node); | 3031 current_scroll_chain.push_front(scroll_node); |
3025 } | 3032 } |
3026 } | 3033 } |
3027 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3034 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
3028 active_tree()); | 3035 active_tree()); |
3029 scroll_state->DistributeToScrollChainDescendant(); | 3036 scroll_state->DistributeToScrollChainDescendant(); |
3030 } | 3037 } |
3031 | 3038 |
3032 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3039 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
3033 ScrollState* scroll_state) { | 3040 ScrollState* scroll_state) { |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4012 return task_runner_provider_->HasImplThread(); | 4019 return task_runner_provider_->HasImplThread(); |
4013 } | 4020 } |
4014 | 4021 |
4015 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4022 bool LayerTreeHostImpl::CommitToActiveTree() const { |
4016 // In single threaded mode we skip the pending tree and commit directly to the | 4023 // In single threaded mode we skip the pending tree and commit directly to the |
4017 // active tree. | 4024 // active tree. |
4018 return !task_runner_provider_->HasImplThread(); | 4025 return !task_runner_provider_->HasImplThread(); |
4019 } | 4026 } |
4020 | 4027 |
4021 } // namespace cc | 4028 } // namespace cc |
OLD | NEW |