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

Unified Diff: ui/events/blink/input_handler_proxy.cc

Issue 1749343004: Implement Wheel Gesture Scrolling on OSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non mac builds Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/input_handler_proxy.cc
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 187c9ac85a13cb26f002f2224f96bb42a7fcd13d..0af2a0f76de61aa24fe886455cac05778c85fe09 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -620,20 +620,40 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
RecordMainThreadScrollingReasons(gesture_event.type,
scroll_status.main_thread_scrolling_reasons);
+ InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE;
switch (scroll_status.thread) {
case cc::InputHandler::SCROLL_ON_IMPL_THREAD:
TRACE_EVENT_INSTANT0("input",
"InputHandlerProxy::handle_input gesture scroll",
TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = true;
- return DID_HANDLE;
+ result = DID_HANDLE;
+ break;
case cc::InputHandler::SCROLL_UNKNOWN:
case cc::InputHandler::SCROLL_ON_MAIN_THREAD:
- return DID_NOT_HANDLE;
+ result = DID_NOT_HANDLE;
+ break;
case cc::InputHandler::SCROLL_IGNORED:
- return DROP_EVENT;
+ result = DROP_EVENT;
+ break;
}
- return DID_NOT_HANDLE;
+ // Send the event and its disposition to the elasticity controller to update
+ // the over-scroll animation. If the event is to be handled on the main
+ // thread, the event and its disposition will be sent to the elasticity
+ // controller after being handled on the main thread.
+ if (scroll_elasticity_controller_ && result != DID_NOT_HANDLE) {
+ // Note that the call to the elasticity controller is made asynchronously,
+ // to minimize divergence between main thread and impl thread event
+ // handling paths.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &InputScrollElasticityController::ObserveGestureEventAndResult,
+ scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
+ cc::InputHandlerScrollResult()));
+ }
+
+ return result;
}
InputHandlerProxy::EventDisposition
@@ -665,6 +685,21 @@ InputHandlerProxy::HandleGestureScrollUpdate(
cc::InputHandlerScrollResult scroll_result =
input_handler_->ScrollBy(&scroll_state);
HandleOverscroll(scroll_point, scroll_result);
+
+ // Send the event and its disposition to the elasticity controller to update
+ // the over-scroll animation.
+ if (scroll_elasticity_controller_) {
+ // Note that the call to the elasticity controller is made asynchronously,
+ // to minimize divergence between main thread and impl thread event
+ // handling paths.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
tdresser 2016/03/02 18:26:53 Can we share this logic with HandleGestureScrollBe
dtapuska 2016/03/07 18:03:59 Done.
+ FROM_HERE,
+ base::Bind(
+ &InputScrollElasticityController::ObserveGestureEventAndResult,
+ scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
+ scroll_result));
+ }
+
return scroll_result.did_scroll ? DID_HANDLE : DROP_EVENT;
}
@@ -678,6 +713,23 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollEnd(
input_handler_->ScrollEnd(&scroll_state);
if (!gesture_scroll_on_impl_thread_)
return DID_NOT_HANDLE;
+
+ // Send the event and its disposition to the elasticity controller to update
+ // the over-scroll animation. If the event is to be handled on the main
+ // thread, the event and its disposition will be sent to the elasticity
+ // controller after being handled on the main thread.
+ if (scroll_elasticity_controller_) {
+ // Note that the call to the elasticity controller is made asynchronously,
+ // to minimize divergence between main thread and impl thread event
+ // handling paths.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &InputScrollElasticityController::ObserveGestureEventAndResult,
+ scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
+ cc::InputHandlerScrollResult()));
+ }
+
gesture_scroll_on_impl_thread_ = false;
return DID_HANDLE;
}

Powered by Google App Engine
This is Rietveld 408576698