зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1499076 - Dispatch key down event before firing input event. r=geckoview-reviewers,snorp
When deleting text by backspace key of VKB, VKB might use `InputConnection.setComposingText`, not using KeyEvent. So although we dispatch dummy key event, the order of events is incorrect. We should dispatch keydown before input event. Differential Revision: https://phabricator.services.mozilla.com/D64892 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
82b428a40f
Коммит
700ac16e44
|
@ -1071,6 +1071,7 @@ bool GeckoEditableSupport::DoReplaceText(int32_t aStart, int32_t aEnd,
|
|||
const bool composing = !mIMERanges->IsEmpty();
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
bool textChanged = composing;
|
||||
bool performDeletion = true;
|
||||
|
||||
if (!mIMEKeyEvents.IsEmpty() || !composition || !mDispatcher->IsComposing() ||
|
||||
uint32_t(aStart) != composition->NativeOffsetOfStartComposition() ||
|
||||
|
@ -1119,13 +1120,7 @@ bool GeckoEditableSupport::DoReplaceText(int32_t aStart, int32_t aEnd,
|
|||
|
||||
if (aStart != aEnd) {
|
||||
// Perform a deletion first.
|
||||
WidgetContentCommandEvent event(true, eContentCommandDelete, widget);
|
||||
event.mTime = PR_Now() / 1000;
|
||||
widget->DispatchEvent(&event, status);
|
||||
if (!mDispatcher || widget->Destroyed()) {
|
||||
return false;
|
||||
}
|
||||
textChanged = true;
|
||||
performDeletion = true;
|
||||
}
|
||||
} else if (composition->String().Equals(string)) {
|
||||
/* If the new text is the same as the existing composition text,
|
||||
|
@ -1150,6 +1145,16 @@ bool GeckoEditableSupport::DoReplaceText(int32_t aStart, int32_t aEnd,
|
|||
}
|
||||
}
|
||||
|
||||
if (performDeletion) {
|
||||
WidgetContentCommandEvent event(true, eContentCommandDelete, widget);
|
||||
event.mTime = PR_Now() / 1000;
|
||||
widget->DispatchEvent(&event, status);
|
||||
if (!mDispatcher || widget->Destroyed()) {
|
||||
return false;
|
||||
}
|
||||
textChanged = true;
|
||||
}
|
||||
|
||||
if (composing) {
|
||||
mDispatcher->SetPendingComposition(string, mIMERanges);
|
||||
mDispatcher->FlushPendingComposition(status);
|
||||
|
|
Загрузка…
Ссылка в новой задаче