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 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 | 2849 |
2850 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( | 2850 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( |
2851 const gfx::Point& viewport_point, | 2851 const gfx::Point& viewport_point, |
2852 const gfx::Vector2dF& scroll_delta, | 2852 const gfx::Vector2dF& scroll_delta, |
2853 base::TimeDelta delayed_by) { | 2853 base::TimeDelta delayed_by) { |
2854 InputHandler::ScrollStatus scroll_status; | 2854 InputHandler::ScrollStatus scroll_status; |
2855 scroll_status.main_thread_scrolling_reasons = | 2855 scroll_status.main_thread_scrolling_reasons = |
2856 MainThreadScrollingReason::kNotScrollingOnMain; | 2856 MainThreadScrollingReason::kNotScrollingOnMain; |
2857 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2857 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
2858 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2858 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 2859 |
| 2860 LayerImpl* currently_scrolling_layer = CurrentlyScrollingLayer(); |
| 2861 |
| 2862 if (currently_scrolling_layer) { |
| 2863 ScrollbarAnimationController* animation_controller = |
| 2864 ScrollbarAnimationControllerForId(currently_scrolling_layer->id()); |
| 2865 |
| 2866 if (animation_controller) |
| 2867 animation_controller->WillUpdateScroll(); |
| 2868 } |
| 2869 |
2859 if (scroll_node) { | 2870 if (scroll_node) { |
2860 gfx::Vector2dF delta = scroll_delta; | 2871 gfx::Vector2dF delta = scroll_delta; |
2861 if (!scroll_node->user_scrollable_horizontal) | 2872 if (!scroll_node->user_scrollable_horizontal) |
2862 delta.set_x(0); | 2873 delta.set_x(0); |
2863 if (!scroll_node->user_scrollable_vertical) | 2874 if (!scroll_node->user_scrollable_vertical) |
2864 delta.set_y(0); | 2875 delta.set_y(0); |
2865 | 2876 |
2866 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { | 2877 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { |
2867 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 2878 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
2868 } else { | 2879 } else { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3135 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3146 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
3136 active_tree()); | 3147 active_tree()); |
3137 scroll_state->DistributeToScrollChainDescendant(); | 3148 scroll_state->DistributeToScrollChainDescendant(); |
3138 } | 3149 } |
3139 | 3150 |
3140 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3151 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
3141 ScrollState* scroll_state) { | 3152 ScrollState* scroll_state) { |
3142 DCHECK(scroll_state); | 3153 DCHECK(scroll_state); |
3143 | 3154 |
3144 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 3155 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
3145 if (!CurrentlyScrollingLayer()) | 3156 |
| 3157 LayerImpl* currently_scrolling_layer = CurrentlyScrollingLayer(); |
| 3158 if (!currently_scrolling_layer) |
3146 return InputHandlerScrollResult(); | 3159 return InputHandlerScrollResult(); |
3147 | 3160 |
| 3161 ScrollbarAnimationController* animation_controller = |
| 3162 ScrollbarAnimationControllerForId(currently_scrolling_layer->id()); |
| 3163 |
| 3164 if (animation_controller) |
| 3165 animation_controller->WillUpdateScroll(); |
| 3166 |
3148 float initial_top_controls_offset = | 3167 float initial_top_controls_offset = |
3149 browser_controls_offset_manager_->ControlsTopOffset(); | 3168 browser_controls_offset_manager_->ControlsTopOffset(); |
3150 | 3169 |
3151 scroll_state->set_delta_consumed_for_scroll_sequence( | 3170 scroll_state->set_delta_consumed_for_scroll_sequence( |
3152 did_lock_scrolling_layer_); | 3171 did_lock_scrolling_layer_); |
3153 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3172 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
3154 scroll_state->set_current_native_scrolling_node( | 3173 scroll_state->set_current_native_scrolling_node( |
3155 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); | 3174 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); |
3156 | 3175 |
3157 DistributeScrollDelta(scroll_state); | 3176 DistributeScrollDelta(scroll_state); |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4140 worker_context_visibility_ = | 4159 worker_context_visibility_ = |
4141 worker_context->CacheController()->ClientBecameVisible(); | 4160 worker_context->CacheController()->ClientBecameVisible(); |
4142 } else { | 4161 } else { |
4143 worker_context->CacheController()->ClientBecameNotVisible( | 4162 worker_context->CacheController()->ClientBecameNotVisible( |
4144 std::move(worker_context_visibility_)); | 4163 std::move(worker_context_visibility_)); |
4145 } | 4164 } |
4146 } | 4165 } |
4147 } | 4166 } |
4148 | 4167 |
4149 } // namespace cc | 4168 } // namespace cc |
OLD | NEW |