Bug 1406446 - part 2: Android widget should use API of InputContextAction rather than accessing EventStateManager r=jchen
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 24 Oct 2017 02:53:19 +0900
changeset 443423 a5dd465e0bc230eb61bcb58b2d3d5ddc6da6f88d
parent 443422 a6e70d92a22f98a28c2e8a0082bf62a29a1a7556
child 443424 2e4e139bb5d7586ae8cb67bf2450dcaec4ba1255
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1406446, 1402461
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
widget/android/GeckoEditableSupport.cpp
--- 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,