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

Unified Diff: chrome/renderer/autofill/form_manager.cc

Issue 7541059: When an element has multiple labels for Autofill, separate them with spaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/autofill/form_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/form_manager.cc
diff --git a/chrome/renderer/autofill/form_manager.cc b/chrome/renderer/autofill/form_manager.cc
index 45ca70d05ff94a80f4e783b00007ebd6e7037298..e33ef38871d1039404a520e68cd5b56f3db99d21 100644
--- a/chrome/renderer/autofill/form_manager.cc
+++ b/chrome/renderer/autofill/form_manager.cc
@@ -764,10 +764,15 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element,
}
std::map<string16, FormField*>::iterator iter = name_map.find(element_name);
- // Concatenate labels because some sites might have multiple label
- // candidates.
- if (iter != name_map.end())
- iter->second->label += FindChildText(label);
+ if (iter != name_map.end()) {
+ string16 label_text = FindChildText(label);
+
+ // Concatenate labels because some sites might have multiple label
+ // candidates.
+ if (!iter->second->label.empty() && !label_text.empty())
+ iter->second->label += ASCIIToUTF16(" ");
+ iter->second->label += label_text;
+ }
}
// Loop through the form control elements, extracting the label text from
« no previous file with comments | « no previous file | chrome/renderer/autofill/form_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698