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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2807433003: No pointer captured when the pointer lock is applied (Closed)
Patch Set: pointer lock Created 3 years, 7 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: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 32bfe0a1f7bd6404309540f6d3822ce589191ca1..bcc01a642945e63c904b64d838dbec8645db202e 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2190,6 +2190,19 @@ WebInputEventResult WebViewImpl::HandleInputEvent(
if (is_pointer_locked &&
WebInputEvent::IsMouseEventType(input_event.GetType())) {
+ LocalFrame* focusedFrame = FocusedLocalFrameInWidget();
+ if (focusedFrame) {
+ WebMouseEvent transformed_event = TransformWebMouseEvent(
+ MainFrameImpl()->GetFrameView(),
+ static_cast<const WebMouseEvent&>(input_event));
+ Vector<WebMouseEvent> transformed_coalesced_events =
+ TransformWebMouseEventVector(
+ MainFrameImpl()->GetFrameView(),
+ coalesced_event.GetCoalescedEventsPointers());
+ focusedFrame->GetEventHandler().ProcessPendingPointerCapture(
+ transformed_event, transformed_coalesced_events);
+ }
+
MainFrameImpl()->FrameWidget()->PointerLockMouseEvent(input_event);
mustaq 2017/05/19 20:05:33 I believe we need a similar fix before another dir
lanwei 2017/05/23 23:11:42 You are right, I moved the code to the WebFrameWid
return WebInputEventResult::kHandledSystem;
}
@@ -2559,6 +2572,10 @@ void WebViewImpl::WillCloseLayerTreeView() {
void WebViewImpl::DidAcquirePointerLock() {
if (MainFrameImpl())
MainFrameImpl()->FrameWidget()->DidAcquirePointerLock();
+
+ LocalFrame* focusedFrame = FocusedLocalFrameInWidget();
+ if (focusedFrame)
+ focusedFrame->GetEventHandler().ReleaseMousePointerCapture();
}
void WebViewImpl::DidNotAcquirePointerLock() {

Powered by Google App Engine
This is Rietveld 408576698