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

Unified Diff: Source/core/html/HTMLInputElement.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/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index d0704564663d4357c2add46e8a78209cd188920e..e021d95f01f13d01231d84efcce40d9cfc6d7c2c 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -839,7 +839,7 @@ String HTMLInputElement::resultForDialogSubmit()
void HTMLInputElement::resetImpl()
{
if (m_inputType->storesValueSeparateFromAttribute()) {
- setValue(String());
+ setValue(String(), DispatchNoEvent, true);
setNeedsValidityCheck();
}
@@ -1009,7 +1009,7 @@ void HTMLInputElement::setValue(const String& value, ExceptionState& exceptionSt
setValue(value, eventBehavior);
}
-void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior eventBehavior)
+void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior eventBehavior, bool isReset)
{
m_inputType->warnIfValueIsInvalidAndElementIsVisible(value);
if (!m_inputType->canSetValue(value))
@@ -1024,9 +1024,9 @@ void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
m_needsToUpdateViewValue = true;
m_suggestedValue = String(); // Prevent TextFieldInputType::setValue from using the suggested value.
- m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior);
+ m_inputType->setValue(sanitizedValue, valueChanged, isReset, eventBehavior);
- if (valueChanged && eventBehavior == DispatchNoEvent)
+ if (valueChanged && eventBehavior == DispatchNoEvent && !isReset)
tkent 2014/11/06 00:11:16 Skipping setTextAsOfLastFormControlChangeEvent doe
Habib Virji 2014/11/06 14:23:08 <input type=text value=seed> During HTMLParsing, v
tkent 2014/11/07 00:34:19 Ok, HTMLTextFormControlElement::insertedInto() doe
Habib Virji 2014/11/07 14:10:43 Thanks above suggested change does work and looks
setTextAsOfLastFormControlChangeEvent(sanitizedValue);
if (!valueChanged)

Powered by Google App Engine
This is Rietveld 408576698