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

Side by Side Diff: third_party/WebKit/Source/platform/text/PlatformLocale.cpp

Issue 2738463003: <input type=number>: accept localized digits without showing them. (Closed)
Patch Set: Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2011,2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011,2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 builder.append(static_cast<UChar>('0' + symbolIndex)); 405 builder.append(static_cast<UChar>('0' + symbolIndex));
406 } 406 }
407 String converted = builder.toString(); 407 String converted = builder.toString();
408 // Ignore trailing '.', but will reject '.'-only string later. 408 // Ignore trailing '.', but will reject '.'-only string later.
409 if (converted.length() >= 2 && converted[converted.length() - 1] == '.') 409 if (converted.length() >= 2 && converted[converted.length() - 1] == '.')
410 converted = converted.left(converted.length() - 1); 410 converted = converted.left(converted.length() - 1);
411 return converted; 411 return converted;
412 } 412 }
413 413
414 String Locale::stripInvalidNumberCharacters(const String& input, 414 String Locale::stripInvalidNumberCharacters(const String& input,
415 const String& standardChars) const { 415 const String& standardChars) {
416 initializeLocaleData();
416 StringBuilder builder; 417 StringBuilder builder;
417 builder.reserveCapacity(input.length()); 418 builder.reserveCapacity(input.length());
418 for (unsigned i = 0; i < input.length(); ++i) { 419 for (unsigned i = 0; i < input.length(); ++i) {
419 UChar ch = input[i]; 420 UChar ch = input[i];
420 if (standardChars.find(ch) != kNotFound) 421 if (standardChars.find(ch) != kNotFound)
421 builder.append(ch); 422 builder.append(ch);
422 else if (m_acceptableNumberCharacters.find(ch) != kNotFound) 423 else if (m_acceptableNumberCharacters.find(ch) != kNotFound)
423 builder.append(ch); 424 builder.append(ch);
424 } 425 }
425 return builder.toString(); 426 return builder.toString();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 : dateTimeFormatWithSeconds()); 459 : dateTimeFormatWithSeconds());
459 break; 460 break;
460 case DateComponents::Invalid: 461 case DateComponents::Invalid:
461 ASSERT_NOT_REACHED(); 462 ASSERT_NOT_REACHED();
462 break; 463 break;
463 } 464 }
464 return builder.toString(); 465 return builder.toString();
465 } 466 }
466 467
467 } // namespace blink 468 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698