Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: webkit/glue/editor_client_impl.cc

Issue 155399: Add autofill dropdown support for password forms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/editor_client_impl.h ('k') | webkit/glue/password_autocomplete_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/editor_client_impl.cc
===================================================================
--- webkit/glue/editor_client_impl.cc (revision 19957)
+++ webkit/glue/editor_client_impl.cc (working copy)
@@ -73,7 +73,7 @@
: web_view_(static_cast<WebViewImpl*>(web_view)),
use_editor_delegate_(false),
in_redo_(false),
- backspace_pressed_(false),
+ backspace_or_delete_pressed_(false),
spell_check_this_field_status_(SPELLCHECK_AUTOMATIC),
// Don't complain about using "this" in initializer list.
MSVC_PUSH_DISABLE_WARNING(4355)
@@ -749,7 +749,7 @@
if (!requires_caret_at_end) {
DoAutofill(input_element, form_autofill_only, autofill_on_empty_value,
- false, backspace_pressed_);
+ false, backspace_or_delete_pressed_);
} else {
// We post a task for doing the autofill as the caret position is not set
// properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and
@@ -763,7 +763,7 @@
form_autofill_only,
autofill_on_empty_value,
true,
- backspace_pressed_));
+ backspace_or_delete_pressed_));
}
return true;
}
@@ -797,10 +797,7 @@
if (form_autofill_only)
return;
- if (backspace) // No autocomplete for password on backspace.
- return;
-
- listener->OnInlineAutocompleteNeeded(input_element, value);
+ listener->OnInlineAutocompleteNeeded(input_element, value, backspace, true);
return;
}
@@ -811,6 +808,19 @@
reinterpret_cast<int64>(input_element));
}
+void EditorClientImpl::OnAutofillSuggestionAccepted(
+ WebCore::HTMLInputElement* text_field) {
+ WebFrameImpl* webframe =
+ WebFrameImpl::FromFrame(text_field->document()->frame());
+ webkit_glue::PasswordAutocompleteListener* listener =
+ webframe->GetPasswordListener(text_field);
+ std::wstring value = webkit_glue::StringToStdWString(text_field->value());
+ // Password listeners need to autocomplete other fields that depend on the
+ // input element with autofill suggestions.
+ if (listener)
+ listener->OnInlineAutocompleteNeeded(text_field, value, false, false);
+}
+
bool EditorClientImpl::doTextFieldCommandFromEvent(
WebCore::Element* element,
WebCore::KeyboardEvent* event) {
@@ -818,7 +828,8 @@
// find if backspace was pressed from textFieldDidBeginEditing and
// textDidChangeInTextField as when these methods are called the value of the
// input element already contains the type character.
- backspace_pressed_ = (event->keyCode() == WebCore::VKEY_BACK);
+ backspace_or_delete_pressed_ = (event->keyCode() == WebCore::VKEY_BACK) ||
+ (event->keyCode() == WebCore::VKEY_DELETE);
// The Mac code appears to use this method as a hook to implement special
// keyboard commands specific to Safari's auto-fill implementation. We
« no previous file with comments | « webkit/glue/editor_client_impl.h ('k') | webkit/glue/password_autocomplete_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698