mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 161f9ab0c5e7 (bug 1209574) for Android Perma Failures
This commit is contained in:
parent
aa23b56899
commit
3d0762e5a2
@ -132,6 +132,8 @@ public class GeckoAppShell
|
||||
// We have static members only.
|
||||
private GeckoAppShell() { }
|
||||
|
||||
private static GeckoEditableListener editableListener;
|
||||
|
||||
private static final CrashHandler CRASH_HANDLER = new CrashHandler() {
|
||||
@Override
|
||||
protected String getAppPackageName() {
|
||||
@ -322,6 +324,17 @@ public class GeckoAppShell
|
||||
return;
|
||||
}
|
||||
sLayerView = lv;
|
||||
|
||||
// We should have a unique GeckoEditable instance per nsWindow instance,
|
||||
// so even though we have a new view here, the underlying nsWindow is the same,
|
||||
// and we don't create a new GeckoEditable.
|
||||
if (editableListener == null) {
|
||||
// Starting up; istall new Gecko-to-Java editable listener.
|
||||
editableListener = new GeckoEditable();
|
||||
} else {
|
||||
// Bind the existing GeckoEditable instance to the new LayerView
|
||||
GeckoAppShell.notifyIMEContext(GeckoEditableListener.IME_STATE_DISABLED, "", "", "");
|
||||
}
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
@ -406,6 +419,31 @@ public class GeckoAppShell
|
||||
CRASH_HANDLER.uncaughtException(thread, e);
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static void notifyIME(int type) {
|
||||
if (editableListener != null) {
|
||||
editableListener.notifyIME(type);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static void notifyIMEContext(int state, String typeHint,
|
||||
String modeHint, String actionHint) {
|
||||
if (editableListener != null) {
|
||||
editableListener.notifyIMEContext(state, typeHint,
|
||||
modeHint, actionHint);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static void notifyIMEChange(String text, int start, int end, int newEnd) {
|
||||
if (newEnd < 0) { // Selection change
|
||||
editableListener.onSelectionChange(start, end);
|
||||
} else { // Text change
|
||||
editableListener.onTextChange(text, start, end, newEnd);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object sEventAckLock = new Object();
|
||||
private static boolean sWaitingForEventAck;
|
||||
|
||||
|
@ -16,7 +16,6 @@ import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
@ -348,12 +347,7 @@ final class GeckoEditable
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
GeckoEditable() {
|
||||
if (DEBUG) {
|
||||
// Called by nsWindow.
|
||||
ThreadUtils.assertOnGeckoThread();
|
||||
}
|
||||
mActionQueue = new ActionQueue();
|
||||
mSavedSelectionStart = -1;
|
||||
mUpdateGecko = true;
|
||||
@ -774,7 +768,7 @@ final class GeckoEditable
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI @Override
|
||||
@Override
|
||||
public void notifyIME(final int type) {
|
||||
if (DEBUG) {
|
||||
// GeckoEditableListener methods should all be called from the Gecko thread
|
||||
@ -850,12 +844,12 @@ final class GeckoEditable
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI @Override
|
||||
@Override
|
||||
public void notifyIMEContext(final int state, final String typeHint,
|
||||
final String modeHint, final String actionHint) {
|
||||
final String modeHint, final String actionHint) {
|
||||
// Because we want to be able to bind GeckoEditable to the newest LayerView instance,
|
||||
// this can be called from the Java IC thread in addition to the Gecko thread.
|
||||
if (DEBUG) {
|
||||
// GeckoEditableListener methods should all be called from the Gecko thread
|
||||
ThreadUtils.assertOnGeckoThread();
|
||||
Log.d(LOGTAG, "notifyIMEContext(" +
|
||||
getConstantName(GeckoEditableListener.class, "IME_STATE_", state) +
|
||||
", \"" + typeHint + "\", \"" + modeHint + "\", \"" + actionHint + "\")");
|
||||
@ -878,7 +872,7 @@ final class GeckoEditable
|
||||
});
|
||||
}
|
||||
|
||||
@WrapForJNI @Override
|
||||
@Override
|
||||
public void onSelectionChange(final int start, final int end) {
|
||||
if (DEBUG) {
|
||||
// GeckoEditableListener methods should all be called from the Gecko thread
|
||||
@ -934,9 +928,9 @@ final class GeckoEditable
|
||||
TextUtils.regionMatches(mText, start, newText, 0, oldEnd - start);
|
||||
}
|
||||
|
||||
@WrapForJNI @Override
|
||||
@Override
|
||||
public void onTextChange(final CharSequence text, final int start,
|
||||
final int unboundedOldEnd, final int unboundedNewEnd) {
|
||||
final int unboundedOldEnd, final int unboundedNewEnd) {
|
||||
if (DEBUG) {
|
||||
// GeckoEditableListener methods should all be called from the Gecko thread
|
||||
ThreadUtils.assertOnGeckoThread();
|
||||
|
@ -5,17 +5,13 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
|
||||
/**
|
||||
* Interface for the Editable to listen on the Gecko thread, as well as for the IC thread to listen
|
||||
* to the Editable.
|
||||
*/
|
||||
interface GeckoEditableListener {
|
||||
// IME notification type for notifyIME(), corresponding to NotificationToIME enum in Gecko
|
||||
@WrapForJNI
|
||||
int NOTIFY_IME_OPEN_VKB = -2;
|
||||
@WrapForJNI
|
||||
int NOTIFY_IME_REPLY_EVENT = -1;
|
||||
int NOTIFY_IME_OF_FOCUS = 1;
|
||||
int NOTIFY_IME_OF_BLUR = 2;
|
||||
|
@ -542,6 +542,30 @@ auto GeckoAppShell::NotifyDefaultPrevented(bool a0) -> void
|
||||
return mozilla::jni::Method<NotifyDefaultPrevented_t>::Call(nullptr, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char GeckoAppShell::NotifyIME_t::name[];
|
||||
constexpr char GeckoAppShell::NotifyIME_t::signature[];
|
||||
|
||||
auto GeckoAppShell::NotifyIME(int32_t a0) -> void
|
||||
{
|
||||
return mozilla::jni::Method<NotifyIME_t>::Call(nullptr, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char GeckoAppShell::NotifyIMEChange_t::name[];
|
||||
constexpr char GeckoAppShell::NotifyIMEChange_t::signature[];
|
||||
|
||||
auto GeckoAppShell::NotifyIMEChange(mozilla::jni::String::Param a0, int32_t a1, int32_t a2, int32_t a3) -> void
|
||||
{
|
||||
return mozilla::jni::Method<NotifyIMEChange_t>::Call(nullptr, nullptr, a0, a1, a2, a3);
|
||||
}
|
||||
|
||||
constexpr char GeckoAppShell::NotifyIMEContext_t::name[];
|
||||
constexpr char GeckoAppShell::NotifyIMEContext_t::signature[];
|
||||
|
||||
auto GeckoAppShell::NotifyIMEContext(int32_t a0, mozilla::jni::String::Param a1, mozilla::jni::String::Param a2, mozilla::jni::String::Param a3) -> void
|
||||
{
|
||||
return mozilla::jni::Method<NotifyIMEContext_t>::Call(nullptr, nullptr, a0, a1, a2, a3);
|
||||
}
|
||||
|
||||
constexpr char GeckoAppShell::NotifyWakeLockChanged_t::name[];
|
||||
constexpr char GeckoAppShell::NotifyWakeLockChanged_t::signature[];
|
||||
|
||||
@ -710,50 +734,6 @@ auto GeckoAppShell::VibrateA(mozilla::jni::LongArray::Param a0, int32_t a1) -> v
|
||||
return mozilla::jni::Method<VibrateA_t>::Call(nullptr, nullptr, a0, a1);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditable::name[];
|
||||
|
||||
constexpr char GeckoEditable::New_t::name[];
|
||||
constexpr char GeckoEditable::New_t::signature[];
|
||||
|
||||
auto GeckoEditable::New() -> GeckoEditable::LocalRef
|
||||
{
|
||||
return mozilla::jni::Constructor<New_t>::Call(nullptr, nullptr);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditable::NotifyIME_t::name[];
|
||||
constexpr char GeckoEditable::NotifyIME_t::signature[];
|
||||
|
||||
auto GeckoEditable::NotifyIME(int32_t a0) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<NotifyIME_t>::Call(this, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditable::NotifyIMEContext_t::name[];
|
||||
constexpr char GeckoEditable::NotifyIMEContext_t::signature[];
|
||||
|
||||
auto GeckoEditable::NotifyIMEContext(int32_t a0, mozilla::jni::String::Param a1, mozilla::jni::String::Param a2, mozilla::jni::String::Param a3) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<NotifyIMEContext_t>::Call(this, nullptr, a0, a1, a2, a3);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditable::OnSelectionChange_t::name[];
|
||||
constexpr char GeckoEditable::OnSelectionChange_t::signature[];
|
||||
|
||||
auto GeckoEditable::OnSelectionChange(int32_t a0, int32_t a1) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<OnSelectionChange_t>::Call(this, nullptr, a0, a1);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditable::OnTextChange_t::name[];
|
||||
constexpr char GeckoEditable::OnTextChange_t::signature[];
|
||||
|
||||
auto GeckoEditable::OnTextChange(mozilla::jni::String::Param a0, int32_t a1, int32_t a2, int32_t a3) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<OnTextChange_t>::Call(this, nullptr, a0, a1, a2, a3);
|
||||
}
|
||||
|
||||
constexpr char GeckoEditableListener::name[];
|
||||
|
||||
constexpr char GeckoJavaSampler::name[];
|
||||
|
||||
constexpr char GeckoJavaSampler::GetFrameNameJavaProfilingWrapper_t::name[];
|
||||
|
@ -1295,6 +1295,66 @@ public:
|
||||
|
||||
static auto NotifyDefaultPrevented(bool) -> void;
|
||||
|
||||
public:
|
||||
struct NotifyIME_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "notifyIME";
|
||||
static constexpr char signature[] =
|
||||
"(I)V";
|
||||
static const bool isStatic = true;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto NotifyIME(int32_t) -> void;
|
||||
|
||||
public:
|
||||
struct NotifyIMEChange_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::String::Param,
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "notifyIMEChange";
|
||||
static constexpr char signature[] =
|
||||
"(Ljava/lang/String;III)V";
|
||||
static const bool isStatic = true;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto NotifyIMEChange(mozilla::jni::String::Param, int32_t, int32_t, int32_t) -> void;
|
||||
|
||||
public:
|
||||
struct NotifyIMEContext_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
mozilla::jni::String::Param,
|
||||
mozilla::jni::String::Param,
|
||||
mozilla::jni::String::Param> Args;
|
||||
static constexpr char name[] = "notifyIMEContext";
|
||||
static constexpr char signature[] =
|
||||
"(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V";
|
||||
static const bool isStatic = true;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto NotifyIMEContext(int32_t, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param) -> void;
|
||||
|
||||
public:
|
||||
struct NotifyWakeLockChanged_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
@ -1686,140 +1746,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class GeckoEditable : public mozilla::jni::Class<GeckoEditable>
|
||||
{
|
||||
public:
|
||||
typedef mozilla::jni::Ref<GeckoEditable> Ref;
|
||||
typedef mozilla::jni::LocalRef<GeckoEditable> LocalRef;
|
||||
typedef mozilla::jni::GlobalRef<GeckoEditable> GlobalRef;
|
||||
typedef const mozilla::jni::Param<GeckoEditable>& Param;
|
||||
|
||||
static constexpr char name[] =
|
||||
"org/mozilla/gecko/GeckoEditable";
|
||||
|
||||
protected:
|
||||
GeckoEditable(jobject instance) : Class(instance) {}
|
||||
|
||||
public:
|
||||
struct New_t {
|
||||
typedef GeckoEditable Owner;
|
||||
typedef GeckoEditable::LocalRef ReturnType;
|
||||
typedef GeckoEditable::Param SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "<init>";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto New() -> GeckoEditable::LocalRef;
|
||||
|
||||
public:
|
||||
struct NotifyIME_t {
|
||||
typedef GeckoEditable Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "notifyIME";
|
||||
static constexpr char signature[] =
|
||||
"(I)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto NotifyIME(int32_t) const -> void;
|
||||
|
||||
public:
|
||||
struct NotifyIMEContext_t {
|
||||
typedef GeckoEditable Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
mozilla::jni::String::Param,
|
||||
mozilla::jni::String::Param,
|
||||
mozilla::jni::String::Param> Args;
|
||||
static constexpr char name[] = "notifyIMEContext";
|
||||
static constexpr char signature[] =
|
||||
"(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto NotifyIMEContext(int32_t, mozilla::jni::String::Param, mozilla::jni::String::Param, mozilla::jni::String::Param) const -> void;
|
||||
|
||||
public:
|
||||
struct OnSelectionChange_t {
|
||||
typedef GeckoEditable Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "onSelectionChange";
|
||||
static constexpr char signature[] =
|
||||
"(II)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto OnSelectionChange(int32_t, int32_t) const -> void;
|
||||
|
||||
public:
|
||||
struct OnTextChange_t {
|
||||
typedef GeckoEditable Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::String::Param,
|
||||
int32_t,
|
||||
int32_t,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "onTextChange";
|
||||
static constexpr char signature[] =
|
||||
"(Ljava/lang/CharSequence;III)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto OnTextChange(mozilla::jni::String::Param, int32_t, int32_t, int32_t) const -> void;
|
||||
|
||||
};
|
||||
|
||||
class GeckoEditableListener : public mozilla::jni::Class<GeckoEditableListener>
|
||||
{
|
||||
public:
|
||||
typedef mozilla::jni::Ref<GeckoEditableListener> Ref;
|
||||
typedef mozilla::jni::LocalRef<GeckoEditableListener> LocalRef;
|
||||
typedef mozilla::jni::GlobalRef<GeckoEditableListener> GlobalRef;
|
||||
typedef const mozilla::jni::Param<GeckoEditableListener>& Param;
|
||||
|
||||
static constexpr char name[] =
|
||||
"org/mozilla/gecko/GeckoEditableListener";
|
||||
|
||||
protected:
|
||||
GeckoEditableListener(jobject instance) : Class(instance) {}
|
||||
|
||||
public:
|
||||
static const int32_t NOTIFY_IME_OPEN_VKB = -2;
|
||||
|
||||
public:
|
||||
static const int32_t NOTIFY_IME_REPLY_EVENT = -1;
|
||||
|
||||
};
|
||||
|
||||
class GeckoJavaSampler : public mozilla::jni::Class<GeckoJavaSampler>
|
||||
{
|
||||
public:
|
||||
|
@ -249,10 +249,6 @@ nsWindow::Natives::Open(const jni::ClassObject::LocalRef& cls,
|
||||
|
||||
gGeckoViewWindow = static_cast<nsWindow*>(widget.get());
|
||||
gGeckoViewWindow->mNatives = mozilla::MakeUnique<Natives>(gGeckoViewWindow);
|
||||
|
||||
// Create GeckoEditable for the new nsWindow/GeckoView pair.
|
||||
gGeckoViewWindow->mEditable = GeckoEditable::New();
|
||||
|
||||
AttachNative(GeckoView::Window::LocalRef(cls.Env(), gvWindow),
|
||||
gGeckoViewWindow->mNatives.get());
|
||||
}
|
||||
@ -1015,8 +1011,8 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::IME_EVENT:
|
||||
gGeckoViewWindow->UserActivity();
|
||||
gGeckoViewWindow->OnIMEEvent(ae);
|
||||
win->UserActivity();
|
||||
win->OnIMEEvent(ae);
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::IME_KEY_EVENT:
|
||||
@ -1812,7 +1808,7 @@ public:
|
||||
nsRefPtr<mozilla::TextComposition>
|
||||
nsWindow::GetIMEComposition()
|
||||
{
|
||||
MOZ_ASSERT(this == FindTopLevel());
|
||||
MOZ_ASSERT(this == TopWindow());
|
||||
return mozilla::IMEStateManager::GetTextCompositionFor(this);
|
||||
}
|
||||
|
||||
@ -1888,14 +1884,14 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
NotifyIMEOfTextChange(notification);
|
||||
FlushIMEChanges();
|
||||
}
|
||||
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
return;
|
||||
|
||||
} else if (ae->Action() == AndroidGeckoEvent::IME_UPDATE_CONTEXT) {
|
||||
mEditable->NotifyIMEContext(mInputContext.mIMEState.mEnabled,
|
||||
mInputContext.mHTMLInputType,
|
||||
mInputContext.mHTMLInputInputmode,
|
||||
mInputContext.mActionHint);
|
||||
GeckoAppShell::NotifyIMEContext(mInputContext.mIMEState.mEnabled,
|
||||
mInputContext.mHTMLInputType,
|
||||
mInputContext.mHTMLInputInputmode,
|
||||
mInputContext.mActionHint);
|
||||
mIMEUpdatingContext = false;
|
||||
return;
|
||||
}
|
||||
@ -1905,7 +1901,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
if (ae->Action() == AndroidGeckoEvent::IME_SYNCHRONIZE ||
|
||||
ae->Action() == AndroidGeckoEvent::IME_COMPOSE_TEXT ||
|
||||
ae->Action() == AndroidGeckoEvent::IME_REPLACE_TEXT) {
|
||||
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1920,7 +1916,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
case AndroidGeckoEvent::IME_SYNCHRONIZE:
|
||||
{
|
||||
FlushIMEChanges();
|
||||
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1965,8 +1961,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
}
|
||||
mIMEKeyEvents.Clear();
|
||||
FlushIMEChanges();
|
||||
mEditable->NotifyIME(
|
||||
GeckoEditableListener::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
// Break out of the switch block
|
||||
break;
|
||||
}
|
||||
@ -2017,7 +2012,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
}
|
||||
|
||||
FlushIMEChanges();
|
||||
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2181,17 +2176,13 @@ nsWindow::UserActivity()
|
||||
nsresult
|
||||
nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
{
|
||||
MOZ_ASSERT(this == FindTopLevel());
|
||||
|
||||
if (!mEditable) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
MOZ_ASSERT(this == TopWindow());
|
||||
|
||||
switch (aIMENotification.mMessage) {
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
//ALOGIME("IME: REQUEST_TO_COMMIT_COMPOSITION: s=%d", aState);
|
||||
RemoveIMEComposition();
|
||||
mEditable->NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
GeckoAppShell::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
return NS_OK;
|
||||
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
@ -2209,12 +2200,12 @@ nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
DispatchEvent(&compositionCommitEvent);
|
||||
}
|
||||
|
||||
mEditable->NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
GeckoAppShell::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
return NS_OK;
|
||||
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
ALOGIME("IME: NOTIFY_IME_OF_FOCUS");
|
||||
mEditable->NotifyIME(NOTIFY_IME_OF_FOCUS);
|
||||
GeckoAppShell::NotifyIME(NOTIFY_IME_OF_FOCUS);
|
||||
return NS_OK;
|
||||
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
@ -2225,7 +2216,7 @@ nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
// event back to Gecko. That is where we unmask event handling
|
||||
mIMEMaskEventsCount++;
|
||||
|
||||
mEditable->NotifyIME(NOTIFY_IME_OF_BLUR);
|
||||
GeckoAppShell::NotifyIME(NOTIFY_IME_OF_BLUR);
|
||||
return NS_OK;
|
||||
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
@ -2255,7 +2246,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
||||
// Disable the Android keyboard on b2gdroid.
|
||||
return;
|
||||
#endif
|
||||
nsWindow *top = FindTopLevel();
|
||||
nsWindow *top = TopWindow();
|
||||
if (top && this != top) {
|
||||
// We are using an IME event later to notify Java, and the IME event
|
||||
// will be processed by the top window. Therefore, to ensure the
|
||||
@ -2265,10 +2256,6 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
ALOGIME("IME: SetInputContext: s=0x%X, 0x%X, action=0x%X, 0x%X",
|
||||
aContext.mIMEState.mEnabled, aContext.mIMEState.mOpen,
|
||||
aAction.mCause, aAction.mFocusChange);
|
||||
@ -2297,7 +2284,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
||||
|
||||
if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB()) {
|
||||
// Don't reset keyboard when we should simply open the vkb
|
||||
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_OPEN_VKB);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_OPEN_VKB);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2313,7 +2300,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
||||
NS_IMETHODIMP_(InputContext)
|
||||
nsWindow::GetInputContext()
|
||||
{
|
||||
nsWindow *top = FindTopLevel();
|
||||
nsWindow *top = TopWindow();
|
||||
if (top && this != top) {
|
||||
// We let the top window process SetInputContext,
|
||||
// so we should let it process GetInputContext as well.
|
||||
@ -2373,8 +2360,8 @@ nsWindow::FlushIMEChanges()
|
||||
NS_ENSURE_TRUE_VOID(event.mReply.mContentsRoot == imeRoot.get());
|
||||
}
|
||||
|
||||
mEditable->OnTextChange(event.mReply.mString, change.mStart,
|
||||
change.mOldEnd, change.mNewEnd);
|
||||
GeckoAppShell::NotifyIMEChange(event.mReply.mString, change.mStart,
|
||||
change.mOldEnd, change.mNewEnd);
|
||||
}
|
||||
mIMETextChanges.Clear();
|
||||
|
||||
@ -2386,8 +2373,9 @@ nsWindow::FlushIMEChanges()
|
||||
NS_ENSURE_TRUE_VOID(event.mSucceeded);
|
||||
NS_ENSURE_TRUE_VOID(event.mReply.mContentsRoot == imeRoot.get());
|
||||
|
||||
mEditable->OnSelectionChange(int32_t(event.GetSelectionStart()),
|
||||
int32_t(event.GetSelectionEnd()));
|
||||
GeckoAppShell::NotifyIMEChange(EmptyString(),
|
||||
int32_t(event.GetSelectionStart()),
|
||||
int32_t(event.GetSelectionEnd()), -1);
|
||||
mIMESelectionChanged = false;
|
||||
}
|
||||
}
|
||||
@ -2395,8 +2383,6 @@ nsWindow::FlushIMEChanges()
|
||||
nsresult
|
||||
nsWindow::NotifyIMEOfTextChange(const IMENotification& aIMENotification)
|
||||
{
|
||||
MOZ_ASSERT(this == FindTopLevel());
|
||||
|
||||
MOZ_ASSERT(aIMENotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE,
|
||||
"NotifyIMEOfTextChange() is called with invaild notification");
|
||||
|
||||
|
@ -49,9 +49,6 @@ public:
|
||||
// Object that implements native GeckoView calls;
|
||||
// nullptr for nsWindows that were not opened from GeckoView.
|
||||
mozilla::UniquePtr<Natives> mNatives;
|
||||
// GeckoEditable instance used by this nsWindow;
|
||||
// nullptr for nsWindows that are not GeckoViews.
|
||||
mozilla::widget::GeckoEditable::GlobalRef mEditable;
|
||||
|
||||
static void OnGlobalAndroidEvent(mozilla::AndroidGeckoEvent *ae);
|
||||
static mozilla::gfx::IntSize GetAndroidScreenBounds();
|
||||
|
Loading…
Reference in New Issue
Block a user