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

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

Issue 1100273002: input[type=number] UI should reject invalid characters. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/forms/NumberInputType.cpp ('k') | Source/platform/text/PlatformLocale.cpp » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 String convertToLocalizedNumber(const String&); 52 String convertToLocalizedNumber(const String&);
53 53
54 // Converts the specified localized number string to a number string in the 54 // Converts the specified localized number string to a number string in the
55 // HTML floating-point number format. The input string is provided by a end 55 // HTML floating-point number format. The input string is provided by a end
56 // user, and might not be a number string. It's ok that the function returns 56 // user, and might not be a number string. It's ok that the function returns
57 // a string which is not conforms to the HTML floating-point number format, 57 // a string which is not conforms to the HTML floating-point number format,
58 // callers of this function are responsible to check the format of the 58 // callers of this function are responsible to check the format of the
59 // resultant string. 59 // resultant string.
60 String convertFromLocalizedNumber(const String&); 60 String convertFromLocalizedNumber(const String&);
61 61
62 // Remove characters from |input| if a character is not included in
63 // locale-specific number characters and |standardChars|.
64 String stripInvalidNumberCharacters(const String& input, const String& stand ardChars) const;
65
62 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 66 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
63 // Returns localized decimal separator, e.g. "." for English, "," for French . 67 // Returns localized decimal separator, e.g. "." for English, "," for French .
64 String localizedDecimalSeparator(); 68 String localizedDecimalSeparator();
65 #endif 69 #endif
66 70
67 // Returns date format in Unicode TR35 LDML[1] containing day of month, 71 // Returns date format in Unicode TR35 LDML[1] containing day of month,
68 // month, and year, e.g. "dd/mm/yyyy" 72 // month, and year, e.g. "dd/mm/yyyy"
69 // [1] LDML http://unicode.org/reports/tr35/#Date_Format_Patterns 73 // [1] LDML http://unicode.org/reports/tr35/#Date_Format_Patterns
70 virtual String dateFormat() = 0; 74 virtual String dateFormat() = 0;
71 75
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 159
156 private: 160 private:
157 bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsig ned& startIndex, unsigned& endIndex); 161 bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsig ned& startIndex, unsigned& endIndex);
158 unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position); 162 unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position);
159 163
160 String m_decimalSymbols[DecimalSymbolsSize]; 164 String m_decimalSymbols[DecimalSymbolsSize];
161 String m_positivePrefix; 165 String m_positivePrefix;
162 String m_positiveSuffix; 166 String m_positiveSuffix;
163 String m_negativePrefix; 167 String m_negativePrefix;
164 String m_negativeSuffix; 168 String m_negativeSuffix;
169 String m_acceptableNumberCharacters;
165 bool m_hasLocaleData; 170 bool m_hasLocaleData;
166 }; 171 };
167 172
168 } // namespace blink 173 } // namespace blink
169 #endif 174 #endif
OLDNEW
« no previous file with comments | « Source/core/html/forms/NumberInputType.cpp ('k') | Source/platform/text/PlatformLocale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698