- Revision
- 124998
- Author
- [email protected]
- Date
- 2012-08-07 23:49:04 -0700 (Tue, 07 Aug 2012)
Log Message
Remove fractionDigits argument of WebCore::convertToLocalizedNumber()
https://bugs.webkit.org/show_bug.cgi?id=93435
Reviewed by Kentaro Hara.
Remove the fractionDigits argument of convertToLocalizedNumber because
we don't use it any more. Also, we can remove
parseToDoubleForNumberTypeWithDecimalPlaces() functions, which are used
to obtain the fractionDigits argument.
No new tests because of no behavior changes.
* platform/text/LocalizedNumber.h:
(WebCore): Remove the fractionDigits argument of convertToLocalizedNumber.
* platform/text/LocalizedNumberICU.cpp:
(WebCore::convertToLocalizedNumber): ditto.
* platform/text/LocalizedNumberNone.cpp:
(WebCore::convertToLocalizedNumber): ditto.
* platform/text/mac/LocalizedNumberMac.mm:
(WebCore::convertToLocalizedNumber): ditto.
* platform/text/win/LocalizedNumberWin.cpp:
(WebCore::convertToLocalizedNumber): ditto.
* html/NumberInputType.cpp:
(WebCore::NumberInputType::localizeValue):
Remove the code to make the decimalPlace value.
* html/parser/HTMLParserIdioms.cpp:
Remove parseToDoubleForNumberTypeWithDecimalPlaces.
* html/parser/HTMLParserIdioms.h: ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (124997 => 124998)
--- trunk/Source/WebCore/ChangeLog 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/ChangeLog 2012-08-08 06:49:04 UTC (rev 124998)
@@ -1,3 +1,35 @@
+2012-08-07 Kent Tamura <[email protected]>
+
+ Remove fractionDigits argument of WebCore::convertToLocalizedNumber()
+ https://bugs.webkit.org/show_bug.cgi?id=93435
+
+ Reviewed by Kentaro Hara.
+
+ Remove the fractionDigits argument of convertToLocalizedNumber because
+ we don't use it any more. Also, we can remove
+ parseToDoubleForNumberTypeWithDecimalPlaces() functions, which are used
+ to obtain the fractionDigits argument.
+
+ No new tests because of no behavior changes.
+
+ * platform/text/LocalizedNumber.h:
+ (WebCore): Remove the fractionDigits argument of convertToLocalizedNumber.
+ * platform/text/LocalizedNumberICU.cpp:
+ (WebCore::convertToLocalizedNumber): ditto.
+ * platform/text/LocalizedNumberNone.cpp:
+ (WebCore::convertToLocalizedNumber): ditto.
+ * platform/text/mac/LocalizedNumberMac.mm:
+ (WebCore::convertToLocalizedNumber): ditto.
+ * platform/text/win/LocalizedNumberWin.cpp:
+ (WebCore::convertToLocalizedNumber): ditto.
+
+ * html/NumberInputType.cpp:
+ (WebCore::NumberInputType::localizeValue):
+ Remove the code to make the decimalPlace value.
+ * html/parser/HTMLParserIdioms.cpp:
+ Remove parseToDoubleForNumberTypeWithDecimalPlaces.
+ * html/parser/HTMLParserIdioms.h: ditto.
+
2012-08-08 Mario Sanchez Prada <[email protected]>
REGRESSION(r65062): out of bound access in TextIterator (5 editing tests) on GTK
Modified: trunk/Source/WebCore/html/NumberInputType.cpp (124997 => 124998)
--- trunk/Source/WebCore/html/NumberInputType.cpp 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/html/NumberInputType.cpp 2012-08-08 06:49:04 UTC (rev 124998)
@@ -239,13 +239,7 @@
// We don't localize scientific notations.
if (proposedValue.find(isE) != notFound)
return proposedValue;
- // FIXME: The following three lines should be removed when we
- // remove the second argument of convertToLocalizedNumber().
- // Note: parseToDoubleForNumberTypeWithDecimalPlaces set zero to decimalPlaces
- // if currentValue isn't valid floating pointer number.
- unsigned decimalPlace;
- parseToDoubleForNumberTypeWithDecimalPlaces(proposedValue, &decimalPlace);
- return convertToLocalizedNumber(proposedValue, decimalPlace);
+ return convertToLocalizedNumber(proposedValue);
}
String NumberInputType::visibleValue() const
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (124997 => 124998)
--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp 2012-08-08 06:49:04 UTC (rev 124998)
@@ -152,84 +152,6 @@
return parseToDoubleForNumberType(string, std::numeric_limits<double>::quiet_NaN());
}
-double parseToDoubleForNumberTypeWithDecimalPlaces(const String& string, unsigned *decimalPlaces, double fallbackValue)
-{
- if (decimalPlaces)
- *decimalPlaces = 0;
-
- double value = parseToDoubleForNumberType(string, std::numeric_limits<double>::quiet_NaN());
- if (!isfinite(value))
- return fallbackValue;
-
- if (!decimalPlaces)
- return value;
-
- size_t dotIndex = string.find('.');
- size_t eIndex = string.find('e');
- if (eIndex == notFound)
- eIndex = string.find('E');
-
- unsigned baseDecimalPlaces = 0;
- if (dotIndex != notFound) {
- if (eIndex == notFound)
- baseDecimalPlaces = string.length() - dotIndex - 1;
- else
- baseDecimalPlaces = eIndex - dotIndex - 1;
- }
-
- int exponent = 0;
- if (eIndex != notFound) {
- unsigned cursor = eIndex + 1, cursorSaved;
- int digit, exponentSign;
- int32_t exponent32;
- size_t length = string.length();
-
- // Not using String.toInt() in order to perform the same computation as dtoa() does.
- exponentSign = 0;
- switch (digit = string[cursor]) {
- case '-':
- exponentSign = 1;
- case '+':
- digit = string[++cursor];
- }
- if (digit >= '0' && digit <= '9') {
- while (cursor < length && digit == '0')
- digit = string[++cursor];
- if (digit > '0' && digit <= '9') {
- exponent32 = digit - '0';
- cursorSaved = cursor;
- while (cursor < length && (digit = string[++cursor]) >= '0' && digit <= '9')
- exponent32 = (10 * exponent32) + digit - '0';
- if (cursor - cursorSaved > 8 || exponent32 > 19999)
- /* Avoid confusion from exponents
- * so large that e might overflow.
- */
- exponent = 19999; /* safe for 16 bit ints */
- else
- exponent = static_cast<int>(exponent32);
- if (exponentSign)
- exponent = -exponent;
- } else
- exponent = 0;
- }
- }
-
- int intDecimalPlaces = baseDecimalPlaces - exponent;
- if (intDecimalPlaces < 0)
- *decimalPlaces = 0;
- else if (intDecimalPlaces > 19999)
- *decimalPlaces = 19999;
- else
- *decimalPlaces = static_cast<unsigned>(intDecimalPlaces);
-
- return value;
-}
-
-double parseToDoubleForNumberTypeWithDecimalPlaces(const String& string, unsigned *decimalPlaces)
-{
- return parseToDoubleForNumberTypeWithDecimalPlaces(string, decimalPlaces, std::numeric_limits<double>::quiet_NaN());
-}
-
// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers
bool parseHTMLInteger(const String& input, int& value)
{
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (124997 => 124998)
--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h 2012-08-08 06:49:04 UTC (rev 124998)
@@ -51,8 +51,6 @@
Decimal parseToDecimalForNumberType(const String&, const Decimal& fallbackValue);
double parseToDoubleForNumberType(const String&);
double parseToDoubleForNumberType(const String&, double fallbackValue);
-double parseToDoubleForNumberTypeWithDecimalPlaces(const String&, unsigned*);
-double parseToDoubleForNumberTypeWithDecimalPlaces(const String&, unsigned*, double fallbackValue);
// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers
bool parseHTMLInteger(const String&, int&);
Modified: trunk/Source/WebCore/platform/text/LocalizedNumber.h (124997 => 124998)
--- trunk/Source/WebCore/platform/text/LocalizedNumber.h 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/platform/text/LocalizedNumber.h 2012-08-08 06:49:04 UTC (rev 124998)
@@ -37,10 +37,8 @@
// Converts the specified number string to another number string
// localized for the browser's current locale. The input string must
-// conform to HTML floating-point numbers, and is not empty. The
-// fractionDigits argument is deprecated. The function implementaion
-// should not use the argument.
-String convertToLocalizedNumber(const String&, unsigned fractionDigits);
+// conform to HTML floating-point numbers, and is not empty.
+String convertToLocalizedNumber(const String&);
// Converts the specified localized number string to a number string
// in the HTML floating-point number format. The input string is
Modified: trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp (124997 => 124998)
--- trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp 2012-08-08 06:49:04 UTC (rev 124998)
@@ -35,7 +35,7 @@
namespace WebCore {
-String convertToLocalizedNumber(const String& canonicalNumberString, unsigned fractionDigits)
+String convertToLocalizedNumber(const String& canonicalNumberString)
{
return LocaleICU::currentLocale()->convertToLocalizedNumber(canonicalNumberString);
}
Modified: trunk/Source/WebCore/platform/text/LocalizedNumberNone.cpp (124997 => 124998)
--- trunk/Source/WebCore/platform/text/LocalizedNumberNone.cpp 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/platform/text/LocalizedNumberNone.cpp 2012-08-08 06:49:04 UTC (rev 124998)
@@ -37,7 +37,7 @@
namespace WebCore {
-String convertToLocalizedNumber(const String& canonicalNumberString, unsigned)
+String convertToLocalizedNumber(const String& canonicalNumberString)
{
return canonicalNumberString;
}
Modified: trunk/Source/WebCore/platform/text/mac/LocalizedNumberMac.mm (124997 => 124998)
--- trunk/Source/WebCore/platform/text/mac/LocalizedNumberMac.mm 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/platform/text/mac/LocalizedNumberMac.mm 2012-08-08 06:49:04 UTC (rev 124998)
@@ -35,7 +35,7 @@
namespace WebCore {
-String convertToLocalizedNumber(const String& canonicalNumberString, unsigned)
+String convertToLocalizedNumber(const String& canonicalNumberString)
{
return LocaleMac::currentLocale()->convertToLocalizedNumber(canonicalNumberString);
}
Modified: trunk/Source/WebCore/platform/text/win/LocalizedNumberWin.cpp (124997 => 124998)
--- trunk/Source/WebCore/platform/text/win/LocalizedNumberWin.cpp 2012-08-08 06:47:46 UTC (rev 124997)
+++ trunk/Source/WebCore/platform/text/win/LocalizedNumberWin.cpp 2012-08-08 06:49:04 UTC (rev 124998)
@@ -30,7 +30,7 @@
namespace WebCore {
-String convertToLocalizedNumber(const String& canonicalNumberString, unsigned fractionDigits)
+String convertToLocalizedNumber(const String& canonicalNumberString)
{
return LocaleWin::currentLocale()->convertToLocalizedNumber(canonicalNumberString);
}