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

Unified Diff: Source/core/html/forms/NumberInputType.cpp

Issue 172223003: Input type Number maximum value increase (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reverted back StepRange changes Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/forms/NumberInputType.cpp
diff --git a/Source/core/html/forms/NumberInputType.cpp b/Source/core/html/forms/NumberInputType.cpp
index 53cc2b58516f3b02dde4cc6c8beea79ae087dda3..4a8f7a67cef47ee45bf0abb6e0452cc4ad7d37e7 100644
--- a/Source/core/html/forms/NumberInputType.cpp
+++ b/Source/core/html/forms/NumberInputType.cpp
@@ -123,24 +123,11 @@ double NumberInputType::valueAsDouble() const
void NumberInputType::setValueAsDouble(double newValue, TextFieldEventBehavior eventBehavior, ExceptionState& exceptionState) const
{
- // FIXME: We should use numeric_limits<double>::max for number input type.
- // (NOTE: the range check will not be true for NaN.)
- const double floatMax = numeric_limits<float>::max();
- if (newValue < -floatMax || newValue > floatMax) {
- exceptionState.throwDOMException(InvalidStateError, "The value provided (" + String::number(newValue) + ") is outside the range (" + String::number(-floatMax) + ", " + String::number(floatMax) + ").");
- return;
- }
element().setValue(serializeForNumberType(newValue), eventBehavior);
}
void NumberInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionState& exceptionState) const
{
- // FIXME: We should use numeric_limits<double>::max for number input type.
- const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max());
- if (newValue < -floatMax || newValue > floatMax) {
- exceptionState.throwDOMException(InvalidStateError, "The value provided (" + newValue.toString() + ") is outside the range (-" + floatMax.toString() + ", " + floatMax.toString() + ").");
- return;
- }
element().setValue(serializeForNumberType(newValue), eventBehavior);
}
@@ -158,10 +145,8 @@ bool NumberInputType::typeMismatch() const
StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) const
{
DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numberDefaultStep, numberDefaultStepBase, numberStepScaleFactor));
-
- // FIXME: We should use numeric_limits<double>::max for number input type.
- const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max());
- return InputType::createStepRange(anyStepHandling, numberDefaultStepBase, -floatMax, floatMax, stepDescription);
+ const Decimal doubleMax = Decimal::fromDouble(numeric_limits<double>::max());
+ return InputType::createStepRange(anyStepHandling, numberDefaultStepBase, -doubleMax, doubleMax, stepDescription);
}
bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const
« no previous file with comments | « LayoutTests/fast/forms/number/number-valueasnumber-expected.txt ('k') | Source/core/html/parser/HTMLParserIdioms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698