| Index: content/renderer/gpu/input_handler_proxy.cc
|
| diff --git a/content/renderer/gpu/input_handler_proxy.cc b/content/renderer/gpu/input_handler_proxy.cc
|
| index 24c541c92fe1ba546125ecd4d74217fc4b59a6ff..744462380e2ba792b50e74ebcd22060d3f9e7f17 100644
|
| --- a/content/renderer/gpu/input_handler_proxy.cc
|
| +++ b/content/renderer/gpu/input_handler_proxy.cc
|
| @@ -46,28 +46,19 @@ void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) {
|
| client_ = client;
|
| }
|
|
|
| -void InputHandlerProxy::HandleInputEvent(const WebInputEvent& event) {
|
| +InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
|
| + const WebInputEvent& event) {
|
| DCHECK(client_);
|
| DCHECK(input_handler_);
|
|
|
| InputHandlerProxy::EventDisposition disposition =
|
| HandleInputEventInternal(event);
|
| - switch (disposition) {
|
| - case DidHandle:
|
| - client_->DidHandleInputEvent();
|
| - break;
|
| - case DidNotHandle:
|
| - client_->DidNotHandleInputEvent(true /* send_to_widget */);
|
| - break;
|
| - case DropEvent:
|
| - client_->DidNotHandleInputEvent(false /* send_to_widget */);
|
| - break;
|
| - }
|
| if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) {
|
| input_handler_->DidReceiveLastInputEventForBeginFrame(
|
| base::TimeTicks::FromInternalValue(event.timeStampSeconds *
|
| base::Time::kMicrosecondsPerSecond));
|
| }
|
| + return disposition;
|
| }
|
|
|
| InputHandlerProxy::EventDisposition
|
| @@ -78,7 +69,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| if (wheel_event.scrollByPage) {
|
| // TODO(jamesr): We don't properly handle scroll by page in the compositor
|
| // thread, so punt it to the main thread. http://crbug.com/236639
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
| cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin(
|
| gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::Wheel);
|
| @@ -96,16 +87,18 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| gfx::Point(wheel_event.x, wheel_event.y),
|
| gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY));
|
| input_handler_->ScrollEnd();
|
| - return did_scroll ? DidHandle : DropEvent;
|
| + return did_scroll ? EVENT_DISPOSITION_DID_HANDLE
|
| + : EVENT_DISPOSITION_DROP_EVENT;
|
| }
|
| case cc::InputHandler::ScrollIgnored:
|
| - // TODO(jamesr): This should be DropEvent, but in cases where we fail to
|
| - // properly sync scrollability it's safer to send the
|
| - // event to the main thread. Change back to DropEvent once we have
|
| - // synchronization bugs sorted out.
|
| - return DidNotHandle;
|
| + // TODO(jamesr): This should be EVENT_DISPOSITION_DROP_EVENT, but in
|
| + // cases where we fail to properly sync scrollability it's safer to send
|
| + // the event to the main thread. Change back to
|
| + // EVENT_DISPOSITION_DROP_EVENT once we have synchronization bugs sorted
|
| + // out.
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| case cc::InputHandler::ScrollOnMainThread:
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
| } else if (event.type == WebInputEvent::GestureScrollBegin) {
|
| DCHECK(!gesture_scroll_on_impl_thread_);
|
| @@ -121,11 +114,11 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| switch (scroll_status) {
|
| case cc::InputHandler::ScrollStarted:
|
| gesture_scroll_on_impl_thread_ = true;
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| case cc::InputHandler::ScrollOnMainThread:
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| case cc::InputHandler::ScrollIgnored:
|
| - return DropEvent;
|
| + return EVENT_DISPOSITION_DROP_EVENT;
|
| }
|
| } else if (event.type == WebInputEvent::GestureScrollUpdate) {
|
| #ifndef NDEBUG
|
| @@ -133,7 +126,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| #endif
|
|
|
| if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_)
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
|
|
| const WebGestureEvent& gesture_event =
|
| *static_cast<const WebGestureEvent*>(&event);
|
| @@ -141,18 +134,19 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| gfx::Point(gesture_event.x, gesture_event.y),
|
| gfx::Vector2dF(-gesture_event.data.scrollUpdate.deltaX,
|
| -gesture_event.data.scrollUpdate.deltaY));
|
| - return did_scroll ? DidHandle : DropEvent;
|
| + return did_scroll ? EVENT_DISPOSITION_DID_HANDLE
|
| + : EVENT_DISPOSITION_DROP_EVENT;
|
| } else if (event.type == WebInputEvent::GestureScrollEnd) {
|
| #ifndef NDEBUG
|
| DCHECK(expect_scroll_update_end_);
|
| expect_scroll_update_end_ = false;
|
| #endif
|
| if (!gesture_scroll_on_impl_thread_)
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
|
|
| input_handler_->ScrollEnd();
|
| gesture_scroll_on_impl_thread_ = false;
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| } else if (event.type == WebInputEvent::GesturePinchBegin) {
|
| #ifndef NDEBUG
|
| DCHECK(!expect_pinch_update_end_);
|
| @@ -160,7 +154,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| #endif
|
| input_handler_->PinchGestureBegin();
|
| gesture_pinch_on_impl_thread_ = true;
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| } else if (event.type == WebInputEvent::GesturePinchEnd) {
|
| #ifndef NDEBUG
|
| DCHECK(expect_pinch_update_end_);
|
| @@ -168,7 +162,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| #endif
|
| gesture_pinch_on_impl_thread_ = false;
|
| input_handler_->PinchGestureEnd();
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| } else if (event.type == WebInputEvent::GesturePinchUpdate) {
|
| #ifndef NDEBUG
|
| DCHECK(expect_pinch_update_end_);
|
| @@ -178,27 +172,27 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
|
| input_handler_->PinchGestureUpdate(
|
| gesture_event.data.pinchUpdate.scale,
|
| gfx::Point(gesture_event.x, gesture_event.y));
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| } else if (event.type == WebInputEvent::GestureFlingStart) {
|
| const WebGestureEvent& gesture_event =
|
| *static_cast<const WebGestureEvent*>(&event);
|
| return HandleGestureFling(gesture_event);
|
| } else if (event.type == WebInputEvent::GestureFlingCancel) {
|
| if (CancelCurrentFling())
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| else if (!fling_may_be_active_on_main_thread_)
|
| - return DropEvent;
|
| + return EVENT_DISPOSITION_DROP_EVENT;
|
| } else if (event.type == WebInputEvent::TouchStart) {
|
| const WebTouchEvent& touch_event =
|
| *static_cast<const WebTouchEvent*>(&event);
|
| if (!input_handler_->HaveTouchEventHandlersAt(touch_event.touches[0]
|
| .position))
|
| - return DropEvent;
|
| + return EVENT_DISPOSITION_DROP_EVENT;
|
| } else if (WebInputEvent::isKeyboardEventType(event.type)) {
|
| CancelCurrentFling();
|
| }
|
|
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
|
|
| InputHandlerProxy::EventDisposition
|
| @@ -244,7 +238,7 @@ InputHandlerProxy::HandleGestureFling(
|
| fling_parameters_.modifiers = gesture_event.modifiers;
|
| fling_parameters_.sourceDevice = gesture_event.sourceDevice;
|
| input_handler_->ScheduleAnimation();
|
| - return DidHandle;
|
| + return EVENT_DISPOSITION_DID_HANDLE;
|
| }
|
| case cc::InputHandler::ScrollOnMainThread: {
|
| TRACE_EVENT_INSTANT0("renderer",
|
| @@ -252,7 +246,7 @@ InputHandlerProxy::HandleGestureFling(
|
| "scroll_on_main_thread",
|
| TRACE_EVENT_SCOPE_THREAD);
|
| fling_may_be_active_on_main_thread_ = true;
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
| case cc::InputHandler::ScrollIgnored: {
|
| TRACE_EVENT_INSTANT0(
|
| @@ -263,12 +257,12 @@ InputHandlerProxy::HandleGestureFling(
|
| // We still pass the curve to the main thread if there's nothing
|
| // scrollable, in case something
|
| // registers a handler before the curve is over.
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
| - return DropEvent;
|
| + return EVENT_DISPOSITION_DROP_EVENT;
|
| }
|
| }
|
| - return DidNotHandle;
|
| + return EVENT_DISPOSITION_DID_NOT_HANDLE;
|
| }
|
|
|
| void InputHandlerProxy::Animate(base::TimeTicks time) {
|
| @@ -341,20 +335,21 @@ bool InputHandlerProxy::TouchpadFlingScroll(
|
| InputHandlerProxy::EventDisposition disposition =
|
| HandleInputEventInternal(synthetic_wheel);
|
| switch (disposition) {
|
| - case DidHandle:
|
| + case EVENT_DISPOSITION_DID_HANDLE:
|
| return true;
|
| - case DropEvent:
|
| + case EVENT_DISPOSITION_DROP_EVENT:
|
| break;
|
| - case DidNotHandle:
|
| + case EVENT_DISPOSITION_DID_NOT_HANDLE:
|
| TRACE_EVENT_INSTANT0("renderer",
|
| "InputHandlerProxy::scrollBy::AbortFling",
|
| TRACE_EVENT_SCOPE_THREAD);
|
| - // If we got a DidNotHandle, that means we need to deliver wheels on the
|
| - // main thread. In this case we need to schedule a commit and transfer the
|
| - // fling curve over to the main thread and run the rest of the wheels from
|
| - // there. This can happen when flinging a page that contains a scrollable
|
| - // subarea that we can't scroll on the thread if the fling starts outside
|
| - // the subarea but then is flung "under" the pointer.
|
| + // If we got a EVENT_DISPOSITION_DID_NOT_HANDLE, that means we need to
|
| + // deliver wheels on the main thread. In this case we need to schedule a
|
| + // commit and transfer the fling curve over to the main thread and run the
|
| + // rest of the wheels from there. This can happen when flinging a page
|
| + // that contains a scrollable subarea that we can't scroll on the thread
|
| + // if the fling starts outside the subarea but then is flung "under" the
|
| + // pointer.
|
| client_->TransferActiveWheelFlingAnimation(fling_parameters_);
|
| fling_may_be_active_on_main_thread_ = true;
|
| CancelCurrentFling();
|
|
|