mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #2019 - Do not dispatch keypress event for non-printable keys.
This will prevent the keypress DOM event from firing on keypresses that do not produce printable keys (e.g. editing nav keys) in content. This should not affect any chrome events that are in use. Event dispatch can be re-enabled if necessary with the added pref.
This commit is contained in:
parent
2f0896ab31
commit
1392f5f223
6 changed files with 48 additions and 15 deletions
|
|
@ -21,6 +21,7 @@ namespace widget {
|
|||
*****************************************************************************/
|
||||
|
||||
bool TextEventDispatcher::sDispatchKeyEventsDuringComposition = false;
|
||||
bool TextEventDispatcher::sDispatchKeyPressEventNonPrintableInContent = false;
|
||||
|
||||
TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
|
||||
: mWidget(aWidget)
|
||||
|
|
@ -36,6 +37,10 @@ TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
|
|||
&sDispatchKeyEventsDuringComposition,
|
||||
"dom.keyboardevent.dispatch_during_composition",
|
||||
false);
|
||||
Preferences::AddBoolVarCache(
|
||||
&sDispatchKeyPressEventNonPrintableInContent,
|
||||
"dom.keyboardevent.keypress.dispatch_non_printable_in_content",
|
||||
false);
|
||||
sInitialized = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -531,6 +536,13 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
|
|||
}
|
||||
}
|
||||
|
||||
if (!sDispatchKeyPressEventNonPrintableInContent &&
|
||||
keyEvent.mMessage == eKeyPress &&
|
||||
!keyEvent.IsInputtingText() &&
|
||||
!keyEvent.IsInputtingLineBreak()) {
|
||||
keyEvent.mFlags.mOnlySystemGroupDispatchInContent = true;
|
||||
}
|
||||
|
||||
DispatchInputEvent(mWidget, keyEvent, aStatus);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue