diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 21:35:36 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 21:35:36 +0000 |
commit | e250e4954c84eabbb9cb6f9d63b0e407996141e6 (patch) | |
tree | 0ff635b09f8a6c8f1f6fdcecfc467be20e0e91c1 /chrome/renderer/render_view.cc | |
parent | 0d01f3fd245f3efdad635a69af805722d23be602 (diff) | |
download | chromium_src-e250e4954c84eabbb9cb6f9d63b0e407996141e6.zip chromium_src-e250e4954c84eabbb9cb6f9d63b0e407996141e6.tar.gz chromium_src-e250e4954c84eabbb9cb6f9d63b0e407996141e6.tar.bz2 |
AutoFill: Parse HTMLLabel elements for form control element labels.
BUG=40306
TEST=FormManagerTest.Labels
Review URL: http://codereview.chromium.org/1622004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 0527889..cd649e7 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1952,10 +1952,24 @@ void RenderView::queryAutofillSuggestions(const WebNode& node, static int query_counter = 0; autofill_query_id_ = query_counter++; autofill_query_node_ = node; - const WebKit::WebInputElement input_element = - node.toConstElement<WebInputElement>(); - Send(new ViewHostMsg_QueryFormFieldAutofill( - routing_id_, autofill_query_id_, FormField(input_element))); + + const WebFormControlElement& element = + node.toConstElement<WebFormControlElement>(); + + FormData form; + if (!form_manager_.FindFormWithFormControlElement(element, + FormManager::REQUIRE_NONE, + &form)) + return; + + // TODO(jhawkins): This is very slow. Add a label cache to FormManager. + for (std::vector<FormField>::const_iterator iter = form.fields.begin(); + iter != form.fields.end(); ++iter) { + if (iter->name() == element.nameForAutofill()) { + Send(new ViewHostMsg_QueryFormFieldAutofill( + routing_id_, autofill_query_id_, *iter)); + } + } } void RenderView::removeAutofillSuggestions(const WebString& name, |