Bug 1112212 - Implement key-events-only mode for Android; r=cpeterson

This commit is contained in:
Jim Chen 2015-01-10 12:41:58 -05:00
parent b69a5d45f7
commit 3014dfe975
2 changed files with 13 additions and 5 deletions

View File

@ -590,8 +590,6 @@ class GeckoInputConnection
outAttrs.inputType |= InputType.TYPE_TEXT_VARIATION_URI;
else if (mIMETypeHint.equalsIgnoreCase("email"))
outAttrs.inputType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
else if (mIMETypeHint.equalsIgnoreCase("search"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEARCH;
else if (mIMETypeHint.equalsIgnoreCase("tel"))
outAttrs.inputType = InputType.TYPE_CLASS_PHONE;
else if (mIMETypeHint.equalsIgnoreCase("number") ||
@ -636,7 +634,8 @@ class GeckoInputConnection
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
else if (mIMEActionHint.equalsIgnoreCase("next"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_NEXT;
else if (mIMEActionHint.equalsIgnoreCase("search"))
else if (mIMEActionHint.equalsIgnoreCase("search") ||
mIMETypeHint.equalsIgnoreCase("search"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEARCH;
else if (mIMEActionHint.equalsIgnoreCase("send"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEND;

View File

@ -2124,8 +2124,6 @@ nsWindow::SetInputContext(const InputContext& aContext,
aContext.mIMEState.mEnabled, aContext.mIMEState.mOpen,
aAction.mCause, aAction.mFocusChange);
mInputContext = aContext;
// Ensure that opening the virtual keyboard is allowed for this specific
// InputContext depending on the content.ime.strict.policy pref
if (aContext.mIMEState.mEnabled != IMEState::DISABLED &&
@ -2143,8 +2141,19 @@ nsWindow::SetInputContext(const InputContext& aContext,
if (aContext.mIMEState.mEnabled == IMEState::PLUGIN &&
aContext.mIMEState.mOpen != IMEState::OPEN) {
enabled = IMEState::DISABLED;
} else if (aContext.mMayBeIMEUnaware) {
// Normal text editing using Android virtual keyboards doesn't always
// generate key events. However, when an input field has key event
// listeners but not input/composition event listeners, the page expects
// to receive key events for every input. Therefore, for better web
// compatibility, we use a special mode that always generates key events
// in this situation. This "key-events-only" mode is the same as the
// "plugin" mode, so switch to plugin mode if we are forcing key events.
enabled = IMEState::PLUGIN;
}
mInputContext = aContext;
mInputContext.mIMEState.mEnabled = enabled;
if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB()) {