summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-16 15:33:28 +0000
committerBen Murdoch <benm@google.com>2010-11-16 19:28:40 +0000
commit915ace8187ca47eaaf936d7891ab71cfc69e50f0 (patch)
tree7086cbdcdf18c0681ec078dd4ba3809971edf8a2 /WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
parentc171aa015a0cbeab69fa359835f7c82f269d6111 (diff)
downloadexternal_webkit-915ace8187ca47eaaf936d7891ab71cfc69e50f0.zip
external_webkit-915ace8187ca47eaaf936d7891ab71cfc69e50f0.tar.gz
external_webkit-915ace8187ca47eaaf936d7891ab71cfc69e50f0.tar.bz2
Merge autofill files after last Chromium merge
Merge by hand the files that have been gotked implementing AutoFill on Android. This classes use WebCore types rather than the Chrome WebKit API types that the code would normally use. This brings the files up to date with the last external/chromium merge to r63472 and updates their usages in line with that so that the feature continues to work as intended. Change-Id: Ic110873dc48c59555f0db76e7ad0c138c2fe96f2
Diffstat (limited to 'WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp')
-rw-r--r--WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
index 217bbc0..f258f2f 100644
--- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
@@ -29,7 +29,6 @@
#if ENABLE(WEB_AUTOFILL)
#include "AutoFillHostAndroid.h"
-#include "Document.h"
#include "Frame.h"
#include "FormData.h"
#include "FormManagerAndroid.h"
@@ -75,7 +74,7 @@ WebAutoFill::~WebAutoFill()
mUniqueIdMap.clear();
}
-void WebAutoFill::searchDocument(WebCore::Document* document)
+void WebAutoFill::searchDocument(WebCore::Frame* frame)
{
// TODO: This method is called when the main frame finishes loading and
// scans the document for forms and tries to work out the type of the
@@ -94,9 +93,9 @@ void WebAutoFill::searchDocument(WebCore::Document* document)
mQueryId = 1;
mAutoFillManager->Reset();
mFormManager->Reset();
- mFormManager->ExtractForms(document);
+ mFormManager->ExtractForms(frame);
mForms.clear();
- mFormManager->GetForms(FormManager::REQUIRE_AUTOCOMPLETE, &mForms);
+ mFormManager->GetFormsInFrame(frame, FormManager::REQUIRE_AUTOCOMPLETE, &mForms);
mAutoFillManager->FormsSeen(mForms);
}
@@ -112,11 +111,11 @@ void WebAutoFill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldEle
// Get the FormField from the Node.
webkit_glue::FormField formField;
- FormManager::HTMLFormControlElementToFormField(*formFieldElement, false, &formField);
+ FormManager::HTMLFormControlElementToFormField(formFieldElement, false, false, &formField);
formField.set_label(FormManager::LabelForElement(*formFieldElement));
webkit_glue::FormData* form = new webkit_glue::FormData;
- mFormManager->FindFormWithFormControlElement(*formFieldElement, FormManager::REQUIRE_AUTOCOMPLETE, form);
+ mFormManager->FindFormWithFormControlElement(formFieldElement, FormManager::REQUIRE_AUTOCOMPLETE, form);
mQueryMap[mQueryId] = form;
bool suggestions = mAutoFillManager->GetAutoFillSuggestions(mQueryId, false, formField);
@@ -159,7 +158,12 @@ void WebAutoFill::fillFormInPage(int queryId, const webkit_glue::FormData& form)
if (!enabled())
return;
- mFormManager->FillForm(form);
+ // FIXME: Pass a pointer to the Node that triggered the AutoFill flow here instead of 0.
+ // The consquence of passing 0 is that we should always fail the test in FormManader::ForEachMathcingFormField():169
+ // that says "only overwrite an elements current value if the user triggered autofill through that element"
+ // for elements that have a value already. But by a quirk of Android text views we are OK. We should still
+ // fix this though.
+ mFormManager->FillForm(form, 0);
}
bool WebAutoFill::enabled() const