Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: components/autofill/renderer/form_cache.cc

Issue 13831013: Don't include forms without fields in has_more_forms calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some test coverage Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698