Changeset 107196 in webkit
- Timestamp:
- Feb 9, 2012 1:33:54 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r107190 r107196 1 2012-02-09 Kent Tamura <tkent@chromium.org> 2 3 Do not localize numbers in scientific notation 4 https://bugs.webkit.org/show_bug.cgi?id=78208 5 6 Reviewed by Hajime Morita. 7 8 * ManualTests/input-number-localization.html: Updated for scientific notation. 9 1 10 2012-02-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 11 -
trunk/ManualTests/input-number-localization.html
r91636 r107196 13 13 <div id="console"></div> 14 14 15 <p>Output test : The following text field should have a localized representation for "-1234.5678".15 <p>Output test 1: The following text field should have a localized representation for "-1234.5678". 16 16 e.g. "-1234.5678" for en_US locale, "-1234,5678" for fr_FR locale. The thousand separator is 17 17 currently off.</p> 18 18 <div><input type=number value="-1234.5678" step=any></div> 19 19 20 <p>Input test: Type a localized representation of a number (e.g. -1,234.5678 for en_US locale, 20 <p>Output test 2: The following text field should have "-1234.5678E+12" in any locale. 21 </p> 22 <div><input type=number value="-1234.5678E+12" step=any></div> 23 24 <p>Input test 1: Type a localized representation of a number (e.g. -1,234.5678 for en_US locale, 21 25 -1.234,5678 for fr_FR locale) into the following text field. 22 26 You'll see an equivalent number in the standard format on the bottom of the text field.</p> 27 <p>Input test 2: Type a number in the scientific notation (e.g. 0.1234e-10.) 28 You'll see the same number string on the bottom of the text field.</p> 23 29 <div><input type=number id=target step=any oninput="handleInput()"></div> 24 30 <div>Standard format: <output id=output></output></div> -
trunk/Source/WebCore/ChangeLog
r107194 r107196 1 2012-02-09 Kent Tamura <tkent@chromium.org> 2 3 Do not localize numbers in scientific notation 4 https://bugs.webkit.org/show_bug.cgi?id=78208 5 6 Reviewed by Hajime Morita. 7 8 For a preparation of fixing http://wkb.ug/62939, we stop supporting 9 localized numbers in scientific notation in <input type=number>. 10 11 We're going to change number localization processing so that it replaces 12 letters one by one. It will be very hard to support scientific notation. 13 14 * html/NumberInputType.cpp: 15 (WebCore::isE): A helper functio for String::find() to detect scientific notation. 16 (WebCore::NumberInputType::visibleValue): Avoid localization for scientific notation. 17 (WebCore::NumberInputType::convertFromVisibleValue): ditto. 18 (WebCore::NumberInputType::isAcceptableValue): 19 Use convertFromVisibleValue, also stop accepting a standard format as a fallback. 20 1 21 2012-02-09 Leo Yang <leo.yang@torchmobile.com.cn> 2 22 -
trunk/Source/WebCore/html/NumberInputType.cpp
r105490 r107196 284 284 } 285 285 286 static bool isE(UChar ch) 287 { 288 return ch == 'e' || ch == 'E'; 289 } 290 286 291 String NumberInputType::visibleValue() const 287 292 { 288 293 String currentValue = element()->value(); 289 294 if (currentValue.isEmpty()) 295 return currentValue; 296 // We don't localize scientific notations. 297 if (currentValue.find(isE) != notFound) 290 298 return currentValue; 291 299 // FIXME: The following three lines should be removed when we … … 301 309 if (visibleValue.isEmpty()) 302 310 return visibleValue; 311 // We don't localize scientific notations. 312 if (visibleValue.find(isE) != notFound) 313 return visibleValue; 303 314 return convertFromLocalizedNumber(visibleValue); 304 315 } … … 306 317 bool NumberInputType::isAcceptableValue(const String& proposedValue) 307 318 { 308 return proposedValue.isEmpty() || parseToDoubleForNumberType(convertFromLocalizedNumber(proposedValue), 0) || parseToDoubleForNumberType(proposedValue, 0); 319 String standardValue = convertFromVisibleValue(proposedValue); 320 return standardValue.isEmpty() || parseToDoubleForNumberType(standardValue, 0); 309 321 } 310 322
Note: See TracChangeset
for help on using the changeset viewer.