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

Unified Diff: components/autofill/core/browser/form_structure.cc

Issue 1671753004: [Autofill] Fill fields that have an autocomplete attributes even if not in a form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 10 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
Index: components/autofill/core/browser/form_structure.cc
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc
index feb1ddc7dbb1755bb0a175bc3a3ce69c7afa1b31..7c880cf90d8043765cae305e6b6d324e7f989279 100644
--- a/components/autofill/core/browser/form_structure.cc
+++ b/components/autofill/core/browser/form_structure.cc
@@ -304,7 +304,8 @@ FormStructure::FormStructure(const FormData& form)
has_author_specified_sections_(false),
was_parsed_for_autocomplete_attributes_(false),
has_password_field_(false),
- is_form_tag_(form.is_form_tag) {
+ is_form_tag_(form.is_form_tag),
+ is_formless_checkout_(form.is_formless_checkout) {
// Copy the form fields.
std::map<base::string16, size_t> unique_names;
for (const FormFieldData& field : form.fields) {
@@ -337,13 +338,14 @@ FormStructure::~FormStructure() {}
void FormStructure::DetermineHeuristicTypes() {
// First, try to detect field types based on each field's |autocomplete|
- // attribute value. If there is at least one form field that specifies an
- // autocomplete type hint, don't try to apply other heuristics to match fields
- // in this form.
+ // attribute value.
if (!was_parsed_for_autocomplete_attributes_)
ParseFieldTypesFromAutocompleteAttributes();
- if (active_field_count() >= kRequiredFieldsForPredictionRoutines) {
+ // Then, if there are enough active fields and if the form is not a synthetic
Mathieu 2016/02/05 22:36:45 // Then if there are enough active fields, and if
sebsg 2016/02/09 01:13:57 Done.
+ // non checkout form, run the heuristics and server prediction routines.
+ if (active_field_count() >= kRequiredFieldsForPredictionRoutines &&
+ (is_form_tag_ || is_formless_checkout_)) {
ServerFieldTypeMap field_type_map;
FormField::ParseFormFields(fields_.get(), is_form_tag_, &field_type_map);
for (size_t i = 0; i < field_count(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698