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

Unified Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 921393002: Autofill: Use the title attribute as a last resort for finding labels (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « chrome/test/data/autofill/heuristics/output/11_register_macys.com.out ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index c5d30307b7ecf401ce6fa64d1b07320388b62cdb..9bc1dbfbc4beea5e13397f226e811a2ba8e80b21 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -567,7 +567,15 @@ base::string16 InferLabelForElement(const WebFormControlElement& element) {
// If we didn't find a label from the table, check for div table case if we
// haven't already.
inferred_label = InferLabelFromDivTable(element);
+ if (!inferred_label.empty())
+ return inferred_label;
}
+
+ // Not all web pages put useful info in the title attribute, thus use this as
+ // a last resort.
+ CR_DEFINE_STATIC_LOCAL(WebString, kTitle, ("title"));
+ if (element.hasAttribute(kTitle))
+ inferred_label = element.getAttribute(kTitle);
return inferred_label;
}
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/11_register_macys.com.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698