From 075ca193e0ad61b9811c2136ebafcbbaad4fd512 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 19 Nov 2010 18:41:33 +0000 Subject: 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 --- .../WebCoreSupport/autofill/FormManagerAndroid.cpp | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'WebKit/android/WebCoreSupport/autofill') 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(parent)->hasTagName(tdTag)) parent = parent->parentNode(); - if (parent && parent->isElementNode()) { - Element* element = static_cast(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(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(previous); + if (e->hasTagName(tdTag)) { + inferred_label = FindChildText(e); + if (!inferred_label.empty()) + break; } } + previous = previous->previousSibling(); } return inferred_label; } -- cgit v1.1