Bug 1406446 - part 2: Android widget should use API of InputContextAction rather than accessing EventStateManager r?jchen
Basically, widget code shouldn't access API in dom/events as far as possible
since it's difficult to care widget code when other developers to change under
dom/.
This patch backouts the patch for
bug 1402461 which made GeckoEditableSupport
depend on EventStateManager in dom/events. Now, necessary information is in
InputContextAction and same condition should be shared with Windows.
MozReview-Commit-ID: LMlrizswxUj
--- a/widget/android/GeckoEditableSupport.cpp
+++ b/widget/android/GeckoEditableSupport.cpp
@@ -7,17 +7,16 @@
#include "GeckoEditableSupport.h"
#include "AndroidRect.h"
#include "KeyEvent.h"
#include "PuppetWidget.h"
#include "nsIContent.h"
#include "nsISelection.h"
-#include "mozilla/EventStateManager.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/TextComposition.h"
#include "mozilla/TextEventDispatcherListener.h"
#include "mozilla/TextEvents.h"
#include <android/api-level.h>
#include <android/input.h>
#include <android/log.h>
@@ -1354,32 +1353,31 @@ GeckoEditableSupport::SetInputContext(co
{
MOZ_ASSERT(mEditable);
ALOGIME("IME: SetInputContext: s=0x%X, 0x%X, action=0x%X, 0x%X",
aContext.mIMEState.mEnabled, aContext.mIMEState.mOpen,
aAction.mCause, aAction.mFocusChange);
mInputContext = aContext;
- const bool isUserAction = EventStateManager::IsHandlingUserInput();
if (mInputContext.mIMEState.mEnabled == IMEState::ENABLED &&
- isUserAction &&
- aAction.mFocusChange == InputContextAction::FOCUS_NOT_CHANGED) {
+ aAction.UserMightRequestOpenVKB()) {
// Don't reset keyboard when we should simply open the vkb
mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_OPEN_VKB);
return;
}
if (mIMEUpdatingContext) {
return;
}
mIMEUpdatingContext = true;
RefPtr<GeckoEditableSupport> self(this);
+ bool isUserAction = aAction.IsHandlingUserInput();
nsAppShell::PostEvent([this, self, isUserAction] {
nsCOMPtr<nsIWidget> widget = GetWidget();
mIMEUpdatingContext = false;
if (!widget || widget->Destroyed()) {
return;
}
mEditable->NotifyIMEContext(mInputContext.mIMEState.mEnabled,