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

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

Issue 235273003: parsing input type=number should skip spaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated review comments Created 6 years, 8 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
« no previous file with comments | « LayoutTests/fast/forms/number/number-skip-spaces-in-user-input-expected.txt ('k') | 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 /* 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 position += m_decimalSymbols[symbolIndex].length(); 344 position += m_decimalSymbols[symbolIndex].length();
345 return symbolIndex; 345 return symbolIndex;
346 } 346 }
347 } 347 }
348 return DecimalSymbolsSize; 348 return DecimalSymbolsSize;
349 } 349 }
350 350
351 String Locale::convertFromLocalizedNumber(const String& localized) 351 String Locale::convertFromLocalizedNumber(const String& localized)
352 { 352 {
353 initializeLocaleData(); 353 initializeLocaleData();
354 String input = localized.stripWhiteSpace(); 354 String input = localized.removeCharacters(isASCIISpace);
355 if (!m_hasLocaleData || input.isEmpty()) 355 if (!m_hasLocaleData || input.isEmpty())
356 return input; 356 return input;
357 357
358 bool isNegative; 358 bool isNegative;
359 unsigned startIndex; 359 unsigned startIndex;
360 unsigned endIndex; 360 unsigned endIndex;
361 if (!detectSignAndGetDigitRange(input, isNegative, startIndex, endIndex)) 361 if (!detectSignAndGetDigitRange(input, isNegative, startIndex, endIndex))
362 return input; 362 return input;
363 363
364 StringBuilder builder; 364 StringBuilder builder;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds()); 411 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds());
412 break; 412 break;
413 case DateComponents::Invalid: 413 case DateComponents::Invalid:
414 ASSERT_NOT_REACHED(); 414 ASSERT_NOT_REACHED();
415 break; 415 break;
416 } 416 }
417 return builder.toString(); 417 return builder.toString();
418 } 418 }
419 419
420 } 420 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/number/number-skip-spaces-in-user-input-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698