Chromium Code Reviews| 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 cecf7df0c2f157963876234ebb086176ad7efd08..5be9bf4f48b25c6d17e8026ad1151d52dcdd79ed 100644 |
| --- a/ui/events/blink/input_handler_proxy.cc |
| +++ b/ui/events/blink/input_handler_proxy.cc |
| @@ -221,7 +221,8 @@ InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, |
| disallow_vertical_fling_scroll_(false), |
| has_fling_animation_started_(false), |
| smooth_scroll_enabled_(false), |
| - uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()) { |
| + uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), |
| + gesture_events_for_mouse_wheel_(true) { |
| DCHECK(client); |
| input_handler_->BindToClient(this); |
| cc::ScrollElasticityHelper* scroll_elasticity_helper = |
| @@ -337,6 +338,9 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent( |
| case WebInputEvent::TouchStart: |
| return HandleTouchStart(static_cast<const WebTouchEvent&>(event)); |
| + case WebInputEvent::TouchMove: |
| + return HandleTouchMove(static_cast<const WebTouchEvent&>(event)); |
| + |
| case WebInputEvent::MouseMove: { |
| const WebMouseEvent& mouse_event = |
| static_cast<const WebMouseEvent&>(event); |
| @@ -420,6 +424,27 @@ bool InputHandlerProxy::ShouldAnimate( |
| InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
| const WebMouseWheelEvent& wheel_event) { |
| + if (gesture_events_for_mouse_wheel_) { |
| + cc::EventListenerProperties properties = |
| + input_handler_->GetEventListenerProperties( |
| + cc::EventListenerClass::kMouseWheel); |
| + switch (properties) { |
| + case cc::EventListenerProperties::kPassive: |
| + return NON_BLOCKING; |
| + case cc::EventListenerProperties::kBlocking: |
| + return DID_NOT_HANDLE; |
| + case cc::EventListenerProperties::kNone: |
| + return DROP_EVENT; |
| + default: |
| + NOTREACHED(); |
| + return DROP_EVENT; |
| + } |
| + } |
| + return ScrollByMouseWheel(wheel_event); |
| +} |
| + |
| +InputHandlerProxy::EventDisposition InputHandlerProxy::ScrollByMouseWheel( |
| + const WebMouseWheelEvent& wheel_event) { |
| InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; |
| cc::InputHandlerScrollResult scroll_result; |
| @@ -726,12 +751,46 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( |
| if (input_handler_->DoTouchEventsBlockScrollAt( |
| gfx::Point(touch_event.touches[i].position.x, |
| touch_event.touches[i].position.y))) { |
| - // TODO(rbyers): We should consider still sending the touch events to |
| - // main asynchronously (crbug.com/455539). |
| return DID_NOT_HANDLE; |
| } |
| } |
| - return DROP_EVENT; |
| + |
| + switch (input_handler_->GetEventListenerProperties( |
| + cc::EventListenerClass::kTouch)) { |
| + case cc::EventListenerProperties::kPassive: |
| + return NON_BLOCKING; |
| + case cc::EventListenerProperties::kBlocking: |
| + return DID_NOT_HANDLE; |
| + case cc::EventListenerProperties::kNone: |
| + return DROP_EVENT; |
| + default: |
| + NOTREACHED(); |
| + return DROP_EVENT; |
| + } |
| +} |
| + |
| +InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( |
| + const blink::WebTouchEvent& touch_event) { |
| + for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
| + if (input_handler_->DoTouchEventsBlockScrollAt( |
|
tdresser
2016/02/09 22:00:14
Does this correctly respect the implicit touch cap
dtapuska
2016/02/09 22:23:56
No it doesn't then.
|
| + gfx::Point(touch_event.touches[i].position.x, |
| + touch_event.touches[i].position.y))) { |
| + return DID_NOT_HANDLE; |
| + } |
| + } |
| + |
| + switch (input_handler_->GetEventListenerProperties( |
| + cc::EventListenerClass::kTouch)) { |
| + case cc::EventListenerProperties::kPassive: |
|
tdresser
2016/02/09 22:00:13
Would it be worth adding a helper method that maps
dtapuska
2016/02/09 22:23:56
Touch has special casing around kBlockingAndPassiv
|
| + return NON_BLOCKING; |
| + case cc::EventListenerProperties::kBlocking: |
| + return DID_NOT_HANDLE; |
| + case cc::EventListenerProperties::kNone: |
| + return DROP_EVENT; |
| + default: |
| + NOTREACHED(); |
| + return DROP_EVENT; |
| + } |
| } |
| bool InputHandlerProxy::FilterInputEventForFlingBoosting( |
| @@ -1075,25 +1134,47 @@ void InputHandlerProxy::RequestAnimation() { |
| bool InputHandlerProxy::TouchpadFlingScroll( |
| const WebFloatSize& increment) { |
| - WebMouseWheelEvent synthetic_wheel; |
| - synthetic_wheel.type = WebInputEvent::MouseWheel; |
| - synthetic_wheel.timeStampSeconds = InSecondsF(base::TimeTicks::Now()); |
| - synthetic_wheel.deltaX = increment.width; |
| - synthetic_wheel.deltaY = increment.height; |
| - synthetic_wheel.hasPreciseScrollingDeltas = true; |
| - synthetic_wheel.x = fling_parameters_.point.x; |
| - synthetic_wheel.y = fling_parameters_.point.y; |
| - synthetic_wheel.globalX = fling_parameters_.globalPoint.x; |
| - synthetic_wheel.globalY = fling_parameters_.globalPoint.y; |
| - synthetic_wheel.modifiers = fling_parameters_.modifiers; |
| - |
| - InputHandlerProxy::EventDisposition disposition = |
| - HandleInputEvent(synthetic_wheel); |
| + InputHandlerProxy::EventDisposition disposition; |
| + cc::EventListenerProperties properties = |
| + input_handler_->GetEventListenerProperties( |
| + cc::EventListenerClass::kMouseWheel); |
| + switch (properties) { |
| + case cc::EventListenerProperties::kPassive: |
| + disposition = NON_BLOCKING; |
| + break; |
| + case cc::EventListenerProperties::kBlocking: |
| + disposition = DID_NOT_HANDLE; |
| + break; |
| + case cc::EventListenerProperties::kNone: { |
| + WebMouseWheelEvent synthetic_wheel; |
| + synthetic_wheel.type = WebInputEvent::MouseWheel; |
| + synthetic_wheel.timeStampSeconds = InSecondsF(base::TimeTicks::Now()); |
| + synthetic_wheel.deltaX = increment.width; |
| + synthetic_wheel.deltaY = increment.height; |
| + synthetic_wheel.hasPreciseScrollingDeltas = true; |
| + synthetic_wheel.x = fling_parameters_.point.x; |
| + synthetic_wheel.y = fling_parameters_.point.y; |
| + synthetic_wheel.globalX = fling_parameters_.globalPoint.x; |
| + synthetic_wheel.globalY = fling_parameters_.globalPoint.y; |
| + synthetic_wheel.modifiers = fling_parameters_.modifiers; |
| + |
| + disposition = ScrollByMouseWheel(synthetic_wheel); |
| + break; |
| + } |
| + default: |
| + NOTREACHED(); |
| + return false; |
| + } |
| + |
| switch (disposition) { |
| case DID_HANDLE: |
| return true; |
| case DROP_EVENT: |
| break; |
| + case NON_BLOCKING: |
| + // TODO(dtapuska): Process the fling on the compositor thread |
| + // but post the events to the main thread; for now just pass it to the |
| + // main thread. |
| case DID_NOT_HANDLE: |
| TRACE_EVENT_INSTANT0("input", |
| "InputHandlerProxy::scrollBy::AbortFling", |