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

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

Issue 2358993002: Revert "Touchpad scroll latching enabled for Mac behind flag." (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 } 2682 }
2683 2683
2684 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2684 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2685 ScrollState* scroll_state, 2685 ScrollState* scroll_state,
2686 InputHandler::ScrollInputType type) { 2686 InputHandler::ScrollInputType type) {
2687 ScrollStatus scroll_status; 2687 ScrollStatus scroll_status;
2688 scroll_status.main_thread_scrolling_reasons = 2688 scroll_status.main_thread_scrolling_reasons =
2689 MainThreadScrollingReason::kNotScrollingOnMain; 2689 MainThreadScrollingReason::kNotScrollingOnMain;
2690 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2690 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2691 2691
2692 // On Mac a scroll begin with |inertial_phase| = true happens to handle a
2693 // fling.
2694 if (scroll_state->is_in_inertial_phase())
2695 return FlingScrollBegin();
2696
2697 ClearCurrentlyScrollingLayer(); 2692 ClearCurrentlyScrollingLayer();
2698 2693
2699 gfx::Point viewport_point(scroll_state->position_x(), 2694 gfx::Point viewport_point(scroll_state->position_x(),
2700 scroll_state->position_y()); 2695 scroll_state->position_y());
2701 2696
2702 gfx::PointF device_viewport_point = gfx::ScalePoint( 2697 gfx::PointF device_viewport_point = gfx::ScalePoint(
2703 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 2698 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2704 LayerImpl* layer_impl = 2699 LayerImpl* layer_impl =
2705 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 2700 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2706 2701
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 scroll_status.thread = SCROLL_IGNORED; 2844 scroll_status.thread = SCROLL_IGNORED;
2850 scroll_status.main_thread_scrolling_reasons = 2845 scroll_status.main_thread_scrolling_reasons =
2851 MainThreadScrollingReason::kNotScrollable; 2846 MainThreadScrollingReason::kNotScrollable;
2852 } 2847 }
2853 return scroll_status; 2848 return scroll_status;
2854 } 2849 }
2855 2850
2856 ScrollStateData scroll_state_data; 2851 ScrollStateData scroll_state_data;
2857 scroll_state_data.position_x = viewport_point.x(); 2852 scroll_state_data.position_x = viewport_point.x();
2858 scroll_state_data.position_y = viewport_point.y(); 2853 scroll_state_data.position_y = viewport_point.y();
2859 scroll_state_data.is_in_inertial_phase = false; 2854 scroll_state_data.is_in_inertial_phase = true;
2860 ScrollState scroll_state(scroll_state_data); 2855 ScrollState scroll_state(scroll_state_data);
2861 2856
2862 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2857 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2863 // that can scroll and set up an animation of its scroll offset. Note that 2858 // that can scroll and set up an animation of its scroll offset. Note that
2864 // this does not currently go through the scroll customization machinery 2859 // this does not currently go through the scroll customization machinery
2865 // that ScrollBy uses for non-animated wheel scrolls. 2860 // that ScrollBy uses for non-animated wheel scrolls.
2866 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2861 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2867 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2862 scroll_node = scroll_tree.CurrentlyScrollingNode();
2868 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2863 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2869 gfx::Vector2dF pending_delta = scroll_delta; 2864 gfx::Vector2dF pending_delta = scroll_delta;
(...skipping 17 matching lines...) Expand all
2887 gfx::Vector2dF scroll_delta = 2882 gfx::Vector2dF scroll_delta =
2888 ComputeScrollDelta(scroll_node, pending_delta); 2883 ComputeScrollDelta(scroll_node, pending_delta);
2889 if (ScrollAnimationCreate(scroll_node, scroll_delta)) 2884 if (ScrollAnimationCreate(scroll_node, scroll_delta))
2890 return scroll_status; 2885 return scroll_status;
2891 2886
2892 pending_delta -= scroll_delta; 2887 pending_delta -= scroll_delta;
2893 } 2888 }
2894 } 2889 }
2895 } 2890 }
2896 scroll_state.set_is_ending(true); 2891 scroll_state.set_is_ending(true);
2897 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2898 // impelemented, the current scrolling layer should not get cleared after
2899 // each animation (crbug.com/526463).
2900 ScrollEnd(&scroll_state); 2892 ScrollEnd(&scroll_state);
2901 ClearCurrentlyScrollingLayer();
2902
2903 return scroll_status; 2893 return scroll_status;
2904 } 2894 }
2905 2895
2906 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( 2896 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta(
2907 ScrollNode* scroll_node, 2897 ScrollNode* scroll_node,
2908 const gfx::PointF& viewport_point, 2898 const gfx::PointF& viewport_point,
2909 const gfx::Vector2dF& viewport_delta, 2899 const gfx::Vector2dF& viewport_delta,
2910 ScrollTree* scroll_tree) { 2900 ScrollTree* scroll_tree) {
2911 // Layers with non-invertible screen space transforms should not have passed 2901 // Layers with non-invertible screen space transforms should not have passed
2912 // the scroll hit test in the first place. 2902 // the scroll hit test in the first place.
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 scroll_affects_scroll_handler_ = false; 3236 scroll_affects_scroll_handler_ = false;
3247 accumulated_root_overscroll_ = gfx::Vector2dF(); 3237 accumulated_root_overscroll_ = gfx::Vector2dF();
3248 } 3238 }
3249 3239
3250 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { 3240 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
3251 DCHECK(scroll_state); 3241 DCHECK(scroll_state);
3252 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 3242 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
3253 3243
3254 DistributeScrollDelta(scroll_state); 3244 DistributeScrollDelta(scroll_state);
3255 top_controls_manager_->ScrollEnd(); 3245 top_controls_manager_->ScrollEnd();
3256 3246 ClearCurrentlyScrollingLayer();
3257 if (scroll_state->is_in_inertial_phase()) {
3258 // Only clear the currently scrolling layer if we know the scroll is done.
3259 // A non-inertial scroll end could be followed by an inertial scroll.
3260 ClearCurrentlyScrollingLayer();
3261 }
3262 } 3247 }
3263 3248
3264 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { 3249 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
3265 InputHandler::ScrollStatus scroll_status; 3250 InputHandler::ScrollStatus scroll_status;
3266 scroll_status.main_thread_scrolling_reasons = 3251 scroll_status.main_thread_scrolling_reasons =
3267 MainThreadScrollingReason::kNotScrollingOnMain; 3252 MainThreadScrollingReason::kNotScrollingOnMain;
3268 if (!CurrentlyScrollingLayer()) { 3253 if (!CurrentlyScrollingLayer()) {
3269 scroll_status.thread = SCROLL_IGNORED; 3254 scroll_status.thread = SCROLL_IGNORED;
3270 scroll_status.main_thread_scrolling_reasons = 3255 scroll_status.main_thread_scrolling_reasons =
3271 MainThreadScrollingReason::kNoScrollingLayer; 3256 MainThreadScrollingReason::kNoScrollingLayer;
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
4123 layer->OnFilterIsCurrentlyAnimatingChanged(is_animating); 4108 layer->OnFilterIsCurrentlyAnimatingChanged(is_animating);
4124 break; 4109 break;
4125 } 4110 }
4126 } 4111 }
4127 } 4112 }
4128 4113
4129 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { 4114 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
4130 // TODO(majidvp): We should pass in the original starting scroll position here 4115 // TODO(majidvp): We should pass in the original starting scroll position here
4131 ScrollStateData scroll_state_data; 4116 ScrollStateData scroll_state_data;
4132 ScrollState scroll_state(scroll_state_data); 4117 ScrollState scroll_state(scroll_state_data);
4133 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
4134 // impelemented, the current scrolling layer should not get cleared after
4135 // each animation (crbug.com/526463).
4136 ScrollEnd(&scroll_state); 4118 ScrollEnd(&scroll_state);
4137 ClearCurrentlyScrollingLayer();
4138 } 4119 }
4139 4120
4140 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( 4121 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
4141 ElementId element_id) const { 4122 ElementId element_id) const {
4142 if (active_tree()) { 4123 if (active_tree()) {
4143 LayerImpl* layer = active_tree()->LayerByElementId(element_id); 4124 LayerImpl* layer = active_tree()->LayerByElementId(element_id);
4144 if (layer) 4125 if (layer)
4145 return layer->ScrollOffsetForAnimation(); 4126 return layer->ScrollOffsetForAnimation();
4146 } 4127 }
4147 4128
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 if (is_visible) { 4177 if (is_visible) {
4197 worker_context_visibility_ = 4178 worker_context_visibility_ =
4198 worker_context->CacheController()->ClientBecameVisible(); 4179 worker_context->CacheController()->ClientBecameVisible();
4199 } else { 4180 } else {
4200 worker_context->CacheController()->ClientBecameNotVisible( 4181 worker_context->CacheController()->ClientBecameNotVisible(
4201 std::move(worker_context_visibility_)); 4182 std::move(worker_context_visibility_));
4202 } 4183 }
4203 } 4184 }
4204 4185
4205 } // namespace cc 4186 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698