This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse the repository at this point in the history
Do not reformat strings in <input type=number> on platforms using Loc…
…alizedNumberICU. https://bugs.webkit.org/show_bug.cgi?id=78326 Reviewed by Hajime Morita. Source/WebCore: We had bugs such as stripping leading zeros, dropping lower digits of large numbers because we parse a user-input string to a double value, and generate a string from the double value. In order to avoid such reformatting, we converts number strings by replacing standard digits to corresponding localized digits. * WebCore.gypi: Added LocalizedNumberICU.h * platform/text/LocalizedNumberICU.cpp: (WebCore::ICULocale::ICULocale): Added. (WebCore::ICULocale::create): A testing factory function. (WebCore::ICULocale::createForCurrentLocale): A practical factory function. (WebCore::ICULocale::setDecimalSymbol): Initialize a symbol table. (WebCore::ICULocale::initializeDecimalFormat): Initialize ICU DecimalFormat. (WebCore::ICULocale::convertToLocalizedNumber): Replace characters to corresponding localized characters. (WebCore::matches): A helper function for convertFromLocalizedNumber. (WebCore::endsWith): ditto. (WebCore::ICULocale::determineStartPosition): ditto. (WebCore::ICULocale::matchedDecimalSymbolIndex): ditto. (WebCore::ICULocale::convertFromLocalizedNumber): Replace characters to corresponding standard characters. (WebCore::currentLocale): Added. (WebCore::convertToLocalizedNumber): Uses ICULocale::convertToLocalizedNumber. (WebCore::convertFromLocalizedNumber): Uses ICULocale::convertFromLocalizedNumber. * platform/text/LocalizedNumberICU.h: Added. (ICULocale): Added. This is exposed to WebKit/chromium/tests/LocalizedNumberICUTest.cpp. Source/WebKit/chromium: Add a test for WebCore/platform/text/LocalizedNumberICU. * WebKit.gypi: Added LocalizedNumberICUTest.cpp * tests/LocalizedNumberICUTest.cpp: Added. LayoutTests: * platform/chromium/test_expectations.txt: Need to do rebaseline for fast/speech/input-appearance-numberandspeech.html because the number rounding issue is fixed. Canonical link: https://commits.webkit.org/97514@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing 9 changed files with 414 additions and 66 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions 12 LayoutTests/ChangeLog
35 changes: 35 additions & 0 deletions 35 Source/WebCore/ChangeLog
Oops, something went wrong.