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

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

Issue 149413004: HTMLInputElement.valueAsNumber compliance (NaN handling.) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 e2d90015378aa6df3ec32ca6067ddcd64147ba9b..53cc2b58516f3b02dde4cc6c8beea79ae087dda3 100644
--- a/Source/core/html/forms/NumberInputType.cpp
+++ b/Source/core/html/forms/NumberInputType.cpp
@@ -124,6 +124,7 @@ 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) + ").");

Powered by Google App Engine
This is Rietveld 408576698