summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Mineer <amineer@chromium.org>2016-03-18 12:46:00 -0700
committerAlex Mineer <amineer@chromium.org>2016-03-18 19:48:01 +0000
commitcb284bea1e19bf52f6af898b7ced1211936325c0 (patch)
tree2e1fde31f9b2a41e2580161787d0c47788bde2a4
parent82bd490ada8515e4cf330eabf1cd957538cbe3c5 (diff)
downloadchromium_src-cb284bea1e19bf52f6af898b7ced1211936325c0.zip
chromium_src-cb284bea1e19bf52f6af898b7ced1211936325c0.tar.gz
chromium_src-cb284bea1e19bf52f6af898b7ced1211936325c0.tar.bz2
Initialize UserGestureIndicator for IME commitText.
Autofill code ignores non-user-gesture-based form updates since they are often greyed-out filler text or suggestions. KeyDown events as well as IME setComposition were already correctly registered as user gestures, but commitText was not. This could cause autofill to save partially typed form fields. BUG=582401 Review URL: https://codereview.chromium.org/1644993002 (cherry picked from commit 6ad2101efa6830ca3f9d156d662b977707b8ceff) Cr-Original-Commit-Position: refs/heads/master@{#374340} Cr-Commit-Position: refs/branch-heads/2623@{#635} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r--third_party/WebKit/Source/web/WebViewImpl.cpp1
-rw-r--r--third_party/WebKit/Source/web/tests/WebViewTest.cpp15
2 files changed, 16 insertions, 0 deletions
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 7beee47..16dba7f 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2391,6 +2391,7 @@ bool WebViewImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavio
bool WebViewImpl::confirmComposition(const WebString& text)
{
+ UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
return confirmComposition(text, DoNotKeepSelection);
}
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 9871232..06116e6 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -3232,4 +3232,19 @@ TEST_F(WebViewTest, WebSubstringUtil)
}
#endif
+TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_password.html"));
+ MockAutofillClient client;
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_password.html", true);
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+ frame->setAutofillClient(&client);
+ webView->setInitialFocus(false);
+
+ EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hello").c_str())));
+ EXPECT_EQ(1, client.textChangesFromUserGesture());
+ EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
+ frame->setAutofillClient(0);
+}
+
} // namespace blink