| Index: chrome/renderer/autofill/form_autofill_util.cc
|
| diff --git a/chrome/renderer/autofill/form_autofill_util.cc b/chrome/renderer/autofill/form_autofill_util.cc
|
| index 3da2f9869cd77763a64524f4d7aa7753684c9432..0c4f28a11843d5b041249a758896b10efd08317d 100644
|
| --- a/chrome/renderer/autofill/form_autofill_util.cc
|
| +++ b/chrome/renderer/autofill/form_autofill_util.cc
|
| @@ -473,38 +473,6 @@ void ForEachMatchingFormField(const WebFormElement& form_element,
|
| }
|
| }
|
|
|
| -// Sets the |field|'s value to the value in |data|.
|
| -// Also sets the "autofilled" attribute, causing the background to be yellow.
|
| -void FillFormField(WebKit::WebFormControlElement* field,
|
| - const FormFieldData* data,
|
| - bool is_initiating_node) {
|
| - // Nothing to fill.
|
| - if (data->value.empty())
|
| - return;
|
| -
|
| - WebInputElement* input_element = toWebInputElement(field);
|
| - if (IsTextInput(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);
|
| - input_element->setAutofilled(true);
|
| - if (is_initiating_node) {
|
| - int length = input_element->value().length();
|
| - input_element->setSelectionRange(length, length);
|
| - // Clear the current IME composition (the underline), if there is one.
|
| - input_element->document().frame()->unmarkText();
|
| - }
|
| - } else {
|
| - DCHECK(IsSelectElement(*field));
|
| - WebSelectElement select_element = field->to<WebSelectElement>();
|
| - if (select_element.value() != data->value) {
|
| - select_element.setValue(data->value);
|
| - select_element.dispatchFormControlChangeEvent();
|
| - }
|
| - }
|
| -}
|
| -
|
| // Sets the |field|'s "suggested" (non JS visible) value to the value in |data|.
|
| // Also sets the "autofilled" attribute, causing the background to be yellow.
|
| void PreviewFormField(WebKit::WebFormControlElement* field,
|
| @@ -823,6 +791,38 @@ void FillForm(const FormData& form, const WebInputElement& element) {
|
| &FillFormField);
|
| }
|
|
|
| +// Sets the |field|'s value to the value in |data|.
|
| +// Also sets the "autofilled" attribute, causing the background to be yellow.
|
| +void FillFormField(WebKit::WebFormControlElement* field,
|
| + const FormFieldData* data,
|
| + bool is_initiating_node) {
|
| + // Nothing to fill.
|
| + if (data->value.empty())
|
| + return;
|
| +
|
| + WebInputElement* input_element = toWebInputElement(field);
|
| + if (IsTextInput(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);
|
| + input_element->setAutofilled(true);
|
| + if (is_initiating_node) {
|
| + int length = input_element->value().length();
|
| + input_element->setSelectionRange(length, length);
|
| + // Clear the current IME composition (the underline), if there is one.
|
| + input_element->document().frame()->unmarkText();
|
| + }
|
| + } else {
|
| + DCHECK(IsSelectElement(*field));
|
| + WebSelectElement select_element = field->to<WebSelectElement>();
|
| + if (select_element.value() != data->value) {
|
| + select_element.setValue(data->value);
|
| + select_element.dispatchFormControlChangeEvent();
|
| + }
|
| + }
|
| +}
|
| +
|
| void PreviewForm(const FormData& form, const WebInputElement& element) {
|
| WebFormElement form_element = element.form();
|
| if (form_element.isNull())
|
|
|