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

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

Issue 1631963002: Plumb firing passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners_2a
Patch Set: Set dependency correctly Created 4 years, 11 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 dff25a6404e5c2457dd350b1234eb36231470f28..b38b484afaca3a6d865dc3c0f6a09c6436337405 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()),
+ scroll_on_mouse_wheel_(false) {
DCHECK(client);
input_handler_->BindToClient(this);
cc::ScrollElasticityHelper* scroll_elasticity_helper =
@@ -288,8 +289,9 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
const WebGestureEvent& gesture_event =
static_cast<const WebGestureEvent&>(event);
if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad &&
- input_handler_->HaveWheelEventHandlersAt(
- gfx::Point(gesture_event.x, gesture_event.y))) {
+ input_handler_->EffectiveWheelEventListenerPropertiesAt(
+ gfx::Point(gesture_event.x, gesture_event.y)) !=
+ cc::EventListenerProperties::kNone) {
return DID_NOT_HANDLE;
} else {
input_handler_->PinchGestureBegin();
@@ -336,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);
@@ -419,6 +424,15 @@ bool InputHandlerProxy::ShouldAnimate(
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
const WebMouseWheelEvent& wheel_event) {
+ if (!scroll_on_mouse_wheel_) {
+ if (input_handler_->EffectiveWheelEventListenerPropertiesAt(
+ gfx::Point(wheel_event.x, wheel_event.y)) ==
+ cc::EventListenerProperties::kPassive) {
+ return NON_BLOCKING;
+ }
+ return DID_NOT_HANDLE;
+ }
+
InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE;
cc::InputHandlerScrollResult scroll_result;
@@ -720,18 +734,39 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart(
const blink::WebTouchEvent& touch_event) {
- for (size_t i = 0; i < touch_event.touchesLength; ++i) {
+ uint32_t properties = cc::EventListenerProperties::kNone;
+ for (size_t i = 0; i < touch_event.touchesLength &&
+ properties != cc::EventListenerProperties::kMax;
+ ++i) {
if (touch_event.touches[i].state != WebTouchPoint::StatePressed)
continue;
- 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;
- }
+
+ properties |= input_handler_->EffectiveTouchEventListenerPropertiesAt(
+ gfx::Point(touch_event.touches[i].position.x,
+ touch_event.touches[i].position.y));
+ }
+
+ if (properties == cc::EventListenerProperties::kPassive) {
+ return NON_BLOCKING;
+ }
+ return DID_NOT_HANDLE;
+}
+
+InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove(
+ const blink::WebTouchEvent& touch_event) {
+ uint32_t properties = cc::EventListenerProperties::kNone;
+ for (size_t i = 0; i < touch_event.touchesLength &&
+ properties != cc::EventListenerProperties::kMax;
+ ++i) {
+ properties |= input_handler_->EffectiveTouchEventListenerPropertiesAt(
+ gfx::Point(touch_event.touches[i].position.x,
+ touch_event.touches[i].position.y));
}
- return DROP_EVENT;
+
+ if (properties == cc::EventListenerProperties::kPassive) {
+ return NON_BLOCKING;
+ }
+ return DID_NOT_HANDLE;
}
bool InputHandlerProxy::FilterInputEventForFlingBoosting(
@@ -1093,6 +1128,10 @@ bool InputHandlerProxy::TouchpadFlingScroll(
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",

Powered by Google App Engine
This is Rietveld 408576698