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 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 | 2893 |
2894 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( | 2894 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( |
2895 const gfx::Point& viewport_point, | 2895 const gfx::Point& viewport_point, |
2896 const gfx::Vector2dF& scroll_delta, | 2896 const gfx::Vector2dF& scroll_delta, |
2897 base::TimeDelta delayed_by) { | 2897 base::TimeDelta delayed_by) { |
2898 InputHandler::ScrollStatus scroll_status; | 2898 InputHandler::ScrollStatus scroll_status; |
2899 scroll_status.main_thread_scrolling_reasons = | 2899 scroll_status.main_thread_scrolling_reasons = |
2900 MainThreadScrollingReason::kNotScrollingOnMain; | 2900 MainThreadScrollingReason::kNotScrollingOnMain; |
2901 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2901 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
2902 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2902 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 2903 |
2903 if (scroll_node) { | 2904 if (scroll_node) { |
| 2905 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 2906 ScrollbarAnimationController* animation_controller = |
| 2907 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); |
| 2908 |
| 2909 if (animation_controller) |
| 2910 animation_controller->WillUpdateScroll(); |
| 2911 |
2904 gfx::Vector2dF delta = scroll_delta; | 2912 gfx::Vector2dF delta = scroll_delta; |
2905 if (!scroll_node->user_scrollable_horizontal) | 2913 if (!scroll_node->user_scrollable_horizontal) |
2906 delta.set_x(0); | 2914 delta.set_x(0); |
2907 if (!scroll_node->user_scrollable_vertical) | 2915 if (!scroll_node->user_scrollable_vertical) |
2908 delta.set_y(0); | 2916 delta.set_y(0); |
2909 | 2917 |
2910 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { | 2918 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { |
2911 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 2919 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
2912 } else { | 2920 } else { |
2913 scroll_status.thread = SCROLL_IGNORED; | 2921 scroll_status.thread = SCROLL_IGNORED; |
(...skipping 18 matching lines...) Expand all Loading... |
2932 gfx::Vector2dF pending_delta = scroll_delta; | 2940 gfx::Vector2dF pending_delta = scroll_delta; |
2933 for (; scroll_tree.parent(scroll_node); | 2941 for (; scroll_tree.parent(scroll_node); |
2934 scroll_node = scroll_tree.parent(scroll_node)) { | 2942 scroll_node = scroll_tree.parent(scroll_node)) { |
2935 if (!scroll_node->scrollable) | 2943 if (!scroll_node->scrollable) |
2936 continue; | 2944 continue; |
2937 | 2945 |
2938 bool scrolls_main_viewport_scroll_layer = | 2946 bool scrolls_main_viewport_scroll_layer = |
2939 viewport()->MainScrollLayer() && | 2947 viewport()->MainScrollLayer() && |
2940 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; | 2948 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; |
2941 if (scrolls_main_viewport_scroll_layer) { | 2949 if (scrolls_main_viewport_scroll_layer) { |
| 2950 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 2951 ScrollbarAnimationController* animation_controller = |
| 2952 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); |
| 2953 |
| 2954 if (animation_controller) |
| 2955 animation_controller->WillUpdateScroll(); |
| 2956 |
2942 gfx::Vector2dF scrolled = | 2957 gfx::Vector2dF scrolled = |
2943 viewport()->ScrollAnimated(pending_delta, delayed_by); | 2958 viewport()->ScrollAnimated(pending_delta, delayed_by); |
2944 // Viewport::ScrollAnimated returns pending_delta as long as it starts | 2959 // Viewport::ScrollAnimated returns pending_delta as long as it starts |
2945 // an animation. | 2960 // an animation. |
2946 if (scrolled == pending_delta) | 2961 if (scrolled == pending_delta) |
2947 return scroll_status; | 2962 return scroll_status; |
2948 break; | 2963 break; |
2949 } | 2964 } |
2950 | 2965 |
2951 gfx::Vector2dF scroll_delta = | 2966 gfx::Vector2dF scroll_delta = |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3191 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
3177 active_tree()); | 3192 active_tree()); |
3178 scroll_state->DistributeToScrollChainDescendant(); | 3193 scroll_state->DistributeToScrollChainDescendant(); |
3179 } | 3194 } |
3180 | 3195 |
3181 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3196 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
3182 ScrollState* scroll_state) { | 3197 ScrollState* scroll_state) { |
3183 DCHECK(scroll_state); | 3198 DCHECK(scroll_state); |
3184 | 3199 |
3185 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 3200 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
3186 if (!CurrentlyScrollingNode()) | 3201 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 3202 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 3203 |
| 3204 if (!scroll_node) |
3187 return InputHandlerScrollResult(); | 3205 return InputHandlerScrollResult(); |
3188 | 3206 |
| 3207 ScrollbarAnimationController* animation_controller = |
| 3208 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); |
| 3209 |
| 3210 if (animation_controller) |
| 3211 animation_controller->WillUpdateScroll(); |
| 3212 |
3189 float initial_top_controls_offset = | 3213 float initial_top_controls_offset = |
3190 browser_controls_offset_manager_->ControlsTopOffset(); | 3214 browser_controls_offset_manager_->ControlsTopOffset(); |
3191 | 3215 |
3192 scroll_state->set_delta_consumed_for_scroll_sequence( | 3216 scroll_state->set_delta_consumed_for_scroll_sequence( |
3193 did_lock_scrolling_layer_); | 3217 did_lock_scrolling_layer_); |
3194 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3218 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
3195 scroll_state->set_current_native_scrolling_node( | 3219 scroll_state->set_current_native_scrolling_node( |
3196 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); | 3220 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); |
3197 | 3221 |
3198 DistributeScrollDelta(scroll_state); | 3222 DistributeScrollDelta(scroll_state); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4182 worker_context_visibility_ = | 4206 worker_context_visibility_ = |
4183 worker_context->CacheController()->ClientBecameVisible(); | 4207 worker_context->CacheController()->ClientBecameVisible(); |
4184 } else { | 4208 } else { |
4185 worker_context->CacheController()->ClientBecameNotVisible( | 4209 worker_context->CacheController()->ClientBecameNotVisible( |
4186 std::move(worker_context_visibility_)); | 4210 std::move(worker_context_visibility_)); |
4187 } | 4211 } |
4188 } | 4212 } |
4189 } | 4213 } |
4190 | 4214 |
4191 } // namespace cc | 4215 } // namespace cc |
OLD | NEW |