return true;
}
-bool FormManager::ClearPreviewedFormWithNode(Node* node) {
+bool FormManager::ClearPreviewedFormWithNode(Node* node, bool was_autofilled) {
FormElement* form_element = NULL;
if (!FindCachedFormElementWithNode(node, &form_element))
return false;
// Call |setValue()| to force the renderer to update the field's displayed
// value.
input_element->setValue(input_element->value());
+ input_element->setAutofilled(was_autofilled);
+ } else {
+ input_element->setAutofilled(false);
}
- input_element->setAutofilled(false);
// Clearing the suggested value in the focused node (above) can cause
// selection to be lost. We force selection range to restore the text
bool ClearFormWithNode(Node* node);
// Clears the placeholder values and the auto-filled background for any fields
- // in the form containing |node| that have been previewed. Returns false if
- // the form is not found.
- bool ClearPreviewedFormWithNode(Node* node);
+ // in the form containing |node| that have been previewed. Resets the
+ // autofilled state of |node| to |was_autofilled|. Returns false if the form
+ // is not found.
+ bool ClearPreviewedFormWithNode(Node* node, bool was_autofilled);
// Resets the stored set of forms.
void Reset();