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

Unified Diff: chrome/renderer/form_manager.cc

Issue 1801002: AutoFill: Notify the renderer when the page has finished translating. Extract (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Update comment. Created 10 years, 8 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/browser/autofill/name_field_unittest.cc ('k') | chrome/renderer/form_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/form_manager.cc
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc
index 19ae0041ccb3611d6fb9fea346036a3e638bba26..59704d1b4c38581446188afc1ceaaf65a5aaac0a 100644
--- a/chrome/renderer/form_manager.cc
+++ b/chrome/renderer/form_manager.cc
@@ -45,13 +45,16 @@ namespace {
// it's not necessary.
const size_t kRequiredAutoFillFields = 3;
-// Returns the node value of the first child of |element| if the first child
-// is text. This is faster alternative to |innerText()| for performance
-// critical operations when the child structure of element is known.
+// Returns the node value of the first offspring of |element| that is a text
+// node. This is a faster alternative to |innerText()| for performance
+// critical operations when the child structure of |element| is known.
string16 GetChildText(const WebElement& element) {
string16 element_text;
WebNode child = element.firstChild();
- if (!child.isNull() && child.isTextNode()) {
+ // Find the text node.
+ while (!child.isNull() && !child.isTextNode())
+ child = child.firstChild();
+ if (!child.isNull()) {
element_text = child.nodeValue();
TrimWhitespace(element_text, TRIM_ALL, &element_text);
}
« no previous file with comments | « chrome/browser/autofill/name_field_unittest.cc ('k') | chrome/renderer/form_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698