[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 12:05:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2ff9d1960af788c93600e9aad211ef8cae90010b
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 13 23:44:43 2010 +0000

    Pass values map to willSubmitForm in WebKit2 API
    Part of <rdar://problem/8255932>
    https://bugs.webkit.org/show_bug.cgi?id=43995
    
    Reviewed by Brady Eidson.
    
    * Platform/CoreIPC/ArgumentCoders.h:
    (CoreIPC::):
    Add overload for std::pair.
    
    * Shared/ImmutableDictionary.h:
    (WebKit::ImmutableDictionary::adopt):
    Fix function signature by removing size parameter.
    
    * UIProcess/API/C/WKPage.h:
    Add dictionary parameter to callback.
    
    * UIProcess/WebFormClient.cpp:
    (WebKit::WebFormClient::willSubmitForm):
    Create an ImmutableDictionary from the vector of string pairs.
    
    * UIProcess/WebFormClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didReceiveMessage):
    (WebKit::WebPageProxy::willSubmitForm):
    * UIProcess/WebPageProxy.h:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
    Plumb through the values vector.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65341 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a08486a..55cb9df 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,38 @@
 
         Reviewed by Brady Eidson.
 
+        Pass values map to willSubmitForm in WebKit2 API
+        Part of <rdar://problem/8255932>
+        https://bugs.webkit.org/show_bug.cgi?id=43995
+
+        * Platform/CoreIPC/ArgumentCoders.h:
+        (CoreIPC::):
+        Add overload for std::pair.
+
+        * Shared/ImmutableDictionary.h:
+        (WebKit::ImmutableDictionary::adopt):
+        Fix function signature by removing size parameter.
+
+        * UIProcess/API/C/WKPage.h:
+        Add dictionary parameter to callback.
+
+        * UIProcess/WebFormClient.cpp:
+        (WebKit::WebFormClient::willSubmitForm):
+        Create an ImmutableDictionary from the vector of string pairs.
+
+        * UIProcess/WebFormClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        (WebKit::WebPageProxy::willSubmitForm):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
+        Plumb through the values vector.
+
+2010-08-13  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Brady Eidson.
+
         Add dictionary API type
         https://bugs.webkit.org/show_bug.cgi?id=43990
 
diff --git a/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
index c1fb86a..78077bb 100644
--- a/WebKit2/Platform/CoreIPC/ArgumentCoders.h
+++ b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
@@ -28,7 +28,7 @@
 
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
-
+#include <utility>
 #include <wtf/Vector.h>
 
 namespace CoreIPC {
@@ -45,6 +45,29 @@ template<typename T> struct SimpleArgumentCoder {
     }
 };
 
+template<typename T, typename U> struct ArgumentCoder<std::pair<T, U> > {
+    static void encode(ArgumentEncoder* encoder, const std::pair<T, U>& pair)
+    {
+        encoder->encode(pair.first);
+        encoder->encode(pair.second);
+    }
+
+    static bool decode(ArgumentDecoder* decoder, std::pair<T, U>& pair)
+    {
+        T first;
+        if (!decoder->decode(first))
+            return false;
+
+        U second;
+        if (!decoder->decode(second))
+            return false;
+
+        pair.first = first;
+        pair.second = second;
+        return true;
+    }
+};
+
 template<typename T> struct ArgumentCoder<Vector<T> > {
     static void encode(ArgumentEncoder* encoder, const Vector<T>& vector)
     {
@@ -59,7 +82,7 @@ template<typename T> struct ArgumentCoder<Vector<T> > {
         if (!decoder->decodeUInt64(size))
             return false;
 
-        // Before allocating the cector, make sure that the decoder buffer is big enough.
+        // Before allocating the vector, make sure that the decoder buffer is big enough.
         if (!decoder->bufferIsLargeEnoughtToContain<T>(size)) {
             decoder->markInvalid();
             return false;
diff --git a/WebKit2/Shared/ImmutableDictionary.h b/WebKit2/Shared/ImmutableDictionary.h
index 17f2fa4..4aabf25 100644
--- a/WebKit2/Shared/ImmutableDictionary.h
+++ b/WebKit2/Shared/ImmutableDictionary.h
@@ -46,7 +46,7 @@ public:
     {
         return adoptRef(new ImmutableDictionary);
     }
-    static PassRefPtr<ImmutableDictionary> adopt(MapType& map, size_t size)
+    static PassRefPtr<ImmutableDictionary> adopt(MapType& map)
     {
         return adoptRef(new ImmutableDictionary(map, Adopt));
     }
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index d128d4f..b4d7b21 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -114,7 +114,7 @@ struct WKPagePolicyClient {
 typedef struct WKPagePolicyClient WKPagePolicyClient;
 
 // Form Client.
-typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKFormSubmissionListenerRef listener, const void* clientInfo);
+typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKFormSubmissionListenerRef listener, const void* clientInfo);
 
 struct WKPageFormClient {
     int                                                                 version;
diff --git a/WebKit2/UIProcess/WebFormClient.cpp b/WebKit2/UIProcess/WebFormClient.cpp
index 6d5eff1..7c65fd2 100644
--- a/WebKit2/UIProcess/WebFormClient.cpp
+++ b/WebKit2/UIProcess/WebFormClient.cpp
@@ -25,9 +25,10 @@
 
 #include "WebFormClient.h"
 
+#include "ImmutableDictionary.h"
 #include "WKAPICast.h"
-
-using namespace WebCore;
+#include "WebString.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebKit {
 
@@ -44,12 +45,17 @@ void WebFormClient::initialize(const WKPageFormClient* client)
         memset(&m_pageFormClient, 0, sizeof(m_pageFormClient));
 }
 
-bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, WebFormSubmissionListenerProxy* listener)
+bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, WebFormSubmissionListenerProxy* listener)
 {
     if (!m_pageFormClient.willSubmitForm)
         return false;
 
-    m_pageFormClient.willSubmitForm(toRef(page), toRef(frame), toRef(sourceFrame), toRef(listener), m_pageFormClient.clientInfo);
+    ImmutableDictionary::MapType map;
+    for (size_t i = 0; i < textFieldValues.size(); ++i)
+        map.set(textFieldValues[i].first, WebString::create(textFieldValues[i].second));
+
+    RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map);
+    m_pageFormClient.willSubmitForm(toRef(page), toRef(frame), toRef(sourceFrame), toRef(textFieldsMap.get()), toRef(listener), m_pageFormClient.clientInfo);
     return true;
 }
 
