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

Unified Diff: webkit/glue/autofill_form.cc

Issue 48033: Autocomplete should work with nameless fields (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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/autofill_form.h ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/autofill_form.cc
===================================================================
--- webkit/glue/autofill_form.cc (revision 11737)
+++ webkit/glue/autofill_form.cc (working copy)
@@ -64,15 +64,29 @@
if (value.length() == 0)
continue;
- std::wstring name = webkit_glue::StringToStdWString(input_element->name());
- // Test that the name is not blank.
- std::wstring trimmed_name;
- TrimWhitespace(name, TRIM_LEADING, &trimmed_name);
- if (trimmed_name.length() == 0)
- continue;
+ std::wstring name = GetNameForInputElement(input_element);
+ if (name.length() == 0)
+ continue; // If we have no name, there is nothing to store.
result->elements.push_back(AutofillForm::Element(name, value));
}
return result;
}
+
+// static
+std::wstring AutofillForm::GetNameForInputElement(WebCore::HTMLInputElement*
+ element) {
+ std::wstring name = webkit_glue::StringToStdWString(element->name());
+ std::wstring trimmed_name;
+ TrimWhitespace(name, TRIM_LEADING, &trimmed_name);
+ if (trimmed_name.length() > 0)
+ return trimmed_name;
+
+ name = webkit_glue::StringToStdWString(element->id());
+ TrimWhitespace(name, TRIM_LEADING, &trimmed_name);
+ if (trimmed_name.length() > 0)
+ return trimmed_name;
+
+ return std::wstring();
+}
« no previous file with comments | « webkit/glue/autofill_form.h ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698