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

Unified Diff: Source/web/WebFormControlElement.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: protecting protectors everywhere 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.cpp ('k') | Source/web/WebInputElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebFormControlElement.cpp
diff --git a/Source/web/WebFormControlElement.cpp b/Source/web/WebFormControlElement.cpp
index d75f862d123917cdf0c34ad336f63371691c5582..1a1fb4ec468edc55fed7d1b21c378443983f18ef 100644
--- a/Source/web/WebFormControlElement.cpp
+++ b/Source/web/WebFormControlElement.cpp
@@ -92,14 +92,14 @@ bool WebFormControlElement::autoComplete() const
return false;
}
-void WebFormControlElement::setValue(const WebString& value, bool sendChangeEvent)
+void WebFormControlElement::setValue(const WebString& value, bool sendEvents)
{
if (isHTMLInputElement(*m_private))
- unwrap<HTMLInputElement>()->setValue(value, sendChangeEvent ? DispatchChangeEvent : DispatchNoEvent);
- if (isHTMLTextAreaElement(*m_private))
- unwrap<HTMLTextAreaElement>()->setValue(value);
- if (isHTMLSelectElement(*m_private))
- unwrap<HTMLSelectElement>()->setValue(value);
+ unwrap<HTMLInputElement>()->setValue(value, sendEvents ? DispatchInputAndChangeEvent : DispatchNoEvent);
+ else if (isHTMLTextAreaElement(*m_private))
+ unwrap<HTMLTextAreaElement>()->setValue(value, sendEvents ? DispatchInputAndChangeEvent : DispatchNoEvent);
+ else if (isHTMLSelectElement(*m_private))
+ unwrap<HTMLSelectElement>()->setValue(value, sendEvents);
}
WebString WebFormControlElement::value() const
@@ -117,9 +117,9 @@ void WebFormControlElement::setSuggestedValue(const WebString& value)
{
if (isHTMLInputElement(*m_private))
unwrap<HTMLInputElement>()->setSuggestedValue(value);
- if (isHTMLTextAreaElement(*m_private))
+ else if (isHTMLTextAreaElement(*m_private))
unwrap<HTMLTextAreaElement>()->setSuggestedValue(value);
- if (isHTMLSelectElement(*m_private))
+ else if (isHTMLSelectElement(*m_private))
unwrap<HTMLSelectElement>()->setSuggestedValue(value);
}
@@ -147,7 +147,7 @@ void WebFormControlElement::setSelectionRange(int start, int end)
{
if (isHTMLInputElement(*m_private))
unwrap<HTMLInputElement>()->setSelectionRange(start, end);
- if (isHTMLTextAreaElement(*m_private))
+ else if (isHTMLTextAreaElement(*m_private))
unwrap<HTMLTextAreaElement>()->setSelectionRange(start, end);
}
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | Source/web/WebInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698