mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199658 - Don't commit Java composition when Gecko side commits its composition; r=esawin
Right now, when the Gecko side commits its composition, we notify the Java side and the Java side commits its composition as well. However, some keyboards have trouble dealing with us manually committing the composition. To better support these keyboards, this patch makes it so that even if the Gecko composition is committed, the Java composition is still kept. Because the Gecko composition on Android is used only for display purposes, it doesn't matter too much when the Gecko composition is out-of-sync with the Java composition.
This commit is contained in:
parent
beacd9bfb6
commit
a7fe94d7d5
@ -854,34 +854,14 @@ final class GeckoEditable extends JNIObject
|
||||
}
|
||||
|
||||
private void notifyCommitComposition() {
|
||||
// Gecko already committed its composition, and
|
||||
// we should remove the composition on our side as well.
|
||||
boolean wasComposing = false;
|
||||
final Object[] spans = mText.getSpans(0, mText.length(), Object.class);
|
||||
|
||||
for (Object span : spans) {
|
||||
if ((mText.getSpanFlags(span) & Spanned.SPAN_COMPOSING) != 0) {
|
||||
mText.removeSpan(span);
|
||||
wasComposing = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate a text change notification if we actually cleared the composition.
|
||||
final CharSequence text = TextUtils.stringOrSpannedString(mText);
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mListener.onTextChange(text, 0, text.length(), text.length());
|
||||
}
|
||||
});
|
||||
// Gecko already committed its composition. However, Android keyboards
|
||||
// have trouble dealing with us removing the composition manually on
|
||||
// the Java side. Therefore, we keep the composition intact on the Java
|
||||
// side. The text content should still be in-sync on both sides.
|
||||
}
|
||||
|
||||
private void notifyCancelComposition() {
|
||||
// Composition should have been cancelled on our side
|
||||
// Composition should have been canceled on our side
|
||||
// through text update notifications; verify that here.
|
||||
if (DEBUG) {
|
||||
final Object[] spans = mText.getSpans(0, mText.length(), Object.class);
|
||||
|
Loading…
Reference in New Issue
Block a user