Index: Source/core/html/forms/NumberInputType.cpp |
diff --git a/Source/core/html/forms/NumberInputType.cpp b/Source/core/html/forms/NumberInputType.cpp |
index 6795eb2afdadb6f28da3a8b347cbc6aa90f1c77c..7ceeda8c8394e11f464da0041c41edee3245450e 100644 |
--- a/Source/core/html/forms/NumberInputType.cpp |
+++ b/Source/core/html/forms/NumberInputType.cpp |
@@ -36,6 +36,7 @@ |
#include "core/HTMLNames.h" |
#include "core/InputTypeNames.h" |
#include "core/dom/ExceptionCode.h" |
+#include "core/events/BeforeTextInsertedEvent.h" |
#include "core/events/KeyboardEvent.h" |
#include "core/events/ScopedEventQueue.h" |
#include "core/html/HTMLInputElement.h" |
@@ -188,6 +189,11 @@ void NumberInputType::handleKeydownEvent(KeyboardEvent* event) |
TextFieldInputType::handleKeydownEvent(event); |
} |
+void NumberInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) |
+{ |
+ event->setText(locale().stripInvalidNumberCharacters(event->text(), "0123456789.Ee-+")); |
+} |
+ |
Decimal NumberInputType::parseToNumber(const String& src, const Decimal& defaultValue) const |
{ |
return parseToDecimalForNumberType(src, defaultValue); |