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

Side by Side Diff: components/autofill/core/common/form_field_data.cc

Issue 1486173003: Partial revert of "Use std::tie() for operator< in components" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/common/form_field_data.h" 5 #include "components/autofill/core/common/form_field_data.h"
6 6
7 #include <tuple>
8
9 #include "base/pickle.h" 7 #include "base/pickle.h"
10 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
12 10
13 namespace autofill { 11 namespace autofill {
14 12
15 namespace { 13 namespace {
16 14
17 // Increment this anytime pickle format is modified as well as provide 15 // Increment this anytime pickle format is modified as well as provide
18 // deserialization routine from previous kPickleVersion format. 16 // deserialization routine from previous kPickleVersion format.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // The option values/contents which are the list of items in the list 109 // The option values/contents which are the list of items in the list
112 // of a drop-down are currently not considered part of the identity of 110 // of a drop-down are currently not considered part of the identity of
113 // a form element. This is debatable, since one might base heuristics 111 // a form element. This is debatable, since one might base heuristics
114 // on the types of elements that are available. Alternatively, one 112 // on the types of elements that are available. Alternatively, one
115 // could imagine some forms that dynamically change the element 113 // could imagine some forms that dynamically change the element
116 // contents (say, insert years starting from the current year) that 114 // contents (say, insert years starting from the current year) that
117 // should not be considered changes in the structure of the form. 115 // should not be considered changes in the structure of the form.
118 } 116 }
119 117
120 bool FormFieldData::operator<(const FormFieldData& field) const { 118 bool FormFieldData::operator<(const FormFieldData& field) const {
119 // This does not use std::tie() as that generates more implicit variables
120 // than the max-vartrack-size for var-tracking-assignments when compiling
121 // for Android, producing build warnings. (See https://crbug.com/555171 for
122 // context.)
123
121 // Like operator==, this ignores the value. 124 // Like operator==, this ignores the value.
125 if (label < field.label) return true;
126 if (label > field.label) return false;
127 if (name < field.name) return true;
128 if (name > field.name) return false;
129 if (form_control_type < field.form_control_type) return true;
130 if (form_control_type > field.form_control_type) return false;
131 if (autocomplete_attribute < field.autocomplete_attribute) return true;
132 if (autocomplete_attribute > field.autocomplete_attribute) return false;
133 if (max_length < field.max_length) return true;
134 if (max_length > field.max_length) return false;
122 // Skip |is_checked| and |is_autofilled| as in SameFieldAs. 135 // Skip |is_checked| and |is_autofilled| as in SameFieldAs.
136 if (is_checkable < field.is_checkable) return true;
137 if (is_checkable > field.is_checkable) return false;
138 if (is_focusable < field.is_focusable) return true;
139 if (is_focusable > field.is_focusable) return false;
140 if (should_autocomplete < field.should_autocomplete) return true;
141 if (should_autocomplete > field.should_autocomplete) return false;
142 if (role < field.role) return true;
143 if (role > field.role) return false;
144 if (text_direction < field.text_direction) return true;
145 if (text_direction > field.text_direction) return false;
123 // See operator== above for why we don't check option_values/contents. 146 // See operator== above for why we don't check option_values/contents.
124 return std::tie(label, name, form_control_type, autocomplete_attribute, 147 return false;
125 max_length, is_checkable, is_focusable, should_autocomplete,
126 role, text_direction) <
127 std::tie(field.label, field.name, field.form_control_type,
128 field.autocomplete_attribute, field.max_length,
129 field.is_checkable, field.is_focusable,
130 field.should_autocomplete, field.role, field.text_direction);
131 } 148 }
132 149
133 void SerializeFormFieldData(const FormFieldData& field_data, 150 void SerializeFormFieldData(const FormFieldData& field_data,
134 base::Pickle* pickle) { 151 base::Pickle* pickle) {
135 pickle->WriteInt(kPickleVersion); 152 pickle->WriteInt(kPickleVersion);
136 pickle->WriteString16(field_data.label); 153 pickle->WriteString16(field_data.label);
137 pickle->WriteString16(field_data.name); 154 pickle->WriteString16(field_data.name);
138 pickle->WriteString16(field_data.value); 155 pickle->WriteString16(field_data.value);
139 pickle->WriteString(field_data.form_control_type); 156 pickle->WriteString(field_data.form_control_type);
140 pickle->WriteString(field_data.autocomplete_attribute); 157 pickle->WriteString(field_data.autocomplete_attribute);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 << " " << field.autocomplete_attribute << " " << field.max_length 210 << " " << field.autocomplete_attribute << " " << field.max_length
194 << " " << (field.is_autofilled ? "true" : "false") << " " 211 << " " << (field.is_autofilled ? "true" : "false") << " "
195 << (field.is_checked ? "true" : "false") << " " 212 << (field.is_checked ? "true" : "false") << " "
196 << (field.is_checkable ? "true" : "false") << " " 213 << (field.is_checkable ? "true" : "false") << " "
197 << (field.is_focusable ? "true" : "false") << " " 214 << (field.is_focusable ? "true" : "false") << " "
198 << (field.should_autocomplete ? "true" : "false") << " " 215 << (field.should_autocomplete ? "true" : "false") << " "
199 << field.role << " " << field.text_direction; 216 << field.role << " " << field.text_direction;
200 } 217 }
201 218
202 } // namespace autofill 219 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698