OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/renderer/form_cache.h" | 5 #include "components/autofill/renderer/form_cache.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "components/autofill/common/autofill_constants.h" | 9 #include "components/autofill/common/autofill_constants.h" |
10 #include "components/autofill/common/form_data.h" | 10 #include "components/autofill/common/form_data.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 std::make_pair(input_element, input_element.isChecked())); | 117 std::make_pair(input_element, input_element.isChecked())); |
118 } else { | 118 } else { |
119 ++num_editable_elements; | 119 ++num_editable_elements; |
120 } | 120 } |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 // To avoid overly expensive computation, we impose a minimum number of | 124 // To avoid overly expensive computation, we impose a minimum number of |
125 // allowable fields. The corresponding maximum number of allowable fields | 125 // allowable fields. The corresponding maximum number of allowable fields |
126 // is imposed by WebFormElementToFormData(). | 126 // is imposed by WebFormElementToFormData(). |
127 if (num_editable_elements < minimum_required_fields) { | 127 if (num_editable_elements < minimum_required_fields && |
| 128 control_elements.size() > 0) { |
128 has_skipped_forms = true; | 129 has_skipped_forms = true; |
129 continue; | 130 continue; |
130 } | 131 } |
131 | 132 |
132 FormData form; | 133 FormData form; |
133 ExtractMask extract_mask = | 134 ExtractMask extract_mask = |
134 static_cast<ExtractMask>(EXTRACT_VALUE | EXTRACT_OPTIONS); | 135 static_cast<ExtractMask>(EXTRACT_VALUE | EXTRACT_OPTIONS); |
135 | 136 |
136 if (!WebFormElementToFormData(form_element, WebFormControlElement(), | 137 if (!WebFormElementToFormData(form_element, WebFormControlElement(), |
137 REQUIRE_NONE, extract_mask, &form, NULL)) { | 138 REQUIRE_NONE, extract_mask, &form, NULL)) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 UTF8ToUTF16(form.experiment_id)); | 288 UTF8ToUTF16(form.experiment_id)); |
288 if (!element->hasAttribute("placeholder")) | 289 if (!element->hasAttribute("placeholder")) |
289 element->setAttribute("placeholder", WebString(UTF8ToUTF16(placeholder))); | 290 element->setAttribute("placeholder", WebString(UTF8ToUTF16(placeholder))); |
290 element->setAttribute("title", WebString(title)); | 291 element->setAttribute("title", WebString(title)); |
291 } | 292 } |
292 | 293 |
293 return true; | 294 return true; |
294 } | 295 } |
295 | 296 |
296 } // namespace autofill | 297 } // namespace autofill |
OLD | NEW |