[BlackBerry] The virtual keyboard hides part of Signing In dialog
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 17:12:37 +0000 (17:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 17:12:37 +0000 (17:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110836

Patch by Sean Wang <Xuewen.Wang@torchmobile.com.cn> on 2013-02-27
Reviewed by Yong Li.

PR # 283427 Internally reviewed by Mike Fenton.

Store form credentials before javascript "onSubmit" event and notify
webpage client to save credentials after that event since javascript
may check credentials and stop the submission in its event handler.

* WebCoreSupport/CredentialTransformData.cpp:
(WebCore::CredentialTransformData::CredentialTransformData):
(WebCore):
* WebCoreSupport/CredentialTransformData.h:
(CredentialTransformData):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):
* WebCoreSupport/FrameLoaderClientBlackBerry.h:
(FrameLoaderClientBlackBerry):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.cpp
Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.h
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h

index 8e3f1a1..7bf05a1 100644 (file)
@@ -1,3 +1,27 @@
+2013-02-27  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
+
+        [BlackBerry] The virtual keyboard hides part of Signing In dialog
+        https://bugs.webkit.org/show_bug.cgi?id=110836
+
+        Reviewed by Yong Li.
+
+        PR # 283427 Internally reviewed by Mike Fenton.
+
+        Store form credentials before javascript "onSubmit" event and notify
+        webpage client to save credentials after that event since javascript
+        may check credentials and stop the submission in its event handler.
+
+        * WebCoreSupport/CredentialTransformData.cpp:
+        (WebCore::CredentialTransformData::CredentialTransformData):
+        (WebCore):
+        * WebCoreSupport/CredentialTransformData.h:
+        (CredentialTransformData):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.h:
+        (FrameLoaderClientBlackBerry):
+
 2013-02-27  Mike Fenton  <mifenton@rim.com>
 
         [BlackBerry] Accept key events even when composing region is active.
index e602c4f..9cc0f96 100644 (file)
@@ -111,6 +111,14 @@ bool locateSpecificPasswords(Vector<HTMLInputElement*>& passwords, HTMLInputElem
 
 } // namespace
 
+CredentialTransformData::CredentialTransformData()
+    : m_userNameElement(0)
+    , m_passwordElement(0)
+    , m_oldPasswordElement(0)
+    , m_isValid(false)
+{
+}
+
 CredentialTransformData::CredentialTransformData(HTMLFormElement* form, bool isForSaving)
     : m_userNameElement(0)
     , m_passwordElement(0)
index 657b83a..861cba6 100644 (file)
@@ -29,6 +29,7 @@ namespace WebCore {
 struct CredentialTransformData {
     // If the provided form is suitable for password completion, isValid() will
     // return true;
+    CredentialTransformData();
     CredentialTransformData(HTMLFormElement*, bool isForSaving = false);
     CredentialTransformData(const KURL&, const ProtectionSpace&, const Credential&);
 
index 5386543..cb68ced 100644 (file)
@@ -772,16 +772,23 @@ void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction fun
 {
     // FIXME: Stub.
     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+    if (m_formCredentials.isValid())
+        credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, m_formCredentials);
+#endif
 }
 
 void FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState)
 {
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+    m_formCredentials = CredentialTransformData();
+#endif
     if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) {
         if (m_webPagePrivate->m_webSettings->isFormAutofillEnabled())
             m_webPagePrivate->m_autofillManager->saveTextFields(prpFormState->form());
 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
         if (m_webPagePrivate->m_webSettings->isCredentialAutofillEnabled())
-            credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form(), true));
+            m_formCredentials = CredentialTransformData(prpFormState->form(), true);
 #endif
     }
 }
index faab79b..12818e6 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef FrameLoaderClientBlackBerry_h
 #define FrameLoaderClientBlackBerry_h
 
+#include "CredentialTransformData.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameLoaderClient.h"
@@ -218,6 +219,9 @@ private:
     bool m_cancelLoadOnNextData;
 
     bool m_wasProvisionalLoadTriggeredByUserGesture;
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+    CredentialTransformData m_formCredentials;
+#endif
 };
 
 } // WebCore