Commit 5dfb8241 authored by Amruth Raj's avatar Amruth Raj Committed by Commit Bot

Do not send pointer events tagged with kRelativeMotionEvent to the DOM

Sometimes, the Browser process tags events with kRelativeMotionEvent.
For e.g. during pointer lock, it recenters cursor by warping so that
cursor does not hit the screen boundary. In such a case the renderer
is only supposed to update it's co-ordinates and not send these fake
events to the DOM.

This patch correctly suppresses pointerrawupdate events tagged with
kRelativeMotionEvent from getting forwarded to the DOM.

Bug: 1066544
Bug: 868660
Change-Id: Ib0a7337e3535a9719182bb1153038af11b6e9742
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217928Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarElla Ge <eirage@chromium.org>
Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772953}
parent 911e448d
......@@ -571,6 +571,17 @@ WebInputEventResult PointerEventManager::HandlePointerEvent(
PointerEvent* pointer_event =
pointer_event_factory_.Create(event, coalesced_events, predicted_events,
frame_->GetDocument()->domWindow());
// Sometimes the Browser process tags events with kRelativeMotionEvent.
// For e.g. during pointer lock, it recenters cursor by warping so that
// cursor does not hit the screen boundary.
// Those fake events should not be forwarded to the DOM.
// The conditional return here is deliberately placed after the Create()
// call above because of some side-effects of Create() is still needed
// (in particular SetLastPosition(), see crbug.com/1066544)
if (event.GetModifiers() & WebInputEvent::Modifiers::kRelativeMotionEvent)
return WebInputEventResult::kHandledSuppressed;
DispatchPointerEvent(target, pointer_event);
return WebInputEventResult::kHandledSystem;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment