diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 00:19:48 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 00:19:48 +0000 |
commit | 5c2ac85b5f50766b3fe31af931f1b2500e463bfd (patch) | |
tree | 147f50bef6f7fd32850d3df06280dc974ae72065 /webkit/glue/editor_client_impl.cc | |
parent | e3a3f854c2d09b87cf1373eeaaf26cdb6decb08b (diff) | |
download | chromium_src-5c2ac85b5f50766b3fe31af931f1b2500e463bfd.zip chromium_src-5c2ac85b5f50766b3fe31af931f1b2500e463bfd.tar.gz chromium_src-5c2ac85b5f50766b3fe31af931f1b2500e463bfd.tar.bz2 |
Add autofill dropdown support for password forms.
BUG=5406
Review URL: http://codereview.chromium.org/155399
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index 07d1b5c..5094545 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -73,7 +73,7 @@ EditorClientImpl::EditorClientImpl(WebView* web_view) : 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 @@ bool EditorClientImpl::Autofill(WebCore::HTMLInputElement* input_element, 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 @@ bool EditorClientImpl::Autofill(WebCore::HTMLInputElement* input_element, form_autofill_only, autofill_on_empty_value, true, - backspace_pressed_)); + backspace_or_delete_pressed_)); } return true; } @@ -797,10 +797,7 @@ void EditorClientImpl::DoAutofill(WebCore::HTMLInputElement* input_element, 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 @@ void EditorClientImpl::DoAutofill(WebCore::HTMLInputElement* input_element, 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 @@ bool EditorClientImpl::doTextFieldCommandFromEvent( // 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 |