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

Unified Diff: components/autofill/core/common/form_field_data.cc

Issue 1459973005: Reland of Use std::tie() for operator< in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/common/form_field_data.cc
diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc
index 1ae34468eb39fe9399852ca1c55aa835b28acb5f..54db610c7b549eddee2eaa9f717e83b4677d52af 100644
--- a/components/autofill/core/common/form_field_data.cc
+++ b/components/autofill/core/common/form_field_data.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "components/autofill/core/common/form_field_data.h"
+
+#include <tuple>
#include "base/pickle.h"
#include "base/strings/string_util.h"
@@ -117,29 +119,15 @@
bool FormFieldData::operator<(const FormFieldData& field) const {
// Like operator==, this ignores the value.
- if (label < field.label) return true;
- if (label > field.label) return false;
- if (name < field.name) return true;
- if (name > field.name) return false;
- if (form_control_type < field.form_control_type) return true;
- if (form_control_type > field.form_control_type) return false;
- if (autocomplete_attribute < field.autocomplete_attribute) return true;
- if (autocomplete_attribute > field.autocomplete_attribute) return false;
- if (max_length < field.max_length) return true;
- if (max_length > field.max_length) return false;
// Skip |is_checked| and |is_autofilled| as in SameFieldAs.
- if (is_checkable < field.is_checkable) return true;
- if (is_checkable > field.is_checkable) return false;
- if (is_focusable < field.is_focusable) return true;
- if (is_focusable > field.is_focusable) return false;
- if (should_autocomplete < field.should_autocomplete) return true;
- if (should_autocomplete > field.should_autocomplete) return false;
- if (role < field.role) return true;
- if (role > field.role) return false;
- if (text_direction < field.text_direction) return true;
- if (text_direction > field.text_direction) return false;
// See operator== above for why we don't check option_values/contents.
- return false;
+ return std::tie(label, name, form_control_type, autocomplete_attribute,
+ max_length, is_checkable, is_focusable, should_autocomplete,
+ role, text_direction) <
+ std::tie(field.label, field.name, field.form_control_type,
+ field.autocomplete_attribute, field.max_length,
+ field.is_checkable, field.is_focusable,
+ field.should_autocomplete, field.role, field.text_direction);
}
void SerializeFormFieldData(const FormFieldData& field_data,
« no previous file with comments | « components/autofill/core/common/form_data.cc ('k') | components/autofill/core/common/password_form_fill_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698