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

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

Issue 679273004: Set element value to its default value on reset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added isReset as a parameter to not allow setValue change value of m_textAsOfLastFormControlChangeE… Created 6 years, 1 month 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/TextFieldInputType.cpp
diff --git a/Source/core/html/forms/TextFieldInputType.cpp b/Source/core/html/forms/TextFieldInputType.cpp
index 93f9b6004e4acb57d7edba40cacd277485a1a5b1..780ffa7a784717c7572986e9acb7f703a127994f 100644
--- a/Source/core/html/forms/TextFieldInputType.cpp
+++ b/Source/core/html/forms/TextFieldInputType.cpp
@@ -146,7 +146,7 @@ bool TextFieldInputType::canSetSuggestedValue()
return true;
}
-void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior)
+void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChanged, bool isReset, TextFieldEventBehavior eventBehavior)
{
// Grab this input element to keep reference even if JS event handler
// changes input type.
@@ -154,7 +154,7 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange
// We don't ask InputType::setValue to dispatch events because
// TextFieldInputType dispatches events different way from InputType.
- InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent);
+ InputType::setValue(sanitizedValue, valueChanged, isReset, DispatchNoEvent);
if (valueChanged)
input->updateView();
@@ -188,7 +188,7 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange
break;
}
- if (!input->focused())
+ if (!input->focused() && !isReset)
input->setTextAsOfLastFormControlChangeEvent(sanitizedValue);
}
« Source/core/html/HTMLInputElement.cpp ('K') | « Source/core/html/forms/TextFieldInputType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698