Bug 479942 When physical space key is pressed, we should guarantee that it works as ' ' input key with any keyboard layout at handling shortcut key or access key r=karlt

This commit is contained in:
Masayuki Nakano 2014-06-04 10:44:47 +09:00
parent 12c3bcae38
commit 4208a9ff5d

View File

@ -4639,6 +4639,16 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
aCandidates.AppendElement(key);
}
}
// Special case for "Space" key. With some keyboard layouts, "Space" with
// or without Shift key causes non-ASCII space. For such keyboard layouts,
// we should guarantee that the key press works as an ASCII white space key
// press.
if (nativeKeyEvent->mCodeNameIndex == CODE_NAME_INDEX_Space &&
nativeKeyEvent->charCode != static_cast<uint32_t>(' ')) {
nsShortcutCandidate spaceKey(static_cast<uint32_t>(' '), false);
aCandidates.AppendElement(spaceKey);
}
} else {
uint32_t charCode;
aDOMKeyEvent->GetCharCode(&charCode);
@ -4681,6 +4691,14 @@ nsContentUtils::GetAccessKeyCandidates(WidgetKeyboardEvent* aNativeKeyEvent,
aCandidates.AppendElement(ch[j]);
}
}
// Special case for "Space" key. With some keyboard layouts, "Space" with
// or without Shift key causes non-ASCII space. For such keyboard layouts,
// we should guarantee that the key press works as an ASCII white space key
// press.
if (aNativeKeyEvent->mCodeNameIndex == CODE_NAME_INDEX_Space &&
aNativeKeyEvent->charCode != static_cast<uint32_t>(' ')) {
aCandidates.AppendElement(static_cast<uint32_t>(' '));
}
return;
}