Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2748343004: Revert of Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 2897
2898 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( 2898 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
2899 const gfx::Point& viewport_point, 2899 const gfx::Point& viewport_point,
2900 const gfx::Vector2dF& scroll_delta, 2900 const gfx::Vector2dF& scroll_delta,
2901 base::TimeDelta delayed_by) { 2901 base::TimeDelta delayed_by) {
2902 InputHandler::ScrollStatus scroll_status; 2902 InputHandler::ScrollStatus scroll_status;
2903 scroll_status.main_thread_scrolling_reasons = 2903 scroll_status.main_thread_scrolling_reasons =
2904 MainThreadScrollingReason::kNotScrollingOnMain; 2904 MainThreadScrollingReason::kNotScrollingOnMain;
2905 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; 2905 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
2906 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); 2906 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode();
2907
2908 if (scroll_node) { 2907 if (scroll_node) {
2909 // Flash the overlay scrollbar even if the scroll dalta is 0.
2910 ScrollbarAnimationController* animation_controller =
2911 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id);
2912
2913 if (animation_controller)
2914 animation_controller->WillUpdateScroll();
2915
2916 gfx::Vector2dF delta = scroll_delta; 2908 gfx::Vector2dF delta = scroll_delta;
2917 if (!scroll_node->user_scrollable_horizontal) 2909 if (!scroll_node->user_scrollable_horizontal)
2918 delta.set_x(0); 2910 delta.set_x(0);
2919 if (!scroll_node->user_scrollable_vertical) 2911 if (!scroll_node->user_scrollable_vertical)
2920 delta.set_y(0); 2912 delta.set_y(0);
2921 2913
2922 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { 2914 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) {
2923 scroll_status.thread = SCROLL_ON_IMPL_THREAD; 2915 scroll_status.thread = SCROLL_ON_IMPL_THREAD;
2924 } else { 2916 } else {
2925 scroll_status.thread = SCROLL_IGNORED; 2917 scroll_status.thread = SCROLL_IGNORED;
(...skipping 18 matching lines...) Expand all
2944 gfx::Vector2dF pending_delta = scroll_delta; 2936 gfx::Vector2dF pending_delta = scroll_delta;
2945 for (; scroll_tree.parent(scroll_node); 2937 for (; scroll_tree.parent(scroll_node);
2946 scroll_node = scroll_tree.parent(scroll_node)) { 2938 scroll_node = scroll_tree.parent(scroll_node)) {
2947 if (!scroll_node->scrollable) 2939 if (!scroll_node->scrollable)
2948 continue; 2940 continue;
2949 2941
2950 bool scrolls_main_viewport_scroll_layer = 2942 bool scrolls_main_viewport_scroll_layer =
2951 viewport()->MainScrollLayer() && 2943 viewport()->MainScrollLayer() &&
2952 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; 2944 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id;
2953 if (scrolls_main_viewport_scroll_layer) { 2945 if (scrolls_main_viewport_scroll_layer) {
2954 // Flash the overlay scrollbar even if the scroll dalta is 0.
2955 ScrollbarAnimationController* animation_controller =
2956 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id);
2957
2958 if (animation_controller)
2959 animation_controller->WillUpdateScroll();
2960
2961 gfx::Vector2dF scrolled = 2946 gfx::Vector2dF scrolled =
2962 viewport()->ScrollAnimated(pending_delta, delayed_by); 2947 viewport()->ScrollAnimated(pending_delta, delayed_by);
2963 // Viewport::ScrollAnimated returns pending_delta as long as it starts 2948 // Viewport::ScrollAnimated returns pending_delta as long as it starts
2964 // an animation. 2949 // an animation.
2965 if (scrolled == pending_delta) 2950 if (scrolled == pending_delta)
2966 return scroll_status; 2951 return scroll_status;
2967 break; 2952 break;
2968 } 2953 }
2969 2954
2970 gfx::Vector2dF scroll_delta = 2955 gfx::Vector2dF scroll_delta =
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, 3180 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,
3196 active_tree()); 3181 active_tree());
3197 scroll_state->DistributeToScrollChainDescendant(); 3182 scroll_state->DistributeToScrollChainDescendant();
3198 } 3183 }
3199 3184
3200 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( 3185 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
3201 ScrollState* scroll_state) { 3186 ScrollState* scroll_state) {
3202 DCHECK(scroll_state); 3187 DCHECK(scroll_state);
3203 3188
3204 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); 3189 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
3205 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; 3190 if (!CurrentlyScrollingNode())
3206 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode();
3207
3208 if (!scroll_node)
3209 return InputHandlerScrollResult(); 3191 return InputHandlerScrollResult();
3210 3192
3211 ScrollbarAnimationController* animation_controller =
3212 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id);
3213
3214 if (animation_controller)
3215 animation_controller->WillUpdateScroll();
3216
3217 float initial_top_controls_offset = 3193 float initial_top_controls_offset =
3218 browser_controls_offset_manager_->ControlsTopOffset(); 3194 browser_controls_offset_manager_->ControlsTopOffset();
3219 3195
3220 scroll_state->set_delta_consumed_for_scroll_sequence( 3196 scroll_state->set_delta_consumed_for_scroll_sequence(
3221 did_lock_scrolling_layer_); 3197 did_lock_scrolling_layer_);
3222 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); 3198 scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
3223 scroll_state->set_current_native_scrolling_node( 3199 scroll_state->set_current_native_scrolling_node(
3224 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); 3200 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode());
3225 3201
3226 DistributeScrollDelta(scroll_state); 3202 DistributeScrollDelta(scroll_state);
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 worker_context_visibility_ = 4186 worker_context_visibility_ =
4211 worker_context->CacheController()->ClientBecameVisible(); 4187 worker_context->CacheController()->ClientBecameVisible();
4212 } else { 4188 } else {
4213 worker_context->CacheController()->ClientBecameNotVisible( 4189 worker_context->CacheController()->ClientBecameNotVisible(
4214 std::move(worker_context_visibility_)); 4190 std::move(worker_context_visibility_));
4215 } 4191 }
4216 } 4192 }
4217 } 4193 }
4218 4194
4219 } // namespace cc 4195 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698