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

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

Issue 2770733002: Reland of Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: fix for gpu memory issue 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
2907 if (scroll_node) { 2908 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
2908 gfx::Vector2dF delta = scroll_delta; 2916 gfx::Vector2dF delta = scroll_delta;
2909 if (!scroll_node->user_scrollable_horizontal) 2917 if (!scroll_node->user_scrollable_horizontal)
2910 delta.set_x(0); 2918 delta.set_x(0);
2911 if (!scroll_node->user_scrollable_vertical) 2919 if (!scroll_node->user_scrollable_vertical)
2912 delta.set_y(0); 2920 delta.set_y(0);
2913 2921
2914 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { 2922 if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) {
2915 scroll_status.thread = SCROLL_ON_IMPL_THREAD; 2923 scroll_status.thread = SCROLL_ON_IMPL_THREAD;
2916 } else { 2924 } else {
2917 scroll_status.thread = SCROLL_IGNORED; 2925 scroll_status.thread = SCROLL_IGNORED;
(...skipping 18 matching lines...) Expand all
2936 gfx::Vector2dF pending_delta = scroll_delta; 2944 gfx::Vector2dF pending_delta = scroll_delta;
2937 for (; scroll_tree.parent(scroll_node); 2945 for (; scroll_tree.parent(scroll_node);
2938 scroll_node = scroll_tree.parent(scroll_node)) { 2946 scroll_node = scroll_tree.parent(scroll_node)) {
2939 if (!scroll_node->scrollable) 2947 if (!scroll_node->scrollable)
2940 continue; 2948 continue;
2941 2949
2942 bool scrolls_main_viewport_scroll_layer = 2950 bool scrolls_main_viewport_scroll_layer =
2943 viewport()->MainScrollLayer() && 2951 viewport()->MainScrollLayer() &&
2944 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; 2952 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id;
2945 if (scrolls_main_viewport_scroll_layer) { 2953 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
2946 gfx::Vector2dF scrolled = 2961 gfx::Vector2dF scrolled =
2947 viewport()->ScrollAnimated(pending_delta, delayed_by); 2962 viewport()->ScrollAnimated(pending_delta, delayed_by);
2948 // Viewport::ScrollAnimated returns pending_delta as long as it starts 2963 // Viewport::ScrollAnimated returns pending_delta as long as it starts
2949 // an animation. 2964 // an animation.
2950 if (scrolled == pending_delta) 2965 if (scrolled == pending_delta)
2951 return scroll_status; 2966 return scroll_status;
2952 break; 2967 break;
2953 } 2968 }
2954 2969
2955 gfx::Vector2dF scroll_delta = 2970 gfx::Vector2dF scroll_delta =
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3180 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, 3195 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,
3181 active_tree()); 3196 active_tree());
3182 scroll_state->DistributeToScrollChainDescendant(); 3197 scroll_state->DistributeToScrollChainDescendant();
3183 } 3198 }
3184 3199
3185 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( 3200 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
3186 ScrollState* scroll_state) { 3201 ScrollState* scroll_state) {
3187 DCHECK(scroll_state); 3202 DCHECK(scroll_state);
3188 3203
3189 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); 3204 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
3190 if (!CurrentlyScrollingNode()) 3205 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
3206 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode();
3207
3208 if (!scroll_node)
3191 return InputHandlerScrollResult(); 3209 return InputHandlerScrollResult();
3192 3210
3211 ScrollbarAnimationController* animation_controller =
3212 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id);
3213
3214 if (animation_controller)
3215 animation_controller->WillUpdateScroll();
3216
3193 float initial_top_controls_offset = 3217 float initial_top_controls_offset =
3194 browser_controls_offset_manager_->ControlsTopOffset(); 3218 browser_controls_offset_manager_->ControlsTopOffset();
3195 3219
3196 scroll_state->set_delta_consumed_for_scroll_sequence( 3220 scroll_state->set_delta_consumed_for_scroll_sequence(
3197 did_lock_scrolling_layer_); 3221 did_lock_scrolling_layer_);
3198 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); 3222 scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
3199 scroll_state->set_current_native_scrolling_node( 3223 scroll_state->set_current_native_scrolling_node(
3200 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); 3224 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode());
3201 3225
3202 DistributeScrollDelta(scroll_state); 3226 DistributeScrollDelta(scroll_state);
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4186 worker_context_visibility_ = 4210 worker_context_visibility_ =
4187 worker_context->CacheController()->ClientBecameVisible(); 4211 worker_context->CacheController()->ClientBecameVisible();
4188 } else { 4212 } else {
4189 worker_context->CacheController()->ClientBecameNotVisible( 4213 worker_context->CacheController()->ClientBecameNotVisible(
4190 std::move(worker_context_visibility_)); 4214 std::move(worker_context_visibility_));
4191 } 4215 }
4192 } 4216 }
4193 } 4217 }
4194 4218
4195 } // namespace cc 4219 } // 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