Back out 5026c5ad25e7 because of XUL Fennec bustage

This commit is contained in:
Matt Brubeck 2012-03-08 16:42:31 -08:00
parent 8a8040dc03
commit 3b65becc2a
4 changed files with 41 additions and 11 deletions

View File

@ -612,6 +612,12 @@ pref("dom.indexedDB.warningQuota", 5);
pref("media.preload.default", 1); // default to preload none
pref("media.preload.auto", 2); // preload metadata if preload=auto
// 0: don't show fullscreen keyboard
// 1: always show fullscreen keyboard
// -1: show fullscreen keyboard based on threshold pref
pref("widget.ime.android.landscape_fullscreen", 1);
pref("widget.ime.android.fullscreen_threshold", 250); // in hundreths of inches
// optimize images memory usage
pref("image.mem.decodeondraw", true);
pref("content.image.allow_locking", false);

View File

@ -478,9 +478,10 @@ public class GeckoAppShell
mInputConnection.notifyIME(type, state);
}
public static void notifyIMEEnabled(int state, String typeHint, String actionHint) {
public static void notifyIMEEnabled(int state, String typeHint,
String actionHint, boolean landscapeFS) {
if (mInputConnection != null)
mInputConnection.notifyIMEEnabled(state, typeHint, actionHint);
mInputConnection.notifyIMEEnabled(state, typeHint, actionHint, landscapeFS);
}
public static void notifyIMEChange(String text, int start, int end, int newEnd) {

View File

@ -40,7 +40,6 @@ package org.mozilla.gecko;
import android.R;
import android.content.Context;
import android.os.Build.VERSION;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
@ -96,6 +95,7 @@ public class GeckoInputConnection
private static int mIMEState;
private static String mIMETypeHint;
private static String mIMEActionHint;
private static boolean mIMELandscapeFS;
// Is a composition active?
private boolean mComposing;
@ -694,10 +694,8 @@ public class GeckoInputConnection
else if (mIMEActionHint != null && mIMEActionHint.length() != 0)
outAttrs.actionLabel = mIMEActionHint;
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
if (VERSION.SDK_INT >= 11) { // Honeycomb
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN;
}
if (mIMELandscapeFS == false)
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
reset();
return this;
@ -874,7 +872,8 @@ public class GeckoInputConnection
}
}
public void notifyIMEEnabled(int state, String typeHint, String actionHint) {
public void notifyIMEEnabled(int state, String typeHint,
String actionHint, boolean landscapeFS) {
View v = GeckoApp.mAppContext.getLayerController().getView();
if (v == null)
@ -885,6 +884,7 @@ public class GeckoInputConnection
mIMEState = state;
mIMETypeHint = typeHint;
mIMEActionHint = actionHint;
mIMELandscapeFS = landscapeFS;
IMEStateUpdater.enableIME();
}

View File

@ -63,6 +63,9 @@
#define ALOG_BRIDGE(args...)
#endif
#define IME_FULLSCREEN_PREF "widget.ime.android.landscape_fullscreen"
#define IME_FULLSCREEN_THRESHOLD_PREF "widget.ime.android.fullscreen_threshold"
using namespace mozilla;
AndroidBridge *AndroidBridge::sBridge = 0;
@ -103,7 +106,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
mGeckoAppShellClass = (jclass) jEnv->NewGlobalRef(jGeckoAppShellClass);
jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Z)V");
jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
jNotifyScreenShot = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyScreenShot", "(Ljava/nio/ByteBuffer;III)V");
jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V");
@ -238,14 +241,34 @@ AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
nsPromiseFlatString typeHint(aTypeHint);
nsPromiseFlatString actionHint(aActionHint);
jvalue args[3];
jvalue args[4];
AutoLocalJNIFrame jniFrame(env, 1);
args[0].i = aState;
args[1].l = env->NewString(typeHint.get(), typeHint.Length());
args[2].l = env->NewString(actionHint.get(), actionHint.Length());
args[3].z = false;
PRInt32 landscapeFS;
if (NS_SUCCEEDED(Preferences::GetInt(IME_FULLSCREEN_PREF, &landscapeFS))) {
if (landscapeFS == 1) {
args[3].z = true;
} else if (landscapeFS == -1){
if (NS_SUCCEEDED(
Preferences::GetInt(IME_FULLSCREEN_THRESHOLD_PREF,
&landscapeFS))) {
// the threshold is hundreths of inches, so convert the
// threshold to pixels and multiply the height by 100
if (nsWindow::GetAndroidScreenBounds().height * 100 <
landscapeFS * Bridge()->GetDPI()) {
args[3].z = true;
}
}
}
}
env->CallStaticVoidMethodA(sBridge->mGeckoAppShellClass,
sBridge->jNotifyIMEEnabled, args);
sBridge->jNotifyIMEEnabled, args);
}
void