| Index: Source/core/html/forms/NumberInputType.cpp
|
| diff --git a/Source/core/html/forms/NumberInputType.cpp b/Source/core/html/forms/NumberInputType.cpp
|
| index 152df244f7ee0c6a3046a1a7aa7a61b165bb9231..8212eaebcb57e37390ff5cc08c590d53dd4f6ee7 100644
|
| --- a/Source/core/html/forms/NumberInputType.cpp
|
| +++ b/Source/core/html/forms/NumberInputType.cpp
|
| @@ -165,11 +165,12 @@ bool NumberInputType::typeMismatch() const
|
| StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) const
|
| {
|
| DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numberDefaultStep, numberDefaultStepBase, numberStepScaleFactor));
|
| - const Decimal stepBase = parseToDecimalForNumberType(element().fastGetAttribute(minAttr), numberDefaultStepBase);
|
| +
|
| + const Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), element().fastGetAttribute(valueAttr), numberDefaultStepBase);
|
| // FIXME: We should use numeric_limits<double>::max for number input type.
|
| const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max());
|
| - const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), -floatMax);
|
| - const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), floatMax);
|
| + const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), String(), -floatMax);
|
| + const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), String(), floatMax);
|
| const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
|
| return StepRange(stepBase, minimum, maximum, step, stepDescription);
|
| }
|
| @@ -212,8 +213,15 @@ void NumberInputType::handleKeydownEvent(KeyboardEvent* event)
|
| TextFieldInputType::handleKeydownEvent(event);
|
| }
|
|
|
| -Decimal NumberInputType::parseToNumber(const String& src, const Decimal& defaultValue) const
|
| +Decimal NumberInputType::parseToNumber(const String& src, const String& alternative, const Decimal& defaultValue) const
|
| {
|
| + if (!alternative.isEmpty()) {
|
| + Decimal result = parseToDecimalForNumberType(src, Decimal::nan());
|
| + if (!result.isFinite())
|
| + result = parseToDecimalForNumberType(alternative, defaultValue);
|
| +
|
| + return result;
|
| + }
|
| return parseToDecimalForNumberType(src, defaultValue);
|
| }
|
|
|
|
|