summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-06 12:47:48 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:33 +0100
commita03ee8c22965a587969693e22422a24981089ccf (patch)
tree3336afa6505b23176b77331196f5adbd6584a4cd /WebKit/android
parentbfce793ad58f0a43e19e55c8ce237cb43a977c42 (diff)
downloadexternal_webkit-a03ee8c22965a587969693e22422a24981089ccf.zip
external_webkit-a03ee8c22965a587969693e22422a24981089ccf.tar.gz
external_webkit-a03ee8c22965a587969693e22422a24981089ccf.tar.bz2
Merge WebKit at r74534: Fix WebCoreFrameBridge.cpp and
FormManagerAndroid.cpp Platform code needs updating after upstream refactoring. See http://trac.webkit.org/changeset/73430 Change-Id: If9306164c5dae24fb11af724979c0187d28792da
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp22
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp16
2 files changed, 25 insertions, 13 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
index 669eb19..9652794 100644
--- a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
@@ -42,6 +42,7 @@
#include "Node.h"
#include "NodeList.h"
#include "HTMLCollection.h"
+#include "FormAssociatedElement.h"
#include "FormFieldAndroid.h"
#include "QualifiedName.h"
#include "StringUtils.h"
@@ -53,7 +54,9 @@
using webkit_glue::FormData;
using webkit_glue::FormField;
using WebCore::Element;
+using WebCore::FormAssociatedElement;
using WebCore::HTMLCollection;
+using WebCore::HTMLElement;
using WebCore::HTMLFormControlElement;
using WebCore::HTMLFormElement;
using WebCore::HTMLInputElement;
@@ -408,14 +411,17 @@ bool FormManager::HTMLFormElementToFormData(HTMLFormElement* element, Requiremen
// |name_map|.
ScopedVector<FormField> form_fields;
- WTF::Vector<HTMLFormControlElement*> control_elements = element->associatedElements();
+ WTF::Vector<WebCore::FormAssociatedElement*> control_elements = element->associatedElements();
// A vector of bools that indicate whether each field in the form meets the
// requirements and thus will be in the resulting |form|.
std::vector<bool> fields_extracted(control_elements.size(), false);
for (size_t i = 0; i < control_elements.size(); ++i) {
- HTMLFormControlElement* control_element = control_elements[i];
+ if (!control_elements[i]->isFormControlElement())
+ continue;
+
+ HTMLFormControlElement* control_element = static_cast<HTMLFormControlElement*>(control_elements[i]);
if (!(control_element->hasTagName(inputTag) || control_element->hasTagName(selectTag)))
continue;
@@ -472,7 +478,10 @@ bool FormManager::HTMLFormElementToFormData(HTMLFormElement* element, Requiremen
if (!fields_extracted[i])
continue;
- const HTMLFormControlElement* control_element = control_elements[i];
+ if (!control_elements[i]->isFormControlElement())
+ continue;
+
+ const HTMLFormControlElement* control_element = static_cast<HTMLFormControlElement*>(control_elements[i]);
if (form_fields[field_idx]->label().empty())
form_fields[field_idx]->set_label(FormManager::InferLabelForElement(*control_element));
@@ -497,9 +506,12 @@ void FormManager::ExtractForms(Frame* frame) {
HTMLFormElement* html_form_element = static_cast<HTMLFormElement*>(web_forms->item(i));
form_element->form_element = html_form_element;
- WTF::Vector<HTMLFormControlElement*> control_elements = html_form_element->associatedElements();
+ WTF::Vector<FormAssociatedElement*> control_elements = html_form_element->associatedElements();
for (size_t j = 0; j < control_elements.size(); ++j) {
- HTMLFormControlElement* element = control_elements[j];
+ if (!control_elements[j]->isFormControlElement())
+ continue;
+
+ HTMLFormControlElement* element = static_cast<HTMLFormControlElement*>(control_elements[j]);
form_element->control_elements.push_back(element);
// Save original values of "select-one" inputs so we can restore them
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index d59a53b..bb81910 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -1066,11 +1066,11 @@ bool WebFrame::getUsernamePasswordFromDom(WebCore::Frame* frame, WTF::String& us
WebCore::Node* node = form->firstItem();
while (node && !found && !node->namespaceURI().isNull() &&
!node->namespaceURI().isEmpty()) {
- const WTF::Vector<WebCore::HTMLFormControlElement*>& elements =
+ const WTF::Vector<WebCore::FormAssociatedElement*>& elements =
((WebCore::HTMLFormElement*)node)->associatedElements();
size_t size = elements.size();
for (size_t i = 0; i< size && !found; i++) {
- WebCore::HTMLFormControlElement* e = elements[i];
+ WebCore::HTMLElement* e = toHTMLElement(elements[i]);
if (e->hasLocalName(WebCore::HTMLNames::inputTag)) {
WebCore::HTMLInputElement* input = (WebCore::HTMLInputElement*)e;
if (input->autoComplete() == false)
@@ -1866,11 +1866,11 @@ static jboolean HasPasswordField(JNIEnv *env, jobject obj)
// class, but just normal Element class.
while (node && !found && !node->namespaceURI().isNull() &&
!node->namespaceURI().isEmpty()) {
- const WTF::Vector<WebCore::HTMLFormControlElement*>& elements =
+ const WTF::Vector<WebCore::FormAssociatedElement*>& elements =
((WebCore::HTMLFormElement*)node)->associatedElements();
size_t size = elements.size();
for (size_t i = 0; i< size && !found; i++) {
- WebCore::HTMLFormControlElement* e = elements[i];
+ WebCore::HTMLElement* e = toHTMLElement(elements[i]);
if (e->hasLocalName(WebCore::HTMLNames::inputTag)) {
if (static_cast<WebCore::HTMLInputElement*>(e)->isPasswordField())
found = true;
@@ -1917,11 +1917,11 @@ static void SetUsernamePassword(JNIEnv *env, jobject obj,
WebCore::Node* node = form->firstItem();
while (node && !found && !node->namespaceURI().isNull() &&
!node->namespaceURI().isEmpty()) {
- const WTF::Vector<WebCore::HTMLFormControlElement*>& elements =
+ const WTF::Vector<WebCore::FormAssociatedElement*>& elements =
((WebCore::HTMLFormElement*)node)->associatedElements();
size_t size = elements.size();
for (size_t i = 0; i< size && !found; i++) {
- WebCore::HTMLFormControlElement* e = elements[i];
+ WebCore::HTMLElement* e = toHTMLElement(elements[i]);
if (e->hasLocalName(WebCore::HTMLNames::inputTag)) {
WebCore::HTMLInputElement* input = (WebCore::HTMLInputElement*)e;
if (input->autoComplete() == false)
@@ -1956,10 +1956,10 @@ WebFrame::saveFormData(HTMLFormElement* form)
jmethodID put = env->GetMethodID(mapClass, "put",
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
LOG_ASSERT(put, "Could not find put method on HashMap");
- WTF::Vector<WebCore::HTMLFormControlElement*> elements = form->associatedElements();
+ WTF::Vector<WebCore::FormAssociatedElement*> elements = form->associatedElements();
size_t size = elements.size();
for (size_t i = 0; i < size; i++) {
- WebCore::HTMLFormControlElement* e = elements[i];
+ WebCore::HTMLElement* e = toHTMLElement(elements[i]);
if (e->hasTagName(WebCore::HTMLNames::inputTag)) {
WebCore::HTMLInputElement* input = static_cast<WebCore::HTMLInputElement*>(e);
if (input->isTextField() && !input->isPasswordField()