diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 17:56:58 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 17:56:58 +0000 |
commit | c8fed0d1f958d14c71aeaddc43bea1b11b5a5328 (patch) | |
tree | 1dcbd8bb7ed7e3f7012550facc9c8183861081da /webkit/glue/editor_client_impl.cc | |
parent | 0b45add7a298db2c8e4f07ef6117ebfd0ab30c80 (diff) | |
download | chromium_src-c8fed0d1f958d14c71aeaddc43bea1b11b5a5328.zip chromium_src-c8fed0d1f958d14c71aeaddc43bea1b11b5a5328.tar.gz chromium_src-c8fed0d1f958d14c71aeaddc43bea1b11b5a5328.tar.bz2 |
Clicking a text field that is already focused triggers the autofill. However the code triggering this was just checking that the focused element before and after processing the event was the same.
We need to do a hit test to ensure the click is really on the text field, otherwise in cases where clicking somewhere in the page does not change the focus, we would bogusly bring up the autofill popup.
BUG=8627
TEST=Ensure autocomplete popup still works as expected: when entering text, when using up/down arrows, when clicking selected text field. Also ensures the scenario from the bug does not trigger the popup.
Review URL: http://codereview.chromium.org/50038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index 411c514..670bee0 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -28,6 +28,7 @@ #include "base/string_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" #include "webkit/glue/autofill_form.h" +#include "webkit/glue/dom_operations.h" #include "webkit/glue/editor_client_impl.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webkit_glue.h" @@ -664,14 +665,10 @@ void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) { } void EditorClientImpl::ShowAutofillForNode(WebCore::Node* node) { - if (node->nodeType() == WebCore::Node::ELEMENT_NODE) { - WebCore::Element* element = static_cast<WebCore::Element*>(node); - if (element->hasLocalName(WebCore::HTMLNames::inputTag)) { - WebCore::HTMLInputElement* input_element = - static_cast<WebCore::HTMLInputElement*>(element); - Autofill(input_element, true); - } - } + WebCore::HTMLInputElement* input_element = + webkit_glue::NodeToHTMLInputElement(node); + if (input_element) + Autofill(input_element, true); } void EditorClientImpl::Autofill(WebCore::HTMLInputElement* input_element, |