Loading layout/base/PresShell.cpp +24 −6 Original line number Diff line number Diff line Loading @@ -8463,14 +8463,32 @@ void PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch( // The event listeners in chrome can prevent this ESC behavior by // calling prevent default on the preceding keydown/press events. if (!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed && aKeyboardEvent->mMessage == eKeyUp) { if (aKeyboardEvent->mMessage == eKeyUp) { bool shouldExitFullscreen = !mPresShell->mIsLastChromeOnlyEscapeKeyConsumed; if (!shouldExitFullscreen) { if (mPresShell->mLastConsumedEscapeKeyUpForFullscreen && (aKeyboardEvent->mTimeStamp - mPresShell->mLastConsumedEscapeKeyUpForFullscreen) <= TimeDuration::FromMilliseconds( StaticPrefs:: dom_fullscreen_force_exit_on_multiple_escape_interval())) { shouldExitFullscreen = true; mPresShell->mLastConsumedEscapeKeyUpForFullscreen = TimeStamp(); } else { mPresShell->mLastConsumedEscapeKeyUpForFullscreen = aKeyboardEvent->mTimeStamp; } } if (shouldExitFullscreen) { // ESC key released while in DOM fullscreen mode. // Fully exit all browser windows and documents from // fullscreen mode. Document::AsyncExitFullscreen(nullptr); } } } if (XRE_IsParentProcess() && !mPresShell->mIsLastChromeOnlyEscapeKeyConsumed) { Loading layout/base/PresShell.h +4 −0 Original line number Diff line number Diff line Loading @@ -3209,6 +3209,10 @@ class PresShell final : public nsStubDocumentObserver, bool mProcessingReflowCommands : 1; bool mPendingDidDoReflow : 1; // The last TimeStamp when the keyup event did not exit fullscreen because it // was consumed. TimeStamp mLastConsumedEscapeKeyUpForFullscreen; struct CapturingContentInfo final { CapturingContentInfo() : mRemoteTarget(nullptr), Loading modules/libpref/init/StaticPrefList.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -2701,6 +2701,13 @@ value: false mirror: always # The interval in milliseconds between two Escape key events where the second # key event will exit fullscreen, even if it is consumed. - name: dom.fullscreen.force_exit_on_multiple_escape_interval type: uint32_t value: 500 mirror: always # Whether fullscreen should make the rest of the document inert. # This matches other browsers but historically not Gecko. - name: dom.fullscreen.modal Loading Loading
layout/base/PresShell.cpp +24 −6 Original line number Diff line number Diff line Loading @@ -8463,14 +8463,32 @@ void PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch( // The event listeners in chrome can prevent this ESC behavior by // calling prevent default on the preceding keydown/press events. if (!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed && aKeyboardEvent->mMessage == eKeyUp) { if (aKeyboardEvent->mMessage == eKeyUp) { bool shouldExitFullscreen = !mPresShell->mIsLastChromeOnlyEscapeKeyConsumed; if (!shouldExitFullscreen) { if (mPresShell->mLastConsumedEscapeKeyUpForFullscreen && (aKeyboardEvent->mTimeStamp - mPresShell->mLastConsumedEscapeKeyUpForFullscreen) <= TimeDuration::FromMilliseconds( StaticPrefs:: dom_fullscreen_force_exit_on_multiple_escape_interval())) { shouldExitFullscreen = true; mPresShell->mLastConsumedEscapeKeyUpForFullscreen = TimeStamp(); } else { mPresShell->mLastConsumedEscapeKeyUpForFullscreen = aKeyboardEvent->mTimeStamp; } } if (shouldExitFullscreen) { // ESC key released while in DOM fullscreen mode. // Fully exit all browser windows and documents from // fullscreen mode. Document::AsyncExitFullscreen(nullptr); } } } if (XRE_IsParentProcess() && !mPresShell->mIsLastChromeOnlyEscapeKeyConsumed) { Loading
layout/base/PresShell.h +4 −0 Original line number Diff line number Diff line Loading @@ -3209,6 +3209,10 @@ class PresShell final : public nsStubDocumentObserver, bool mProcessingReflowCommands : 1; bool mPendingDidDoReflow : 1; // The last TimeStamp when the keyup event did not exit fullscreen because it // was consumed. TimeStamp mLastConsumedEscapeKeyUpForFullscreen; struct CapturingContentInfo final { CapturingContentInfo() : mRemoteTarget(nullptr), Loading
modules/libpref/init/StaticPrefList.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -2701,6 +2701,13 @@ value: false mirror: always # The interval in milliseconds between two Escape key events where the second # key event will exit fullscreen, even if it is consumed. - name: dom.fullscreen.force_exit_on_multiple_escape_interval type: uint32_t value: 500 mirror: always # Whether fullscreen should make the rest of the document inert. # This matches other browsers but historically not Gecko. - name: dom.fullscreen.modal Loading