mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1254629 - Make onKeyEvent more efficient; r=esawin
When handling synthetic keys, don't remove existing compositions and don't check for certain early exit conditions.
This commit is contained in:
parent
3a2da8694f
commit
fc50ab814f
@ -2461,8 +2461,10 @@ nsWindow::GeckoViewSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
|
||||
bool aIsSynthesizedImeKey, jni::Object::Param originalEvent)
|
||||
{
|
||||
RefPtr<nsWindow> kungFuDeathGrip(&window);
|
||||
window.UserActivity();
|
||||
window.RemoveIMEComposition();
|
||||
if (!aIsSynthesizedImeKey) {
|
||||
window.UserActivity();
|
||||
window.RemoveIMEComposition();
|
||||
}
|
||||
|
||||
EventMessage msg;
|
||||
if (aAction == sdk::KeyEvent::ACTION_DOWN) {
|
||||
@ -2491,17 +2493,19 @@ nsWindow::GeckoViewSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
|
||||
// these keys are dispatched in sequence.
|
||||
mIMEKeyEvents.AppendElement(
|
||||
mozilla::UniquePtr<WidgetEvent>(event.Duplicate()));
|
||||
|
||||
} else {
|
||||
window.DispatchEvent(&event, status);
|
||||
|
||||
if (status != nsEventStatus_eConsumeNoDefault) {
|
||||
mEditable->OnDefaultKeyEvent(originalEvent);
|
||||
if (window.Destroyed() || status == nsEventStatus_eConsumeNoDefault) {
|
||||
// Skip default processing.
|
||||
return;
|
||||
}
|
||||
|
||||
mEditable->OnDefaultKeyEvent(originalEvent);
|
||||
}
|
||||
|
||||
if (window.Destroyed() ||
|
||||
status == nsEventStatus_eConsumeNoDefault ||
|
||||
msg != eKeyDown || IsModifierKey(aKeyCode)) {
|
||||
if (msg != eKeyDown || IsModifierKey(aKeyCode)) {
|
||||
// Skip sending key press event.
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user