summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/autofill
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-19 18:41:33 +0000
committerBen Murdoch <benm@google.com>2010-11-22 11:52:52 +0000
commit075ca193e0ad61b9811c2136ebafcbbaad4fd512 (patch)
tree2546cbf2cfc50cecfdbbbc8d8aa6bb7b3e3f70eb /WebKit/android/WebCoreSupport/autofill
parentb28419a5ffabcf97496897d7084446af4ac8dd39 (diff)
downloadexternal_webkit-075ca193e0ad61b9811c2136ebafcbbaad4fd512.zip
external_webkit-075ca193e0ad61b9811c2136ebafcbbaad4fd512.tar.gz
external_webkit-075ca193e0ad61b9811c2136ebafcbbaad4fd512.tar.bz2
Merge Chromium at r65505: Merge AutoFill change 64761
Merge in http://src.chromium.org/viewvc/chrome?view=rev&revision=64761 This is not part of the bigger autofill merge as this introdcues a regression that we need to understand. Change-Id: I08cfcefb93181e70a8a48d0c6da2217d3a5bbcf9
Diffstat (limited to 'WebKit/android/WebCoreSupport/autofill')
-rw-r--r--WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
index 332e134..ea389f7 100644
--- a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
@@ -202,21 +202,19 @@ string16 InferLabelFromTable(const HTMLFormControlElement& element) {
while (parent && parent->isElementNode() && !static_cast<Element*>(parent)->hasTagName(tdTag))
parent = parent->parentNode();
- if (parent && parent->isElementNode()) {
- Element* element = static_cast<Element*>(parent);
- if (element->hasTagName(tdTag)) {
- Node* previous = parent->previousSibling();
-
- // Skip by any intervening text nodes.
- while (previous && previous->isTextNode())
- previous = previous->previousSibling();
-
- if (previous && previous->isElementNode()) {
- element = static_cast<Element*>(previous);
- if (element->hasTagName(tdTag))
- inferred_label = FindChildText(element);
+ // Check all previous siblings, skipping non-element nodes, until we find a
+ // non-empty text block.
+ Node* previous = parent;
+ while(previous) {
+ if (previous->isElementNode()) {
+ Element* e = static_cast<Element*>(previous);
+ if (e->hasTagName(tdTag)) {
+ inferred_label = FindChildText(e);
+ if (!inferred_label.empty())
+ break;
}
}
+ previous = previous->previousSibling();
}
return inferred_label;
}