diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-11 00:50:44 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-11 00:50:44 +0000 |
commit | 621af4ffdbeeaee2785750258d90b096eb6c7551 (patch) | |
tree | bc894d6f5d2dc501977c81ac2c8918195d10a5f7 /webkit/glue/webview_impl.cc | |
parent | 5c150741a8d3db36f80fbc805e0e5bc7266fef9d (diff) | |
download | chromium_src-621af4ffdbeeaee2785750258d90b096eb6c7551.zip chromium_src-621af4ffdbeeaee2785750258d90b096eb6c7551.tar.gz chromium_src-621af4ffdbeeaee2785750258d90b096eb6c7551.tar.bz2 |
This CL makes the form autofill popup menu behave like the Firefox's one, we only set the text field text when the user presses enter or click on an item.
It also prevents the WM_CHAR events to make it to the page after a WM_KEYDOWN has been processed by the menu (that would typically cause forms to proceed when you pressed enter in the form popup).
BUG=4145
TEST=Type something in a form to have the autofill popup showing. Use the down/up arrow to move around. The text should not change in the text field. Press enter, the selection should be set. Try again clicking this time.
Review URL: http://codereview.chromium.org/9621
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r-- | webkit/glue/webview_impl.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 9ee599e..34a87ea 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -422,8 +422,15 @@ bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) { // Give autocomplete a chance to consume the key events it is interested in. if (autocomplete_popup_ && autocomplete_popup_->isInterestedInEventForKey(event.key_code)) { - if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) + if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) { +#if defined(OS_WIN) + // We need to ignore the next CHAR event after this otherwise pressing + // enter when selecting an item in the menu will go to the page. + if (WebInputEvent::KEY_DOWN == event.type) + suppress_next_keypress_event_ = true; +#endif return true; + } return false; } @@ -1508,6 +1515,7 @@ void WebViewImpl::AutofillSuggestionsForNode( autocomplete_popup_ = WebCore::PopupContainer::create(autocomplete_popup_client_.get(), false); + autocomplete_popup_->setTextOnIndexChange(false); autocomplete_popup_->show(focused_node->getRect(), page_->mainFrame()->view(), 0); } |