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

Unified Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 214823011: Autofill/rAc: dispatch "input"/"change" on <input>, <textarea>, and <select> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d'oh 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
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index 995bb06baf509bb79ca337cdb37d5a57230fc5e5..dad2979db1a3e7a88fe12465c0bcb7c9ece0cf48 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -533,19 +533,16 @@ void FillFormField(const FormFieldData& data,
field->setAutofilled(true);
WebInputElement* input_element = toWebInputElement(field);
- if (IsTextInput(input_element) || IsMonthInput(input_element)) {
- // If the maxlength attribute contains a negative value, maxLength()
- // returns the default maxlength value.
- input_element->setValue(
- data.value.substr(0, input_element->maxLength()), true);
- } else if (IsTextAreaElement(*field) || IsSelectElement(*field)) {
- if (field->value() != data.value) {
- field->setValue(data.value);
- field->dispatchFormControlChangeEvent();
- }
- } else {
- DCHECK(IsCheckableElement(input_element));
+ if (IsCheckableElement(input_element)) {
input_element->setChecked(data.is_checked, true);
+ } else {
+ base::string16 value = data.value;
+ if (IsTextInput(input_element) || IsMonthInput(input_element)) {
+ // If the maxlength attribute contains a negative value, maxLength()
+ // returns the default maxlength value.
+ value = value.substr(0, input_element->maxLength());
+ }
+ field->setValue(value, true);
}
if (is_initiating_node &&
« no previous file with comments | « chrome/browser/autofill/autofill_interactive_uitest.cc ('k') | components/autofill/content/renderer/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698