Bug 1409113 - Add nsIPresShell::HasHandledUserInput() status to InputContext r=masayuki draft
authorJames Willcox <snorp@snorp.net>
Tue, 21 Nov 2017 16:28:36 -0600
changeset 701999 b8c9c647f5a7c96646a0853cad8dfcd344a2c382
parent 701998 44f8accc2cba57c4a0386fdb307b252dc81fce62
child 702000 f3ba5f48dd44b840244d68c33ba150b6311e786c
push id90336
push userbmo:snorp@snorp.net
push dateWed, 22 Nov 2017 15:03:48 +0000
reviewersmasayuki
bugs1409113
milestone59.0a1
Bug 1409113 - Add nsIPresShell::HasHandledUserInput() status to InputContext r=masayuki MozReview-Commit-ID: 60x35NKEzhA
dom/events/IMEStateManager.cpp
widget/IMEData.h
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1274,16 +1274,19 @@ IMEStateManager::SetIMEState(const IMESt
   NS_ENSURE_TRUE_VOID(aWidget);
 
   InputContext context;
   context.mIMEState = aState;
   context.mOrigin = aOrigin;
   context.mMayBeIMEUnaware = context.mIMEState.IsEditable() &&
     sCheckForIMEUnawareWebApps && MayBeIMEUnawareWebApp(aContent);
 
+  context.mHasHandledUserInput =
+    aPresContext && aPresContext->PresShell()->HasHandledUserInput();
+
   context.mInPrivateBrowsing =
     aPresContext &&
     nsContentUtils::IsInPrivateBrowsing(aPresContext->Document());
 
   if (aContent &&
       aContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea)) {
     if (!aContent->IsHTMLElement(nsGkAtoms::textarea)) {
       // <input type=number> has an anonymous <input type=text> descendant
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -320,16 +320,21 @@ struct InputContext final
   };
   Origin mOrigin;
 
   /* True if the webapp may be unaware of IME events such as input event or
    * composiion events. This enables a key-events-only mode on Android for
    * compatibility with webapps relying on key listeners. */
   bool mMayBeIMEUnaware;
 
+  /**
+   * True if the document has ever received user input
+   */
+  bool mHasHandledUserInput;
+
   /* Whether the owning document of the input element has been loaded
    * in private browsing mode. */
   bool mInPrivateBrowsing;
 
   bool IsOriginMainProcess() const
   {
     return mOrigin == ORIGIN_MAIN;
   }