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

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

Issue 2158423002: Wheel scroll latching enabled behind flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: features deleted from blink features. Created 4 years, 5 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 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 2677
2678 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type); 2678 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type);
2679 } 2679 }
2680 2680
2681 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2681 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2682 ScrollState* scroll_state, 2682 ScrollState* scroll_state,
2683 InputHandler::ScrollInputType type) { 2683 InputHandler::ScrollInputType type) {
2684 ScrollStatus scroll_status; 2684 ScrollStatus scroll_status;
2685 scroll_status.main_thread_scrolling_reasons = 2685 scroll_status.main_thread_scrolling_reasons =
2686 MainThreadScrollingReason::kNotScrollingOnMain; 2686 MainThreadScrollingReason::kNotScrollingOnMain;
2687
2687 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2688 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2688 2689
2690 if (scroll_state->is_in_inertial_phase())
2691 return FlingScrollBegin();
ericrk 2016/07/19 20:21:51 To make sure I'm understanding this: Is the idea
sahel 2016/07/19 22:47:03 Yes, because in mac flings are handled as scrolls.
2692
2689 ClearCurrentlyScrollingLayer(); 2693 ClearCurrentlyScrollingLayer();
2690 2694
2691 gfx::Point viewport_point(scroll_state->position_x(), 2695 gfx::Point viewport_point(scroll_state->position_x(),
2692 scroll_state->position_y()); 2696 scroll_state->position_y());
2693 2697
2694 gfx::PointF device_viewport_point = gfx::ScalePoint( 2698 gfx::PointF device_viewport_point = gfx::ScalePoint(
2695 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 2699 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2696 LayerImpl* layer_impl = 2700 LayerImpl* layer_impl =
2697 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 2701 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2698 2702
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 scroll_affects_scroll_handler_ = false; 3235 scroll_affects_scroll_handler_ = false;
3232 accumulated_root_overscroll_ = gfx::Vector2dF(); 3236 accumulated_root_overscroll_ = gfx::Vector2dF();
3233 } 3237 }
3234 3238
3235 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { 3239 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
3236 DCHECK(scroll_state); 3240 DCHECK(scroll_state);
3237 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 3241 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
3238 3242
3239 DistributeScrollDelta(scroll_state); 3243 DistributeScrollDelta(scroll_state);
3240 top_controls_manager_->ScrollEnd(); 3244 top_controls_manager_->ScrollEnd();
3241 ClearCurrentlyScrollingLayer(); 3245
3246 if (scroll_state->is_in_inertial_phase()) {
ericrk 2016/07/19 20:21:51 I though that is_in_inertial_phase indicated that
sahel 2016/07/19 22:47:03 in ScrollEnd, is_in_inertial_phase is true iff the
ericrk 2016/07/20 17:44:35 Ok, this makes sense, thanks for explaining.
3247 // There might be a fling after the scroll end. In those cases,
3248 // don't clear the currently scrolling layer to avoid a new hit test for the
3249 // fling.
3250 ClearCurrentlyScrollingLayer();
3251 }
3242 } 3252 }
3243 3253
3244 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { 3254 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
3245 InputHandler::ScrollStatus scroll_status; 3255 InputHandler::ScrollStatus scroll_status;
3246 scroll_status.main_thread_scrolling_reasons = 3256 scroll_status.main_thread_scrolling_reasons =
3247 MainThreadScrollingReason::kNotScrollingOnMain; 3257 MainThreadScrollingReason::kNotScrollingOnMain;
3248 if (!CurrentlyScrollingLayer()) { 3258 if (!CurrentlyScrollingLayer()) {
3249 scroll_status.thread = SCROLL_IGNORED; 3259 scroll_status.thread = SCROLL_IGNORED;
3250 scroll_status.main_thread_scrolling_reasons = 3260 scroll_status.main_thread_scrolling_reasons =
3251 MainThreadScrollingReason::kNoScrollingLayer; 3261 MainThreadScrollingReason::kNoScrollingLayer;
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 return task_runner_provider_->HasImplThread(); 4049 return task_runner_provider_->HasImplThread();
4040 } 4050 }
4041 4051
4042 bool LayerTreeHostImpl::CommitToActiveTree() const { 4052 bool LayerTreeHostImpl::CommitToActiveTree() const {
4043 // In single threaded mode we skip the pending tree and commit directly to the 4053 // In single threaded mode we skip the pending tree and commit directly to the
4044 // active tree. 4054 // active tree.
4045 return !task_runner_provider_->HasImplThread(); 4055 return !task_runner_provider_->HasImplThread();
4046 } 4056 }
4047 4057
4048 } // namespace cc 4058 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698