Bug 974560 - Send compositionupdate event for each text event; r=cpeterson

This commit is contained in:
Jim Chen 2014-02-24 12:27:58 -05:00
parent f7ed0b9c3b
commit 4be6092e7d

View File

@ -1708,12 +1708,9 @@ nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
msg = NS_KEY_UP;
break;
case AKEY_EVENT_ACTION_MULTIPLE:
{
WidgetTextEvent event(true, NS_TEXT_TEXT, this);
event.theText.Assign(ae->Characters());
DispatchEvent(&event);
}
return;
// Keys with multiple action are handled in Java,
// and we should never see one here
MOZ_CRASH("Cannot handle key with multiple action");
default:
ALOG("Unknown key action event!");
return;
@ -1910,6 +1907,12 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
InitEvent(event, nullptr);
DispatchEvent(&event);
}
{
WidgetCompositionEvent event(true, NS_COMPOSITION_UPDATE, this);
InitEvent(event, nullptr);
event.data = ae->Characters();
DispatchEvent(&event);
}
{
WidgetTextEvent event(true, NS_TEXT_TEXT, this);
InitEvent(event, nullptr);
@ -2032,17 +2035,13 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
InitEvent(event, nullptr);
DispatchEvent(&event);
}
if (mIMEComposing &&
event.theText != mIMEComposingText) {
{
WidgetCompositionEvent compositionUpdate(true,
NS_COMPOSITION_UPDATE,
this);
InitEvent(compositionUpdate, nullptr);
compositionUpdate.data = event.theText;
DispatchEvent(&compositionUpdate);
if (Destroyed())
return;
}
#ifdef DEBUG_ANDROID_IME
@ -2126,6 +2125,11 @@ nsWindow::NotifyIME(const IMENotification& aIMENotification)
if (mIMEComposing) {
nsRefPtr<nsWindow> kungFuDeathGrip(this);
WidgetCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE,
this);
InitEvent(updateEvent, nullptr);
DispatchEvent(&updateEvent);
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
InitEvent(textEvent, nullptr);
DispatchEvent(&textEvent);