}
}
+#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
+bool HTMLFormElement::isAutoCompletePasswordField() const
+{
+ for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
+ FormAssociatedElement* control = m_associatedElements[i];
+ HTMLElement* element = toHTMLElement(control);
+ if (!element->hasLocalName(inputTag))
+ continue;
+
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
+ if (!input->isTextField())
+ continue;
+
+ if (!input->isPasswordField())
+ continue;
+
+ return input->shouldAutocomplete();
+ }
+
+ return true;
+}
+#endif
+
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
{
FrameView* view = document()->view();
void getTextFieldValues(StringPairVector& fieldNamesAndValues) const;
+#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
+ bool isAutoCompletePasswordField() const;
+#endif
+
private:
HTMLFormElement(const QualifiedName&, Document*);
// Form Client.
//#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
-typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, bool containsPasswordData, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo);
+typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, bool containsPasswordData, bool isAutoComplete, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo);
//#else
//typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo);
//#endif
smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height());
}
-void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm)
+void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm, bool isAutoComplete)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))
&& !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
return;
+
+ // if isAutoComplete is off then return
+ if (isPasswordForm && !isAutoComplete)
+ return;
+
ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm);
}
if (!passwordFormData.size())
return;
- String passwordFormAutofill = String::fromUTF8("try { function passwordFormAutofill() { var inputFields;");
+ String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;";
for (size_t i = 0; i < passwordFormData.size(); i++) {
- passwordFormAutofill += String::fromUTF8(" inputFields = document.getElementsByName(\"");
- passwordFormAutofill += passwordFormData[i].first;
- passwordFormAutofill += String::fromUTF8("\");");
- passwordFormAutofill += String::fromUTF8(" for (var i = 0; i < inputFields.length; i++)");
- passwordFormAutofill += String::fromUTF8(" if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))");
- passwordFormAutofill += String::fromUTF8(" inputFields[i].value = \"");
- passwordFormAutofill += passwordFormData[i].second;
- passwordFormAutofill += String::fromUTF8("\";");
+ passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
+ " for (var i = 0; i < inputFields.length; i++)"
+ " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\")"
+ " && inputFields[i].autocomplete.toLowerCase() != \"off\")"
+ " inputFields[i].value = \"",passwordFormData[i].first.utf8().data());
+ passwordFormAutofill.append(passwordFormData[i].second);
+ passwordFormAutofill += "\";";
}
- passwordFormAutofill += String::fromUTF8("} passwordFormAutofill(); } catch(e) { }");
+ passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }";
ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0);
}
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
void ewk_view_form_password_data_fill(Evas_Object* ewkView);
-void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm);
+void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm, bool isAutoComplete);
void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector<String>& candidates);
void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value);
#endif
namespace WebKit {
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
-bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, const Vector<std::pair<String, String> >& textFieldValues, bool containsPasswordData, APIObject* userData, WebFormSubmissionListenerProxy* listener)
+bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, const Vector<std::pair<String, String> >& textFieldValues, bool containsPasswordData, bool isAutoComplete, APIObject* userData, WebFormSubmissionListenerProxy* listener)
#else
bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy* listener)
#endif
RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- m_client.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), containsPasswordData, toAPI(userData), toAPI(listener), m_client.clientInfo);
+ m_client.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), containsPasswordData, isAutoComplete, toAPI(userData), toAPI(listener), m_client.clientInfo);
#else
m_client.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), toAPI(userData), toAPI(listener), m_client.clientInfo);
#endif
class WebFormClient : public APIClient<WKPageFormClient, kWKPageFormClientCurrentVersion> {
public:
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String> >& textFieldValues, bool containsPasswordData, APIObject* userData, WebFormSubmissionListenerProxy*);
+ bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String> >& textFieldValues, bool containsPasswordData, bool isAutoComplete, APIObject* userData, WebFormSubmissionListenerProxy*);
#else
bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy*);
#endif
// FormClient
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
-void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
+void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, bool isAutoComplete, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
#else
void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
#endif
RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
+ if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, isAutoComplete, userData.get(), listener.get()))
#else
if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
#endif
void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
+ void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, bool isAutoComplete, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
#else
void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
#endif
# Forms messages
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, bool containsPasswordData, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
+ WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, bool containsPasswordData, bool isAutoComplete, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
#endif
#if !ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
}
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
-void FormClientEfl::willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef sourceFrame, WKDictionaryRef values, bool containsPasswordData, WKTypeRef, WKFormSubmissionListenerRef listener, const void* clientInfo)
+void FormClientEfl::willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef sourceFrame, WKDictionaryRef values, bool containsPasswordData, bool isAutoComplete, WKTypeRef, WKFormSubmissionListenerRef listener, const void* clientInfo)
{
FormClientEfl* formClient = toFormClientEfl(clientInfo);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- ewk_view_form_data_add(formClient->m_viewImpl->view(), values, containsPasswordData);
+ ewk_view_form_data_add(formClient->m_viewImpl->view(), values, containsPasswordData, isAutoComplete);
#endif
RefPtr<Ewk_Form_Submission_Request> request = Ewk_Form_Submission_Request::create(values, listener);
explicit FormClientEfl(EwkViewImpl*);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- static void willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef, WKDictionaryRef, bool, WKTypeRef, WKFormSubmissionListenerRef, const void*);
+ static void willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef, WKDictionaryRef, bool, bool, WKTypeRef, WKFormSubmissionListenerRef, const void*);
#else
static void willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef, const void* clientInfo);
#endif
StringPairVector valuesVector(values);
#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
- webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), valuesVector, formState->containsPasswordData(), listenerID, InjectedBundleUserMessageEncoder(userData.get())));
+ bool isAutoComplete = true;
+
+ if (form)
+ isAutoComplete = form->isAutoCompletePasswordField();
+
+ webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), valuesVector, formState->containsPasswordData(), isAutoComplete, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
#else
webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), valuesVector, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
#endif