Chromium Code Reviews| 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..24ed1cea1f22f332fd0168c71e566e2b461f40de 100644 |
| --- a/components/autofill/content/renderer/form_autofill_util.cc |
| +++ b/components/autofill/content/renderer/form_autofill_util.cc |
| @@ -533,21 +533,18 @@ void FillFormField(const FormFieldData& data, |
| field->setAutofilled(true); |
| WebInputElement* input_element = toWebInputElement(field); |
| + 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. |
| - 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)); |
| - input_element->setChecked(data.is_checked, true); |
| + value = value.substr(0, input_element->maxLength()); |
| } |
| + if (IsCheckableElement(input_element)) |
| + input_element->setChecked(data.is_checked, true); |
| + else |
| + field->setValue(data.value, true); |
|
Ilya Sherman
2014/03/29 00:07:07
I noticed that you've removed the check "if (field
Dan Beam
2014/03/29 00:51:14
yes
|
| + |
| if (is_initiating_node && |
| ((IsTextInput(input_element) || IsMonthInput(input_element)) || |
| IsTextAreaElement(*field))) { |