Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (116602 => 116603)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-05-10 03:58:29 UTC (rev 116603)
@@ -20,6 +20,7 @@
#include "WebPage.h"
#include "ApplicationCacheStorage.h"
+#include "AutofillManager.h"
#include "BackForwardController.h"
#include "BackForwardListImpl.h"
#include "BackingStoreClient.h"
@@ -306,6 +307,11 @@
typedef DeferredTask<isActive> DeferredTaskType;
};
+void WebPage::autofillTextField(const string& item)
+{
+ d->m_autofillManager->autofillTextField(item.c_str());
+}
+
WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect)
: m_webPage(webPage)
, m_client(client)
@@ -376,6 +382,7 @@
, m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired)
, m_selectPopup(0)
, m_parentPopup(0)
+ , m_autofillManager(AutofillManager::create(this))
{
static bool isInitialized = false;
if (!isInitialized) {
@@ -2125,6 +2132,14 @@
return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew));
}
+void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect)
+{
+ vector<string> textItems;
+ for (size_t i = 0; i < candidates.size(); i++)
+ textItems.push_back(candidates[i].utf8().data());
+ m_client->notifyPopupAutofillDialog(textItems, screenRect);
+}
+
bool WebPagePrivate::useFixedLayout() const
{
return true;
@@ -5178,6 +5193,11 @@
#endif
}
+void WebPage::clearAutofillData()
+{
+ AutofillManager::clear();
+}
+
void WebPage::clearNeverRememberSites()
{
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.h (116602 => 116603)
--- trunk/Source/WebKit/blackberry/Api/WebPage.h 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.h 2012-05-10 03:58:29 UTC (rev 116603)
@@ -196,6 +196,7 @@
void clearCache();
void clearLocalStorage();
void clearCredentials();
+ void clearAutofillData();
void clearNeverRememberSites();
void runLayoutTests();
@@ -340,6 +341,7 @@
bool hasOpenedPopup() const;
WebCore::PagePopupBlackBerry* popup();
+ void autofillTextField(const std::string&);
private:
virtual ~WebPage();
Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (116602 => 116603)
--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-05-10 03:58:29 UTC (rev 116603)
@@ -213,6 +213,7 @@
virtual void setPreventsScreenIdleDimming(bool noDimming) = 0;
virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0;
virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0;
+ virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0;
virtual bool shouldPluginEnterFullScreen() = 0;
virtual void didPluginEnterFullScreen() = 0;
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (116602 => 116603)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-05-10 03:58:29 UTC (rev 116603)
@@ -36,6 +36,7 @@
#include <BlackBerryPlatformMessage.h>
namespace WebCore {
+class AutofillManager;
class DOMWrapperWorld;
class Document;
class Frame;
@@ -190,6 +191,7 @@
void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; }
void layoutFinished();
void setNeedTouchEvents(bool);
+ void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&);
// Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
void zoomToInitialScaleOnLoad();
@@ -587,6 +589,7 @@
// The popup that owned this webpage
WebCore::PagePopupBlackBerry* m_parentPopup;
+ RefPtr<WebCore::AutofillManager> m_autofillManager;
protected:
virtual ~WebPagePrivate();
};
Modified: trunk/Source/WebKit/blackberry/ChangeLog (116602 => 116603)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-05-10 03:58:29 UTC (rev 116603)
@@ -1,3 +1,37 @@
+2012-05-09 Jonathan Dong <[email protected]>
+
+ [BlackBerry] Autofill feature implementation for BlackBerry porting
+ https://bugs.webkit.org/show_bug.cgi?id=85577
+
+ Reviewed by Rob Buis.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPage::autofillTextField): Added this interface
+ function to auto fill the inputting text field when user selects
+ a autofill candidate value from autofill context dialog.
+ (WebKit):
+ (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+ (BlackBerry::WebKit::WebPagePrivate::notifyPopupAutofillDialog): Added
+ this interface function to notify WebPageClient to pop up the autofill
+ context dialog with the suggested input items.
+ (BlackBerry::WebKit::WebPage::clearAutofillData):
+ * Api/WebPage.h:
+ * Api/WebPageClient.h:
+ * Api/WebPage_p.h:
+ (WebCore):
+ (WebPagePrivate):
+ * WebCoreSupport/AutofillManager.cpp:
+ (WebCore::AutofillManager::didChangeInTextField):
+ * WebCoreSupport/EditorClientBlackBerry.cpp:
+ (WebCore::EditorClientBlackBerry::textDidChangeInTextField): Implemented
+ this function to listen to the notification of text field change, and
+ notify AutofillManager to handle the autofill.
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
+ (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):
+ Save the name and value pair of every autofillable input text field when
+ user submitting a form.
+
2012-05-09 Crystal Zhang <[email protected]>
[BlackBerry] Enable PAGE_POPUP in make file, and implement required methods
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp (116602 => 116603)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp 2012-05-10 03:58:29 UTC (rev 116603)
@@ -47,7 +47,8 @@
if (m_element != element)
m_element = element;
- // FIXME: Notify page client to popup a context dialog to display these autofill candidate items.
+ Vector<String> candidates = autofillBackingStore().get(element->getAttribute(HTMLNames::nameAttr).string(), element->value());
+ m_webPagePrivate->notifyPopupAutofillDialog(candidates, element->screenRect());
}
void AutofillManager::autofillTextField(const String& value)
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp (116602 => 116603)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp 2012-05-10 03:58:29 UTC (rev 116603)
@@ -20,6 +20,7 @@
#include "config.h"
#include "EditorClientBlackBerry.h"
+#include "AutofillManager.h"
#include "DOMSupport.h"
#include "DumpRenderTreeClient.h"
#include "EditCommand.h"
@@ -511,9 +512,10 @@
notImplemented();
}
-void EditorClientBlackBerry::textDidChangeInTextField(Element*)
+void EditorClientBlackBerry::textDidChangeInTextField(Element* element)
{
- notImplemented();
+ if (HTMLInputElement* inputElement = element->toInputElement())
+ m_webPagePrivate->m_autofillManager->didChangeInTextField(inputElement);
}
bool EditorClientBlackBerry::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (116602 => 116603)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-05-10 03:44:23 UTC (rev 116602)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-05-10 03:58:29 UTC (rev 116603)
@@ -19,6 +19,7 @@
#include "config.h"
#include "FrameLoaderClientBlackBerry.h"
+#include "AutofillManager.h"
#include "BackForwardController.h"
#include "BackForwardListImpl.h"
#include "BackingStoreClient.h"
@@ -704,10 +705,12 @@
void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
{
+ if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) {
+ m_webPagePrivate->m_autofillManager->saveTextFields(formState->form());
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
- if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(formState->form()));
#endif
+ }
// FIXME: Stub.
(m_frame->loader()->policyChecker()->*function)(PolicyUse);
@@ -715,12 +718,12 @@
void FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState)
{
+ if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) {
+ m_webPagePrivate->m_autofillManager->saveTextFields(prpFormState->form());
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
- if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
- credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form()));
-#else
- notImplemented();
+ credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form()));
#endif
+ }
}
PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, const String& name