Bug 813602 - Don't perform IME sync when there is no focus; r=cpeterson

This commit is contained in:
Jim Chen 2012-11-21 11:14:20 -05:00
parent 7c54cbb8fa
commit 1329c17777

View File

@ -80,6 +80,7 @@ final class GeckoEditable
private int mUIUpdateSeqno;
private int mLastUIUpdateSeqno;
private boolean mUpdateGecko;
private boolean mFocused;
/* An action that alters the Editable
@ -224,7 +225,7 @@ final class GeckoEditable
if (DEBUG) {
GeckoApp.assertOnUiThread();
}
if (!mActions.isEmpty()) {
if (mFocused && !mActions.isEmpty()) {
mActionsActive.acquireUninterruptibly();
mActionsActive.release();
}
@ -477,10 +478,15 @@ final class GeckoEditable
public void run() {
// Make sure there are no other things going on
mActionQueue.syncWithGecko();
if (type == NOTIFY_IME_FOCUSCHANGE && state != IME_FOCUS_STATE_BLUR) {
// Unmask events on the Gecko side
GeckoAppShell.sendEventToGecko(GeckoEvent.createIMEEvent(
GeckoEvent.IME_ACKNOWLEDGE_FOCUS));
if (type == NOTIFY_IME_FOCUSCHANGE) {
if (state == IME_FOCUS_STATE_BLUR) {
mFocused = false;
} else {
mFocused = true;
// Unmask events on the Gecko side
GeckoAppShell.sendEventToGecko(GeckoEvent.createIMEEvent(
GeckoEvent.IME_ACKNOWLEDGE_FOCUS));
}
}
if (mListener != null) {
mListener.notifyIME(type, state);
@ -656,9 +662,11 @@ final class GeckoEditable
what == Selection.SELECTION_END) {
Log.w(LOGTAG, "selection removed with removeSpan()");
}
// Okay to remove immediately
mText.removeSpan(what);
mActionQueue.offer(new Action(Action.TYPE_REMOVE_SPAN));
if (mText.getSpanStart(what) >= 0) { // only remove if it's there
// Okay to remove immediately
mText.removeSpan(what);
mActionQueue.offer(new Action(Action.TYPE_REMOVE_SPAN));
}
}
@Override