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

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

Issue 2467023003: Revert "Touchpad scroll latching enabled for Mac behind flag." (Closed)
Patch Set: 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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 } 2636 }
2637 2637
2638 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2638 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2639 ScrollState* scroll_state, 2639 ScrollState* scroll_state,
2640 InputHandler::ScrollInputType type) { 2640 InputHandler::ScrollInputType type) {
2641 ScrollStatus scroll_status; 2641 ScrollStatus scroll_status;
2642 scroll_status.main_thread_scrolling_reasons = 2642 scroll_status.main_thread_scrolling_reasons =
2643 MainThreadScrollingReason::kNotScrollingOnMain; 2643 MainThreadScrollingReason::kNotScrollingOnMain;
2644 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2644 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2645 2645
2646 // On Mac a scroll begin with |inertial_phase| = true happens to handle a
2647 // fling.
2648 if (scroll_state->is_in_inertial_phase())
2649 return FlingScrollBegin();
2650
2651 ClearCurrentlyScrollingLayer(); 2646 ClearCurrentlyScrollingLayer();
2652 2647
2653 gfx::Point viewport_point(scroll_state->position_x(), 2648 gfx::Point viewport_point(scroll_state->position_x(),
2654 scroll_state->position_y()); 2649 scroll_state->position_y());
2655 2650
2656 gfx::PointF device_viewport_point = gfx::ScalePoint( 2651 gfx::PointF device_viewport_point = gfx::ScalePoint(
2657 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 2652 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2658 LayerImpl* layer_impl = 2653 LayerImpl* layer_impl =
2659 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 2654 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2660 2655
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 scroll_status.thread = SCROLL_IGNORED; 2803 scroll_status.thread = SCROLL_IGNORED;
2809 scroll_status.main_thread_scrolling_reasons = 2804 scroll_status.main_thread_scrolling_reasons =
2810 MainThreadScrollingReason::kNotScrollable; 2805 MainThreadScrollingReason::kNotScrollable;
2811 } 2806 }
2812 return scroll_status; 2807 return scroll_status;
2813 } 2808 }
2814 2809
2815 ScrollStateData scroll_state_data; 2810 ScrollStateData scroll_state_data;
2816 scroll_state_data.position_x = viewport_point.x(); 2811 scroll_state_data.position_x = viewport_point.x();
2817 scroll_state_data.position_y = viewport_point.y(); 2812 scroll_state_data.position_y = viewport_point.y();
2813 scroll_state_data.is_in_inertial_phase = true;
2818 ScrollState scroll_state(scroll_state_data); 2814 ScrollState scroll_state(scroll_state_data);
2819 2815
2820 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2816 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2821 // that can scroll and set up an animation of its scroll offset. Note that 2817 // that can scroll and set up an animation of its scroll offset. Note that
2822 // this does not currently go through the scroll customization machinery 2818 // this does not currently go through the scroll customization machinery
2823 // that ScrollBy uses for non-animated wheel scrolls. 2819 // that ScrollBy uses for non-animated wheel scrolls.
2824 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2820 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2825 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2821 scroll_node = scroll_tree.CurrentlyScrollingNode();
2826 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2822 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2827 gfx::Vector2dF pending_delta = scroll_delta; 2823 gfx::Vector2dF pending_delta = scroll_delta;
(...skipping 17 matching lines...) Expand all
2845 gfx::Vector2dF scroll_delta = 2841 gfx::Vector2dF scroll_delta =
2846 ComputeScrollDelta(scroll_node, pending_delta); 2842 ComputeScrollDelta(scroll_node, pending_delta);
2847 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) 2843 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by))
2848 return scroll_status; 2844 return scroll_status;
2849 2845
2850 pending_delta -= scroll_delta; 2846 pending_delta -= scroll_delta;
2851 } 2847 }
2852 } 2848 }
2853 } 2849 }
2854 scroll_state.set_is_ending(true); 2850 scroll_state.set_is_ending(true);
2855 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2856 // implemented, the current scrolling layer should not get cleared after
2857 // each animation (crbug.com/526463).
2858 ScrollEnd(&scroll_state); 2851 ScrollEnd(&scroll_state);
2859 ClearCurrentlyScrollingLayer();
2860
2861 return scroll_status; 2852 return scroll_status;
2862 } 2853 }
2863 2854
2864 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( 2855 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta(
2865 ScrollNode* scroll_node, 2856 ScrollNode* scroll_node,
2866 const gfx::PointF& viewport_point, 2857 const gfx::PointF& viewport_point,
2867 const gfx::Vector2dF& viewport_delta, 2858 const gfx::Vector2dF& viewport_delta,
2868 ScrollTree* scroll_tree) { 2859 ScrollTree* scroll_tree) {
2869 // Layers with non-invertible screen space transforms should not have passed 2860 // Layers with non-invertible screen space transforms should not have passed
2870 // the scroll hit test in the first place. 2861 // the scroll hit test in the first place.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 scroll_affects_scroll_handler_ = false; 3161 scroll_affects_scroll_handler_ = false;
3171 accumulated_root_overscroll_ = gfx::Vector2dF(); 3162 accumulated_root_overscroll_ = gfx::Vector2dF();
3172 } 3163 }
3173 3164
3174 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { 3165 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
3175 DCHECK(scroll_state); 3166 DCHECK(scroll_state);
3176 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 3167 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
3177 3168
3178 DistributeScrollDelta(scroll_state); 3169 DistributeScrollDelta(scroll_state);
3179 browser_controls_offset_manager_->ScrollEnd(); 3170 browser_controls_offset_manager_->ScrollEnd();
3180 3171 ClearCurrentlyScrollingLayer();
3181 if (scroll_state->is_in_inertial_phase()) {
3182 // Only clear the currently scrolling layer if we know the scroll is done.
3183 // A non-inertial scroll end could be followed by an inertial scroll.
3184 ClearCurrentlyScrollingLayer();
3185 }
3186 } 3172 }
3187 3173
3188 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { 3174 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
3189 InputHandler::ScrollStatus scroll_status; 3175 InputHandler::ScrollStatus scroll_status;
3190 scroll_status.main_thread_scrolling_reasons = 3176 scroll_status.main_thread_scrolling_reasons =
3191 MainThreadScrollingReason::kNotScrollingOnMain; 3177 MainThreadScrollingReason::kNotScrollingOnMain;
3192 if (!CurrentlyScrollingLayer()) { 3178 if (!CurrentlyScrollingLayer()) {
3193 scroll_status.thread = SCROLL_IGNORED; 3179 scroll_status.thread = SCROLL_IGNORED;
3194 scroll_status.main_thread_scrolling_reasons = 3180 scroll_status.main_thread_scrolling_reasons =
3195 MainThreadScrollingReason::kNoScrollingLayer; 3181 MainThreadScrollingReason::kNoScrollingLayer;
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 return; 4010 return;
4025 LayerImpl* layer = tree->LayerByElementId(element_id); 4011 LayerImpl* layer = tree->LayerByElementId(element_id);
4026 if (layer) 4012 if (layer)
4027 layer->OnIsAnimatingChanged(mask, state); 4013 layer->OnIsAnimatingChanged(mask, state);
4028 } 4014 }
4029 4015
4030 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { 4016 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
4031 // TODO(majidvp): We should pass in the original starting scroll position here 4017 // TODO(majidvp): We should pass in the original starting scroll position here
4032 ScrollStateData scroll_state_data; 4018 ScrollStateData scroll_state_data;
4033 ScrollState scroll_state(scroll_state_data); 4019 ScrollState scroll_state(scroll_state_data);
4034 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
4035 // implemented, the current scrolling layer should not get cleared after
4036 // each animation (crbug.com/526463).
4037 ScrollEnd(&scroll_state); 4020 ScrollEnd(&scroll_state);
4038 ClearCurrentlyScrollingLayer();
4039 } 4021 }
4040 4022
4041 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( 4023 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
4042 ElementId element_id) const { 4024 ElementId element_id) const {
4043 if (active_tree()) { 4025 if (active_tree()) {
4044 LayerImpl* layer = active_tree()->LayerByElementId(element_id); 4026 LayerImpl* layer = active_tree()->LayerByElementId(element_id);
4045 if (layer) 4027 if (layer)
4046 return layer->ScrollOffsetForAnimation(); 4028 return layer->ScrollOffsetForAnimation();
4047 } 4029 }
4048 4030
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4097 if (is_visible) { 4079 if (is_visible) {
4098 worker_context_visibility_ = 4080 worker_context_visibility_ =
4099 worker_context->CacheController()->ClientBecameVisible(); 4081 worker_context->CacheController()->ClientBecameVisible();
4100 } else { 4082 } else {
4101 worker_context->CacheController()->ClientBecameNotVisible( 4083 worker_context->CacheController()->ClientBecameNotVisible(
4102 std::move(worker_context_visibility_)); 4084 std::move(worker_context_visibility_));
4103 } 4085 }
4104 } 4086 }
4105 4087
4106 } // namespace cc 4088 } // 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