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

Unified Diff: third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp

Issue 2796853002: Update text field 'change' event logic to match to Firefox. (Closed)
Patch Set: . Created 3 years, 8 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
Index: third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
index 5b436119ae4ca7c02e7181b50541c2853528dd11..39713f4702cc8abefe62aacfa0754938bb5a73b2 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp
@@ -285,8 +285,9 @@ void HTMLTextAreaElement::subtreeHasChanged() {
}
#endif
addPlaceholderBreakElementIfNecessary();
- setChangedSinceLastFormControlChangeEvent(true);
+ setValueBeforeFirstUserEditIfNotSet();
updateValue();
+ checkIfValueWasReverted(value());
setNeedsValidityCheck();
setAutofilled(false);
updatePlaceholderVisibility();
@@ -400,10 +401,14 @@ void HTMLTextAreaElement::setValueCommon(
if (normalizedValue == value())
return;
+ if (eventBehavior != DispatchNoEvent)
+ setValueBeforeFirstUserEditIfNotSet();
m_value = normalizedValue;
setInnerEditorValue(m_value);
if (eventBehavior == DispatchNoEvent)
setLastChangeWasNotUserEdit();
+ else
+ checkIfValueWasReverted(m_value);
updatePlaceholderVisibility();
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(
StyleChangeReason::ControlValue));
@@ -428,11 +433,6 @@ void HTMLTextAreaElement::setValueCommon(
break;
case DispatchNoEvent:
- // We need to update textAsOfLastFormControlChangeEvent for |value| IDL
- // setter without focus because input-assist features use setValue("...",
- // DispatchChangeEvent) without setting focus.
- if (!isFocused())
- setTextAsOfLastFormControlChangeEvent(normalizedValue);
break;
}
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | third_party/WebKit/Source/core/html/TextControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698