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

Side by Side Diff: components/autofill/core/browser/phone_field.cc

Issue 1615003002: Fix behavior of HTMLInputElement.maxLength/minLength getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to fix interactive tests 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 unified diff | Download patch
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/browser/phone_field.h" 5 #include "components/autofill/core/browser/phone_field.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // Attempt to parse according to the next grammar. 145 // Attempt to parse according to the next grammar.
146 for (; i < arraysize(kPhoneFieldGrammars) && 146 for (; i < arraysize(kPhoneFieldGrammars) &&
147 kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR; ++i) { 147 kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR; ++i) {
148 if (!ParsePhoneField( 148 if (!ParsePhoneField(
149 scanner, 149 scanner,
150 GetRegExp(kPhoneFieldGrammars[i].regex), 150 GetRegExp(kPhoneFieldGrammars[i].regex),
151 &parsed_fields[kPhoneFieldGrammars[i].phone_part])) 151 &parsed_fields[kPhoneFieldGrammars[i].phone_part]))
152 break; 152 break;
153 if (kPhoneFieldGrammars[i].max_size && 153 if (kPhoneFieldGrammars[i].max_size &&
154 (!parsed_fields[kPhoneFieldGrammars[i].phone_part]->max_length || 154 (parsed_fields[kPhoneFieldGrammars[i].phone_part]->max_length <= 0 ||
155 kPhoneFieldGrammars[i].max_size < 155 kPhoneFieldGrammars[i].max_size <
156 parsed_fields[kPhoneFieldGrammars[i].phone_part]->max_length)) { 156 parsed_fields[kPhoneFieldGrammars[i].phone_part]->max_length)) {
157 break; 157 break;
158 } 158 }
159 } 159 }
160 160
161 if (i >= arraysize(kPhoneFieldGrammars)) { 161 if (i >= arraysize(kPhoneFieldGrammars)) {
162 scanner->RewindTo(saved_cursor); 162 scanner->RewindTo(saved_cursor);
163 return nullptr; // Parsing failed. 163 return nullptr; // Parsing failed.
164 } 164 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bool PhoneField::ParsePhoneField(AutofillScanner* scanner, 288 bool PhoneField::ParsePhoneField(AutofillScanner* scanner,
289 const std::string& regex, 289 const std::string& regex,
290 AutofillField** field) { 290 AutofillField** field) {
291 return ParseFieldSpecifics(scanner, 291 return ParseFieldSpecifics(scanner,
292 base::UTF8ToUTF16(regex), 292 base::UTF8ToUTF16(regex),
293 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER, 293 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER,
294 field); 294 field);
295 } 295 }
296 296
297 } // namespace autofill 297 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698