summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 01:28:24 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 01:28:24 +0000
commita035e72f2c36318955de90ade63492144aca200c (patch)
tree6210fa83b7623fce833fbb7985d078c35e529842
parent9cd56b1655cba838ba08a73167544446e1533f65 (diff)
downloadchromium_src-a035e72f2c36318955de90ade63492144aca200c.zip
chromium_src-a035e72f2c36318955de90ade63492144aca200c.tar.gz
chromium_src-a035e72f2c36318955de90ade63492144aca200c.tar.bz2
Be more selective when looking for a "div table" structure to infer Autofill labels.
In particular, if the <input> element is in an actual <table>, do not try to infer its label from a "div table". BUG=90472 TEST=browser_tests --gtest_filter=FormStructureBrowserTest.DataDrivenHeuristics11 Review URL: http://codereview.chromium.org/7477026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94408 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/autofill/form_manager.cc4
-rw-r--r--chrome/test/data/autofill/heuristics/output/11_register_macys.com.out6
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/renderer/autofill/form_manager.cc b/chrome/renderer/autofill/form_manager.cc
index 76cc352..53884db 100644
--- a/chrome/renderer/autofill/form_manager.cc
+++ b/chrome/renderer/autofill/form_manager.cc
@@ -331,7 +331,9 @@ string16 InferLabelFromTableRow(const WebFormControlElement& element) {
string16 InferLabelFromDivTable(const WebFormControlElement& element) {
WebNode node = element.parentNode();
while (!node.isNull() && node.isElementNode() &&
- !node.to<WebElement>().hasTagName("div")) {
+ !node.to<WebElement>().hasTagName("div") &&
+ // If the element is in a table, its label most likely is too.
+ !node.to<WebElement>().hasTagName("table")) {
node = node.parentNode();
}
diff --git a/chrome/test/data/autofill/heuristics/output/11_register_macys.com.out b/chrome/test/data/autofill/heuristics/output/11_register_macys.com.out
index cc6e874..00fb59f 100644
--- a/chrome/test/data/autofill/heuristics/output/11_register_macys.com.out
+++ b/chrome/test/data/autofill/heuristics/output/11_register_macys.com.out
@@ -9,8 +9,8 @@ UNKNOWN_TYPE
UNKNOWN_TYPE
UNKNOWN_TYPE
UNKNOWN_TYPE
-EMAIL_ADDRESS
-PHONE_HOME_COUNTRY_CODE
-PHONE_HOME_CITY_AND_NUMBER
+PHONE_HOME_CITY_CODE
+PHONE_HOME_NUMBER
+PHONE_HOME_NUMBER
UNKNOWN_TYPE
UNKNOWN_TYPE