Index: third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp |
diff --git a/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp b/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp |
index 95eab0684df749f6a8b6c9ee8c24530d0792e75b..70920c621fb5cd7f6a46243edbb84e2b9fcac03f 100644 |
--- a/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp |
+++ b/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp |
@@ -157,17 +157,20 @@ void TextFieldInputType::SetValue(const String& sanitized_value, |
else |
GetElement().SetNonAttributeValueByUserEdit(sanitized_value); |
- if (value_changed) |
- GetElement().UpdateView(); |
+ // The following early-return can't be moved to the beginning of this |
+ // function. We need to update non-attribute value even if the value is not |
+ // changed. For example, <input type=number> has a badInput string, that is |
+ // to say, IDL value=="", and new value is "", which should clear the badInput |
+ // string and update validiity. |
+ if (!value_changed) |
+ return; |
+ GetElement().UpdateView(); |
if (selection == TextControlSetValueSelection::kSetSelectionToEnd) { |
unsigned max = VisibleValue().length(); |
GetElement().SetSelectionRange(max, max); |
} |
- if (!value_changed) |
- return; |
- |
switch (event_behavior) { |
case kDispatchChangeEvent: |
// If the user is still editing this field, dispatch an input event rather |