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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2486673008: Touchpad scroll latching enabled for Mac behind flag. (Closed)
Patch Set: nit fixed: assignment instead of condition Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/mouse_wheel_event_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index d33bc071c19154d554fab3271911b395dd7b9702..ec790e4c4ea01030f1aeae4cd6a02037502c4378 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2644,34 +2644,40 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
MainThreadScrollingReason::kNotScrollingOnMain;
TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
- ClearCurrentlyScrollingLayer();
+ LayerImpl* scrolling_layer_impl = nullptr;
+ bool scroll_on_main_thread = false;
- gfx::Point viewport_point(scroll_state->position_x(),
- scroll_state->position_y());
+ if (scroll_state->is_in_inertial_phase())
+ scrolling_layer_impl = CurrentlyScrollingLayer();
- gfx::PointF device_viewport_point = gfx::ScalePoint(
- gfx::PointF(viewport_point), active_tree_->device_scale_factor());
- LayerImpl* layer_impl =
- active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
+ if (!scrolling_layer_impl) {
+ ClearCurrentlyScrollingLayer();
- if (layer_impl) {
- LayerImpl* scroll_layer_impl =
- active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
- device_viewport_point);
- if (scroll_layer_impl &&
- !IsClosestScrollAncestor(layer_impl, scroll_layer_impl)) {
- scroll_status.thread = SCROLL_UNKNOWN;
- scroll_status.main_thread_scrolling_reasons =
- MainThreadScrollingReason::kFailedHitTest;
- return scroll_status;
- }
- }
+ gfx::Point viewport_point(scroll_state->position_x(),
+ scroll_state->position_y());
- bool scroll_on_main_thread = false;
- LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
- device_viewport_point, type, layer_impl, &scroll_on_main_thread,
- &scroll_status.main_thread_scrolling_reasons);
+ gfx::PointF device_viewport_point = gfx::ScalePoint(
+ gfx::PointF(viewport_point), active_tree_->device_scale_factor());
+ LayerImpl* layer_impl =
+ active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
+
+ if (layer_impl) {
+ LayerImpl* scroll_layer_impl =
+ active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
+ device_viewport_point);
+ if (scroll_layer_impl &&
+ !IsClosestScrollAncestor(layer_impl, scroll_layer_impl)) {
+ scroll_status.thread = SCROLL_UNKNOWN;
+ scroll_status.main_thread_scrolling_reasons =
+ MainThreadScrollingReason::kFailedHitTest;
+ return scroll_status;
+ }
+ }
+ scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
+ device_viewport_point, type, layer_impl, &scroll_on_main_thread,
+ &scroll_status.main_thread_scrolling_reasons);
+ }
if (scrolling_layer_impl)
scroll_affects_scroll_handler_ =
scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
@@ -2720,11 +2726,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimatedBegin(
ScrollStateData scroll_state_end_data;
scroll_state_end_data.is_ending = true;
ScrollState scroll_state_end(scroll_state_end_data);
- // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
- // implemented, the current scrolling layer should not get cleared after
- // each animation (crbug.com/526463).
ScrollEnd(&scroll_state_end);
- ClearCurrentlyScrollingLayer();
}
return scroll_status;
}
@@ -2811,7 +2813,6 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
ScrollStateData scroll_state_data;
scroll_state_data.position_x = viewport_point.x();
scroll_state_data.position_y = viewport_point.y();
- scroll_state_data.is_in_inertial_phase = true;
ScrollState scroll_state(scroll_state_data);
// ScrollAnimated is used for animated wheel scrolls. We find the first layer
« no previous file with comments | « no previous file | content/browser/renderer_host/input/mouse_wheel_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698