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

Unified Diff: webkit/glue/dom_operations.cc

Issue 50038: Fix for autofill bug 8627 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « webkit/glue/dom_operations.h ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/dom_operations.cc
===================================================================
--- webkit/glue/dom_operations.cc (revision 12331)
+++ webkit/glue/dom_operations.cc (working copy)
@@ -312,14 +312,6 @@
return false;
}
-// Helper function to cast a Node as an HTMLInputElement.
-static WebCore::HTMLInputElement* GetNodeAsInputElement(WebCore::Node* node) {
- DCHECK(node->nodeType() == WebCore::Node::ELEMENT_NODE);
- DCHECK(static_cast<WebCore::Element*>(node)->hasTagName(
- WebCore::HTMLNames::inputTag));
- return static_cast<WebCore::HTMLInputElement*>(node);
-}
-
// Helper to search the given form element for the specified input elements
// in |data|, and add results to |result|.
static bool FindFormInputElements(WebCore::HTMLFormElement* fe,
@@ -346,7 +338,8 @@
// matching elements it can get at them through the FormElement*.
// Note: This assignment adds a reference to the InputElement.
result->input_elements[data.elements[j]] =
- GetNodeAsInputElement(temp_elements[0].get());
+ NodeToHTMLInputElement(temp_elements[0].get());
+ DCHECK(result->input_elements[data.elements[j]].get());
}
return true;
}
@@ -874,4 +867,17 @@
return controller->numberOfActiveAnimations();
}
+WebCore::HTMLInputElement* ElementToHTMLInputElement(
+ WebCore::Element* element) {
+ if (!element->hasLocalName(WebCore::HTMLNames::inputTag))
+ return NULL;
+ return static_cast<WebCore::HTMLInputElement*>(element);
+}
+
+WebCore::HTMLInputElement* NodeToHTMLInputElement(WebCore::Node* node) {
+ if (node->nodeType() != WebCore::Node::ELEMENT_NODE)
+ return NULL;
+ return ElementToHTMLInputElement(static_cast<WebCore::Element*>(node));
+}
+
} // webkit_glue
« no previous file with comments | « webkit/glue/dom_operations.h ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698