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

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: Added IPC Trait for new attribute 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..bb8c3bd798804492192cb8a055d209d730ee9b3d 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,15 @@ 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 we are dealing with either a
+ // proper <form> or a <form>-less checkout, 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) {
« no previous file with comments | « components/autofill/core/browser/form_structure.h ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698