summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/form_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/form_manager.cc')
-rw-r--r--chrome/renderer/form_manager.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc
index ebdccbc..12b6353 100644
--- a/chrome/renderer/form_manager.cc
+++ b/chrome/renderer/form_manager.cc
@@ -102,6 +102,11 @@ void FormManager::WebFormControlElementToFormField(
field->set_name(element.nameForAutofill());
field->set_form_control_type(element.formControlType());
+ if (element.formControlType() == WebString::fromUTF8("text")) {
+ const WebInputElement& input_element = element.toConst<WebInputElement>();
+ field->set_size(input_element.size());
+ }
+
if (!get_value)
return;
@@ -586,6 +591,24 @@ string16 FormManager::InferLabelForElement(
}
}
}
+
+ // Look for text node prior to <img> tag.
+ // Eg. Some Text<img/><input ...>
+ if (inferred_label.empty()) {
+ while (inferred_label.empty() && !previous.isNull()) {
+ if (previous.isTextNode()) {
+ inferred_label = previous.nodeValue();
+ TrimWhitespace(inferred_label, TRIM_ALL, &inferred_label);
+ } else if (previous.isElementNode()) {
+ WebElement element = previous.to<WebElement>();
+ if (!element.hasTagName("img"))
+ break;
+ } else {
+ break;
+ }
+ previous = previous.previousSibling();
+ }
+ }
}
// If we didn't find paragraph, check for table cell case.