Bug 755976 - Send empty text and selection when IME is disabled. r=cpeterson

This commit is contained in:
Eitan Isaacson 2012-06-07 11:09:00 -07:00
Родитель 80d7645190
Коммит 754938df6d
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -2169,6 +2169,11 @@ nsWindow::OnIMETextChange(PRUint32 aStart, PRUint32 aOldEnd, PRUint32 aNewEnd)
ALOGIME("IME: OnIMETextChange: s=%d, oe=%d, ne=%d", ALOGIME("IME: OnIMETextChange: s=%d, oe=%d, ne=%d",
aStart, aOldEnd, aNewEnd); aStart, aOldEnd, aNewEnd);
if (!mInputContext.mIMEState.mEnabled) {
AndroidBridge::NotifyIMEChange(nsnull, 0, 0, 0, 0);
return NS_OK;
}
// A quirk in Android makes it necessary to pass the whole text. // A quirk in Android makes it necessary to pass the whole text.
// The more efficient way would have been passing the substring from index // The more efficient way would have been passing the substring from index
// aStart to index aNewEnd // aStart to index aNewEnd
@ -2194,6 +2199,11 @@ nsWindow::OnIMESelectionChange(void)
{ {
ALOGIME("IME: OnIMESelectionChange"); ALOGIME("IME: OnIMESelectionChange");
if (!mInputContext.mIMEState.mEnabled) {
AndroidBridge::NotifyIMEChange(nsnull, 0, 0, 0, -1);
return NS_OK;
}
nsRefPtr<nsWindow> kungFuDeathGrip(this); nsRefPtr<nsWindow> kungFuDeathGrip(this);
nsQueryContentEvent event(true, NS_QUERY_SELECTED_TEXT, this); nsQueryContentEvent event(true, NS_QUERY_SELECTED_TEXT, this);
InitEvent(event, nsnull); InitEvent(event, nsnull);