Bug 1409113 - Add nsIPresShell::HasHandledUserInput() status to InputContext r=masayuki
MozReview-Commit-ID: 60x35NKEzhA
--- 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;
}