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

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

Issue 734983006: Autofill - Fix Harry and David checkout: ignore role="presentation" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum Created 6 years 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_field.cc
diff --git a/components/autofill/core/browser/form_field.cc b/components/autofill/core/browser/form_field.cc
index b25ff2b44f72d6bd9a62fdb1ce02678e3f124ada..d5b4fe6d2447678141a7afd9633faaee5bb85f21 100644
--- a/components/autofill/core/browser/form_field.cc
+++ b/components/autofill/core/browser/form_field.cc
@@ -27,8 +27,14 @@
namespace autofill {
namespace {
-bool IsCheckable(const AutofillField* field) {
- return field->is_checkable;
+bool ShouldBeIgnored(const AutofillField* field) {
+ // Ignore checkable fields as they interfere with parsers assuming context.
+ // Eg., while parsing address, "Is PO box" checkbox after ADDRESS_LINE1
+ // interferes with correctly understanding ADDRESS_LINE2.
+ // Ignore fields marked as presentational. See
+ // http://www.w3.org/TR/wai-aria/roles#presentation
+ return field->is_checkable ||
+ field->role == FormFieldData::ROLE_ATTRIBUTE_PRESENTATION;
}
} // namespace
@@ -40,12 +46,9 @@ void FormField::ParseFormFields(const std::vector<AutofillField*>& fields,
std::vector<AutofillField*> remaining_fields(fields.size());
std::copy(fields.begin(), fields.end(), remaining_fields.begin());
- // Ignore checkable fields as they interfere with parsers assuming context.
- // Eg., while parsing address, "Is PO box" checkbox after ADDRESS_LINE1
- // interferes with correctly understanding ADDRESS_LINE2.
remaining_fields.erase(
std::remove_if(remaining_fields.begin(), remaining_fields.end(),
- IsCheckable),
+ ShouldBeIgnored),
remaining_fields.end());
// Email pass.
« no previous file with comments | « components/autofill/content/renderer/form_autofill_util.cc ('k') | components/autofill/core/common/form_field_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698