mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 694204 - Prevent default action on ESC key press to exit full-screen mode, prevents <video> loads being cancelled on full-screen exit. r=smaug
This commit is contained in:
parent
427807cc7c
commit
9c5634653e
@ -43,7 +43,7 @@ var keyList = [
|
|||||||
{ code: "VK_FINAL", allowed: false},
|
{ code: "VK_FINAL", allowed: false},
|
||||||
{ code: "VK_HANJA", allowed: false},
|
{ code: "VK_HANJA", allowed: false},
|
||||||
{ code: "VK_KANJI", allowed: false},
|
{ code: "VK_KANJI", allowed: false},
|
||||||
{ code: "VK_ESCAPE", allowed: false},
|
{ code: "VK_ESCAPE", allowed: false, suppressed: true},
|
||||||
{ code: "VK_CONVERT", allowed: false},
|
{ code: "VK_CONVERT", allowed: false},
|
||||||
{ code: "VK_NONCONVERT", allowed: false},
|
{ code: "VK_NONCONVERT", allowed: false},
|
||||||
{ code: "VK_ACCEPT", allowed: false},
|
{ code: "VK_ACCEPT", allowed: false},
|
||||||
@ -176,14 +176,16 @@ var gKeyTestIndex = 0;
|
|||||||
var gKeyName;
|
var gKeyName;
|
||||||
var gKeyCode;
|
var gKeyCode;
|
||||||
var gKeyAllowed;
|
var gKeyAllowed;
|
||||||
|
var gKeySuppressed;
|
||||||
var gKeyReceived = false;
|
var gKeyReceived = false;
|
||||||
|
|
||||||
function keyHandler(event) {
|
function keyHandler(event) {
|
||||||
event.preventDefault()
|
event.preventDefault();
|
||||||
gKeyReceived = true;
|
gKeyReceived = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkKeyEffect() {
|
function checkKeyEffect() {
|
||||||
|
is(gKeySuppressed, !gKeyReceived, "Should not receive suppressed key events");
|
||||||
is(document.mozFullScreen, gKeyAllowed,
|
is(document.mozFullScreen, gKeyAllowed,
|
||||||
(gKeyAllowed ? ("Should remain in full-screen mode for allowed key press " + gKeyName)
|
(gKeyAllowed ? ("Should remain in full-screen mode for allowed key press " + gKeyName)
|
||||||
: ("Should drop out of full-screen mode for restricted key press " + gKeyName)));
|
: ("Should drop out of full-screen mode for restricted key press " + gKeyName)));
|
||||||
@ -239,6 +241,8 @@ function testNextKey() {
|
|||||||
gKeyName = keyList[gKeyTestIndex].code;
|
gKeyName = keyList[gKeyTestIndex].code;
|
||||||
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
||||||
gKeyAllowed = keyList[gKeyTestIndex].allowed;
|
gKeyAllowed = keyList[gKeyTestIndex].allowed;
|
||||||
|
gKeySuppressed = (keyList[gKeyTestIndex].suppressed != undefined) ?
|
||||||
|
keyList[gKeyTestIndex].suppressed : false;
|
||||||
gKeyTestIndex++;
|
gKeyTestIndex++;
|
||||||
|
|
||||||
testScriptInitiatedKeyEvents();
|
testScriptInitiatedKeyEvents();
|
||||||
|
@ -6344,17 +6344,30 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
|
|||||||
switch (aEvent->message) {
|
switch (aEvent->message) {
|
||||||
case NS_KEY_PRESS:
|
case NS_KEY_PRESS:
|
||||||
case NS_KEY_DOWN:
|
case NS_KEY_DOWN:
|
||||||
case NS_KEY_UP:
|
case NS_KEY_UP: {
|
||||||
if (IsFullScreenAndRestrictedKeyEvent(mCurrentEventContent, aEvent) &&
|
if (IsFullScreenAndRestrictedKeyEvent(mCurrentEventContent, aEvent) &&
|
||||||
aEvent->message == NS_KEY_DOWN) {
|
aEvent->message == NS_KEY_UP) {
|
||||||
// We're in DOM full-screen mode, and a key with a restricted key
|
// We're in DOM full-screen mode, and a key with a restricted key
|
||||||
// code has been pressed. Exit full-screen mode.
|
// code has been pressed. Exit full-screen mode.
|
||||||
NS_DispatchToCurrentThread(
|
NS_DispatchToCurrentThread(
|
||||||
NS_NewRunnableMethod(mCurrentEventContent->OwnerDoc(),
|
NS_NewRunnableMethod(mCurrentEventContent->OwnerDoc(),
|
||||||
&nsIDocument::CancelFullScreen));
|
&nsIDocument::CancelFullScreen));
|
||||||
}
|
}
|
||||||
|
nsIDocument *doc = mCurrentEventContent ?
|
||||||
|
mCurrentEventContent->OwnerDoc() : nsnull;
|
||||||
|
if (doc &&
|
||||||
|
doc->IsFullScreenDoc() &&
|
||||||
|
static_cast<const nsKeyEvent*>(aEvent)->keyCode == NS_VK_ESCAPE) {
|
||||||
|
// Prevent default action on ESC key press when exiting
|
||||||
|
// DOM full-screen mode. This prevents the browser ESC key
|
||||||
|
// handler from stopping all loads in the document, which
|
||||||
|
// would cause <video> loads to stop.
|
||||||
|
aEvent->flags |= (NS_EVENT_FLAG_NO_DEFAULT |
|
||||||
|
NS_EVENT_FLAG_ONLY_CHROME_DISPATCH);
|
||||||
|
}
|
||||||
// Else not full-screen mode or key code is unrestricted, fall
|
// Else not full-screen mode or key code is unrestricted, fall
|
||||||
// through to normal handling.
|
// through to normal handling.
|
||||||
|
}
|
||||||
case NS_MOUSE_BUTTON_DOWN:
|
case NS_MOUSE_BUTTON_DOWN:
|
||||||
case NS_MOUSE_BUTTON_UP:
|
case NS_MOUSE_BUTTON_UP:
|
||||||
isHandlingUserInput = true;
|
isHandlingUserInput = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user