Bug 1004327 - Don't limit the number of significant fractional digits for <input type=number>. r=bz

This commit is contained in:
Jonathan Watt 2014-05-02 10:25:40 +01:00
parent 7d2eb4e7b5
commit 5c947c8bd5
4 changed files with 30 additions and 0 deletions

View File

@ -108,6 +108,10 @@ ICUUtils::LocalizeNumber(double aValue,
langTag.get(), nullptr, &status));
unum_setAttribute(format, UNUM_GROUPING_USED,
LocaleNumberGroupingIsEnabled());
// ICU default is a maximum of 3 significant fractional digits. We don't
// want that limit, so we set it to the maximum that a double can represent
// (14-16 decimal fractional digits).
unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, 16);
int32_t length = unum_formatDouble(format, aValue, buffer, kBufferSize,
nullptr, &status);
NS_ASSERTION(length < kBufferSize &&

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<input type="number" value="1.00100000000001" style="width:100%;">
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script>
document.addEventListener("MozReftestInvalidate", function() {
document.getElementById("i").stepUp();
document.documentElement.className = "";
}, false);
</script>
</head>
<body>
<input id="i" type="number" value="1.001" step="0.00000000000001"
style="width:100%;">
</body>
</html>

View File

@ -29,6 +29,9 @@ skip-if(B2G||Android) == number-min-height-2.html number-min-height-2-ref.html
skip-if(B2G||Android) == number-max-height-1.html number-max-height-1-ref.html
skip-if(B2G||Android) == number-max-height-2.html number-max-height-2-ref.html
# number of significant fractional digits:
== number-significant-fractional-digits.html number-significant-fractional-digits-ref.html
# focus
# autofocus is disabled on B2G
# https://bugzilla.mozilla.org/show_bug.cgi?id=965763