Bug 1743329 - Handle ESC key to release pointer lock in parent process; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D211621
This commit is contained in:
@@ -8682,15 +8682,19 @@ void PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch(
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<Document> pointerLockedDoc = PointerLockManager::GetLockedDocument();
|
||||
if (!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed && pointerLockedDoc) {
|
||||
// XXX See above comment to understand the reason why this needs
|
||||
// to claim that the Escape key event is consumed by content
|
||||
// even though it will be dispatched only into chrome.
|
||||
aKeyboardEvent->PreventDefaultBeforeDispatch(CrossProcessForwarding::eStop);
|
||||
aKeyboardEvent->mFlags.mOnlyChromeDispatch = true;
|
||||
if (aKeyboardEvent->mMessage == eKeyUp) {
|
||||
PointerLockManager::Unlock();
|
||||
if (XRE_IsParentProcess() &&
|
||||
!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed) {
|
||||
if (PointerLockManager::GetLockedRemoteTarget() ||
|
||||
PointerLockManager::IsLocked()) {
|
||||
// XXX See above comment to understand the reason why this needs
|
||||
// to claim that the Escape key event is consumed by content
|
||||
// even though it will be dispatched only into chrome.
|
||||
aKeyboardEvent->PreventDefaultBeforeDispatch(
|
||||
CrossProcessForwarding::eStop);
|
||||
aKeyboardEvent->mFlags.mOnlyChromeDispatch = true;
|
||||
if (aKeyboardEvent->mMessage == eKeyUp) {
|
||||
PointerLockManager::Unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user