diff --git a/WebKit2/UIProcess/WebFormClient.h b/WebKit2/UIProcess/WebFormClient.h
index f5d167b..a42f9fc 100644
--- a/WebKit2/UIProcess/WebFormClient.h
+++ b/WebKit2/UIProcess/WebFormClient.h
@@ -27,7 +27,9 @@
 #define WebFormClient_h
 
 #include "WKPage.h"
+#include <utility>
 #include <wtf/Forward.h>
+#include <wtf/Vector.h>
 
 namespace WebKit {
 
@@ -40,8 +42,8 @@ public:
     WebFormClient();
     void initialize(const WKPageFormClient*);
 
-    // FIXME: Add value dictionary and form element reference.
-    bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, WebFormSubmissionListenerProxy*); 
+    // FIXME: Add some type of form element reference or anotated user data.
+    bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, Vector<std::pair<String, String> >& textFieldValues, WebFormSubmissionListenerProxy*); 
 
 private:
     WKPageFormClient m_pageFormClient;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 93afaac..d5d9878 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -543,10 +543,11 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
         case WebPageProxyMessage::WillSubmitForm: {
             uint64_t frameID;
             uint64_t sourceFrameID;
+            Vector<std::pair<String, String> > textFieldValues;
             uint64_t listenerID;
-            if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, listenerID)))
+            if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID)))
                 return;
-            willSubmitForm(webFrame(frameID), webFrame(sourceFrameID), listenerID);
+            willSubmitForm(webFrame(frameID), webFrame(sourceFrameID), textFieldValues, listenerID);
             break;
         }
         
@@ -836,10 +837,10 @@ void WebPageProxy::decidePolicyForMIMEType(WebFrameProxy* frame, const String& M
 
 // FormClient
 
-void WebPageProxy::willSubmitForm(WebFrameProxy* frame, WebFrameProxy* sourceFrame, uint64_t listenerID)
+void WebPageProxy::willSubmitForm(WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, uint64_t listenerID)
 {
     RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
-    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, listener.get()))
+    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues, listener.get()))
         listener->continueSubmission();
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index c31e2dd..5eb483b 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -192,7 +192,7 @@ private:
     void decidePolicyForNewWindowAction(WebFrameProxy*, WebCore::NavigationType navigationType, const WTF::String& url, uint64_t listenerID);
     void decidePolicyForMIMEType(WebFrameProxy*, const WTF::String& MIMEType, const WTF::String& url, uint64_t listenerID);
 
-    void willSubmitForm(WebFrameProxy* frame, WebFrameProxy* frameSource, uint64_t listenerID);
+    void willSubmitForm(WebFrameProxy* frame, WebFrameProxy* frameSource, Vector<std::pair<WTF::String, WTF::String> >& textFieldValues, uint64_t listenerID);
 
     PassRefPtr<WebPageProxy> createNewPage();
     void showPage();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 898820c..acd1067 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -478,7 +478,7 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function,
     WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame();    
 
     WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
-                                            CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), listenerID));
+                                            CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), formState->textFieldValues(), listenerID));
 }
 
 void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list