| Index: chrome/renderer/autofill/form_cache.cc
|
| diff --git a/chrome/renderer/autofill/form_cache.cc b/chrome/renderer/autofill/form_cache.cc
|
| index f7bec0342a014e362d700f47fe520ddbeb65cdab..06cd00d04ed434459f1d4e083fe831837787892e 100644
|
| --- a/chrome/renderer/autofill/form_cache.cc
|
| +++ b/chrome/renderer/autofill/form_cache.cc
|
| @@ -80,6 +80,13 @@ void FormCache::ExtractForms(const WebFrame& frame,
|
| element.toConst<WebSelectElement>();
|
| initial_select_values_.insert(std::make_pair(select_element,
|
| select_element.value()));
|
| + } else {
|
| + const WebInputElement input_element =
|
| + element.toConst<WebInputElement>();
|
| + if (IsRadioButtonElement(&input_element) ||
|
| + IsCheckboxElement(&input_element))
|
| + initial_checked_state_.insert(
|
| + std::make_pair(input_element, input_element.isChecked()));
|
| }
|
| }
|
|
|
| @@ -138,6 +145,26 @@ void FormCache::ResetFrame(const WebFrame& frame) {
|
| it != select_values_to_delete.end(); ++it) {
|
| initial_select_values_.erase(*it);
|
| }
|
| +
|
| + std::vector<WebInputElement> checked_states_to_delete;
|
| + for (std::map<const WebInputElement, bool>::const_iterator it =
|
| + initial_checked_state_.begin();
|
| + it != initial_checked_state_.end(); ++it) {
|
| + WebFormElement form_element = it->first.form();
|
| + if (form_element.isNull()) {
|
| + checked_states_to_delete.push_back(it->first);
|
| + } else {
|
| + const WebFrame* element_frame = form_element.document().frame();
|
| + if (!element_frame || element_frame == &frame)
|
| + checked_states_to_delete.push_back(it->first);
|
| + }
|
| + }
|
| +
|
| + for (std::vector<WebInputElement>::const_iterator it =
|
| + checked_states_to_delete.begin();
|
| + it != checked_states_to_delete.end(); ++it) {
|
| + initial_checked_state_.erase(*it);
|
| + }
|
| }
|
|
|
| bool FormCache::ClearFormWithElement(const WebInputElement& element) {
|
| @@ -165,8 +192,7 @@ bool FormCache::ClearFormWithElement(const WebInputElement& element) {
|
| int length = input_element->value().length();
|
| input_element->setSelectionRange(length, length);
|
| }
|
| - } else {
|
| - DCHECK(IsSelectElement(control_element));
|
| + } else if (IsSelectElement(control_element)) {
|
| WebSelectElement select_element = control_element.to<WebSelectElement>();
|
|
|
| std::map<const WebSelectElement, string16>::const_iterator
|
| @@ -176,6 +202,16 @@ bool FormCache::ClearFormWithElement(const WebInputElement& element) {
|
| select_element.setValue(initial_value_iter->second);
|
| select_element.dispatchFormControlChangeEvent();
|
| }
|
| + } else {
|
| + WebInputElement input_element = control_element.to<WebInputElement>();
|
| + initial_checked_state_.insert(
|
| + std::make_pair(input_element, input_element.isChecked()));
|
| + std::map<const WebInputElement, bool>::const_iterator
|
| + it = initial_checked_state_.find(input_element);
|
| + if (it != initial_checked_state_.end() &&
|
| + input_element.isChecked() != it->second) {
|
| + input_element.setChecked(it->second, true);
|
| + }
|
| }
|
| }
|
|
|
|
|