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

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

Issue 2472943003: Revert "Touchpad scroll latching enabled for Mac behind flag." (Closed)
Patch Set: Better merge. Created 4 years, 1 month 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 2634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 } 2645 }
2646 2646
2647 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2647 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2648 ScrollState* scroll_state, 2648 ScrollState* scroll_state,
2649 InputHandler::ScrollInputType type) { 2649 InputHandler::ScrollInputType type) {
2650 ScrollStatus scroll_status; 2650 ScrollStatus scroll_status;
2651 scroll_status.main_thread_scrolling_reasons = 2651 scroll_status.main_thread_scrolling_reasons =
2652 MainThreadScrollingReason::kNotScrollingOnMain; 2652 MainThreadScrollingReason::kNotScrollingOnMain;
2653 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2653 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2654 2654
2655 // On Mac a scroll begin with |inertial_phase| = true happens to handle a
2656 // fling.
2657 if (scroll_state->is_in_inertial_phase())
2658 return FlingScrollBegin();
2659
2660 ClearCurrentlyScrollingLayer(); 2655 ClearCurrentlyScrollingLayer();
2661 2656
2662 gfx::Point viewport_point(scroll_state->position_x(), 2657 gfx::Point viewport_point(scroll_state->position_x(),
2663 scroll_state->position_y()); 2658 scroll_state->position_y());
2664 2659
2665 gfx::PointF device_viewport_point = gfx::ScalePoint( 2660 gfx::PointF device_viewport_point = gfx::ScalePoint(
2666 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 2661 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2667 LayerImpl* layer_impl = 2662 LayerImpl* layer_impl =
2668 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 2663 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2669 2664
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 scroll_status.thread = SCROLL_IGNORED; 2812 scroll_status.thread = SCROLL_IGNORED;
2818 scroll_status.main_thread_scrolling_reasons = 2813 scroll_status.main_thread_scrolling_reasons =
2819 MainThreadScrollingReason::kNotScrollable; 2814 MainThreadScrollingReason::kNotScrollable;
2820 } 2815 }
2821 return scroll_status; 2816 return scroll_status;
2822 } 2817 }
2823 2818
2824 ScrollStateData scroll_state_data; 2819 ScrollStateData scroll_state_data;
2825 scroll_state_data.position_x = viewport_point.x(); 2820 scroll_state_data.position_x = viewport_point.x();
2826 scroll_state_data.position_y = viewport_point.y(); 2821 scroll_state_data.position_y = viewport_point.y();
2822 scroll_state_data.is_in_inertial_phase = true;
2827 ScrollState scroll_state(scroll_state_data); 2823 ScrollState scroll_state(scroll_state_data);
2828 2824
2829 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2825 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2830 // that can scroll and set up an animation of its scroll offset. Note that 2826 // that can scroll and set up an animation of its scroll offset. Note that
2831 // this does not currently go through the scroll customization machinery 2827 // this does not currently go through the scroll customization machinery
2832 // that ScrollBy uses for non-animated wheel scrolls. 2828 // that ScrollBy uses for non-animated wheel scrolls.
2833 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2829 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2834 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2830 scroll_node = scroll_tree.CurrentlyScrollingNode();
2835 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2831 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2836 gfx::Vector2dF pending_delta = scroll_delta; 2832 gfx::Vector2dF pending_delta = scroll_delta;
(...skipping 18 matching lines...) Expand all
2855 gfx::Vector2dF scroll_delta = 2851 gfx::Vector2dF scroll_delta =
2856 ComputeScrollDelta(scroll_node, pending_delta); 2852 ComputeScrollDelta(scroll_node, pending_delta);
2857 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) 2853 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by))
2858 return scroll_status; 2854 return scroll_status;
2859 2855
2860 pending_delta -= scroll_delta; 2856 pending_delta -= scroll_delta;
2861 } 2857 }
2862 } 2858 }
2863 } 2859 }
2864 scroll_state.set_is_ending(true); 2860 scroll_state.set_is_ending(true);
2865 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2866 // implemented, the current scrolling layer should not get cleared after
2867 // each animation (crbug.com/526463).
2868 ScrollEnd(&scroll_state); 2861 ScrollEnd(&scroll_state);
2869 ClearCurrentlyScrollingLayer();
2870
2871 return scroll_status; 2862 return scroll_status;
2872 } 2863 }
2873 2864
2874 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( 2865 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta(
2875 ScrollNode* scroll_node, 2866 ScrollNode* scroll_node,
2876 const gfx::PointF& viewport_point, 2867 const gfx::PointF& viewport_point,
2877 const gfx::Vector2dF& viewport_delta, 2868 const gfx::Vector2dF& viewport_delta,
2878 ScrollTree* scroll_tree) { 2869 ScrollTree* scroll_tree) {
2879 // Layers with non-invertible screen space transforms should not have passed 2870 // Layers with non-invertible screen space transforms should not have passed
2880 // the scroll hit test in the first place. 2871 // the scroll hit test in the first place.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 scroll_affects_scroll_handler_ = false; 3169 scroll_affects_scroll_handler_ = false;
3179 accumulated_root_overscroll_ = gfx::Vector2dF(); 3170 accumulated_root_overscroll_ = gfx::Vector2dF();
3180 } 3171 }
3181 3172
3182 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { 3173 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
3183 DCHECK(scroll_state); 3174 DCHECK(scroll_state);
3184 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 3175 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
3185 3176
3186 DistributeScrollDelta(scroll_state); 3177 DistributeScrollDelta(scroll_state);
3187 top_controls_manager_->ScrollEnd(); 3178 top_controls_manager_->ScrollEnd();
3188 3179 ClearCurrentlyScrollingLayer();
3189 if (scroll_state->is_in_inertial_phase()) {
3190 // Only clear the currently scrolling layer if we know the scroll is done.
3191 // A non-inertial scroll end could be followed by an inertial scroll.
3192 ClearCurrentlyScrollingLayer();
3193 }
3194 } 3180 }
3195 3181
3196 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { 3182 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
3197 InputHandler::ScrollStatus scroll_status; 3183 InputHandler::ScrollStatus scroll_status;
3198 scroll_status.main_thread_scrolling_reasons = 3184 scroll_status.main_thread_scrolling_reasons =
3199 MainThreadScrollingReason::kNotScrollingOnMain; 3185 MainThreadScrollingReason::kNotScrollingOnMain;
3200 if (!CurrentlyScrollingLayer()) { 3186 if (!CurrentlyScrollingLayer()) {
3201 scroll_status.thread = SCROLL_IGNORED; 3187 scroll_status.thread = SCROLL_IGNORED;
3202 scroll_status.main_thread_scrolling_reasons = 3188 scroll_status.main_thread_scrolling_reasons =
3203 MainThreadScrollingReason::kNoScrollingLayer; 3189 MainThreadScrollingReason::kNoScrollingLayer;
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 return; 4009 return;
4024 LayerImpl* layer = tree->LayerByElementId(element_id); 4010 LayerImpl* layer = tree->LayerByElementId(element_id);
4025 if (layer) 4011 if (layer)
4026 layer->OnIsAnimatingChanged(mask, state); 4012 layer->OnIsAnimatingChanged(mask, state);
4027 } 4013 }
4028 4014
4029 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { 4015 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
4030 // TODO(majidvp): We should pass in the original starting scroll position here 4016 // TODO(majidvp): We should pass in the original starting scroll position here
4031 ScrollStateData scroll_state_data; 4017 ScrollStateData scroll_state_data;
4032 ScrollState scroll_state(scroll_state_data); 4018 ScrollState scroll_state(scroll_state_data);
4033 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
4034 // implemented, the current scrolling layer should not get cleared after
4035 // each animation (crbug.com/526463).
4036 ScrollEnd(&scroll_state); 4019 ScrollEnd(&scroll_state);
4037 ClearCurrentlyScrollingLayer();
4038 } 4020 }
4039 4021
4040 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( 4022 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
4041 ElementId element_id) const { 4023 ElementId element_id) const {
4042 if (active_tree()) { 4024 if (active_tree()) {
4043 LayerImpl* layer = active_tree()->LayerByElementId(element_id); 4025 LayerImpl* layer = active_tree()->LayerByElementId(element_id);
4044 if (layer) 4026 if (layer)
4045 return layer->ScrollOffsetForAnimation(); 4027 return layer->ScrollOffsetForAnimation();
4046 } 4028 }
4047 4029
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 if (is_visible) { 4078 if (is_visible) {
4097 worker_context_visibility_ = 4079 worker_context_visibility_ =
4098 worker_context->CacheController()->ClientBecameVisible(); 4080 worker_context->CacheController()->ClientBecameVisible();
4099 } else { 4081 } else {
4100 worker_context->CacheController()->ClientBecameNotVisible( 4082 worker_context->CacheController()->ClientBecameNotVisible(
4101 std::move(worker_context_visibility_)); 4083 std::move(worker_context_visibility_));
4102 } 4084 }
4103 } 4085 }
4104 4086
4105 } // namespace cc 4087 } // 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