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

Unified Diff: third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp

Issue 2884603002: INPUT element: Do not update selectionStart/selectionEnd on |value| IDL setter if the new value is … (Closed)
Patch Set: . Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698