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

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

Issue 215903003: Autofill/rAc: dispatch "input" events when changing text contents of <textarea>, (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add back dispatchFormControlChangeEvent() temporarily to not break chrome when blink gets rolled in Created 6 years, 9 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 | « Source/core/html/HTMLTextAreaElement.h ('k') | Source/web/WebFormControlElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTextAreaElement.cpp
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 210fb8f2418dbd0f1b04d3ea2847e7249719dcd0..db75ffa9de3ebe90d9d8732e6db350c38fae70b4 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -337,21 +337,21 @@ String HTMLTextAreaElement::value() const
return m_value;
}
-void HTMLTextAreaElement::setValue(const String& value)
+void HTMLTextAreaElement::setValue(const String& value, TextFieldEventBehavior eventBehavior)
{
- setValueCommon(value);
+ setValueCommon(value, eventBehavior);
tkent 2014/03/28 04:58:48 This function needs "RefPtr<HTMLTextAreaElement> p
Dan Beam 2014/03/28 05:03:48 Done.
m_isDirty = true;
setNeedsValidityCheck();
}
void HTMLTextAreaElement::setNonDirtyValue(const String& value)
{
- setValueCommon(value);
+ setValueCommon(value, DispatchNoEvent);
m_isDirty = false;
setNeedsValidityCheck();
}
-void HTMLTextAreaElement::setValueCommon(const String& newValue)
+void HTMLTextAreaElement::setValueCommon(const String& newValue, TextFieldEventBehavior eventBehavior)
{
// Code elsewhere normalizes line endings added by the user via the keyboard or pasting.
// We normalize line endings coming from JavaScript here.
@@ -364,9 +364,11 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue)
if (normalizedValue == value())
return;
+ RefPtr<HTMLTextAreaElement> protector(this);
tkent 2014/03/28 04:58:48 This is unnecessary because we need it in setValue
Dan Beam 2014/03/28 05:03:48 Done.
m_value = normalizedValue;
setInnerTextValue(m_value);
- setLastChangeWasNotUserEdit();
+ if (eventBehavior == DispatchNoEvent)
+ setLastChangeWasNotUserEdit();
updatePlaceholderVisibility(false);
setNeedsStyleRecalc(SubtreeStyleChange);
setFormControlValueMatchesRenderer(true);
@@ -379,7 +381,13 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue)
}
notifyFormStateChanged();
- setTextAsOfLastFormControlChangeEvent(normalizedValue);
+ if (eventBehavior == DispatchNoEvent) {
+ setTextAsOfLastFormControlChangeEvent(normalizedValue);
+ } else {
+ if (eventBehavior == DispatchInputAndChangeEvent)
+ dispatchFormControlInputEvent();
+ dispatchFormControlChangeEvent();
+ }
}
String HTMLTextAreaElement::defaultValue() const
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.h ('k') | Source/web/WebFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698