Title: [123742] trunk/Source/WebKit2
Revision
123742
Author
commit-qu...@webkit.org
Date
2012-07-26 06:28:25 -0700 (Thu, 26 Jul 2012)

Log Message

[EFL][WK2] Add form client for Ewk_View
https://bugs.webkit.org/show_bug.cgi?id=92358

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-07-26
Reviewed by Kenneth Rohde Christiansen.

Implement a form client for EFL port in order to
send a "form,request,new" signal on the Ewk_View
whenever a form will be submitted.

The Ewk_Form_Submission_Request type is
introduced to provide the client with information
about the form (e.g. text fields contained in the
form) and to submit it.

This is typically used to store login information
that can be used later to pre-fill the form.

* PlatformEfl.cmake:
* UIProcess/API/efl/EWebKit2.h:
* UIProcess/API/efl/ewk_form_submission_request.cpp: Added.
(_Ewk_Form_Submission_Request):
(_Ewk_Form_Submission_Request::_Ewk_Form_Submission_Request):
(_Ewk_Form_Submission_Request::~_Ewk_Form_Submission_Request):
(ewk_form_submission_request_ref):
(ewk_form_submission_request_unref):
(ewk_form_submission_request_field_names_get):
(ewk_form_submission_request_field_value_get):
(ewk_form_submission_request_submit):
(ewk_form_submission_request_new):
* UIProcess/API/efl/ewk_form_submission_request.h: Added.
* UIProcess/API/efl/ewk_form_submission_request_private.h: Added.
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_base_add):
(ewk_view_form_submission_request_new):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/API/efl/ewk_view_form_client.cpp: Added.
(willSubmitForm):
(ewk_view_form_client_attach):
* UIProcess/API/efl/ewk_view_form_client_private.h: Added.
* UIProcess/API/efl/ewk_view_private.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (123741 => 123742)


--- trunk/Source/WebKit2/ChangeLog	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-26 13:28:25 UTC (rev 123742)
@@ -1,3 +1,46 @@
+2012-07-26  Christophe Dumez  <christophe.du...@intel.com>
+
+        [EFL][WK2] Add form client for Ewk_View
+        https://bugs.webkit.org/show_bug.cgi?id=92358
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Implement a form client for EFL port in order to
+        send a "form,request,new" signal on the Ewk_View
+        whenever a form will be submitted.
+
+        The Ewk_Form_Submission_Request type is
+        introduced to provide the client with information
+        about the form (e.g. text fields contained in the
+        form) and to submit it.
+
+        This is typically used to store login information
+        that can be used later to pre-fill the form.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/EWebKit2.h:
+        * UIProcess/API/efl/ewk_form_submission_request.cpp: Added.
+        (_Ewk_Form_Submission_Request):
+        (_Ewk_Form_Submission_Request::_Ewk_Form_Submission_Request):
+        (_Ewk_Form_Submission_Request::~_Ewk_Form_Submission_Request):
+        (ewk_form_submission_request_ref):
+        (ewk_form_submission_request_unref):
+        (ewk_form_submission_request_field_names_get):
+        (ewk_form_submission_request_field_value_get):
+        (ewk_form_submission_request_submit):
+        (ewk_form_submission_request_new):
+        * UIProcess/API/efl/ewk_form_submission_request.h: Added.
+        * UIProcess/API/efl/ewk_form_submission_request_private.h: Added.
+        * UIProcess/API/efl/ewk_view.cpp:
+        (ewk_view_base_add):
+        (ewk_view_form_submission_request_new):
+        * UIProcess/API/efl/ewk_view.h:
+        * UIProcess/API/efl/ewk_view_form_client.cpp: Added.
+        (willSubmitForm):
+        (ewk_view_form_client_attach):
+        * UIProcess/API/efl/ewk_view_form_client_private.h: Added.
+        * UIProcess/API/efl/ewk_view_private.h:
+
 2012-07-26  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         [WK2] WebPage::handleEditingKeyboardEvent does not check whether the node allows editing.

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123741 => 123742)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-26 13:28:25 UTC (rev 123742)
@@ -43,6 +43,7 @@
     UIProcess/API/efl/ewk_context.cpp
     UIProcess/API/efl/ewk_context_request_manager_client.cpp
     UIProcess/API/efl/ewk_cookie_manager.cpp
+    UIProcess/API/efl/ewk_form_submission_request.cpp
     UIProcess/API/efl/ewk_intent.cpp
     UIProcess/API/efl/ewk_intent_service.cpp
     UIProcess/API/efl/ewk_main.cpp
@@ -51,6 +52,7 @@
     UIProcess/API/efl/ewk_url_response.cpp
     UIProcess/API/efl/ewk_url_scheme_request.cpp
     UIProcess/API/efl/ewk_view.cpp
+    UIProcess/API/efl/ewk_view_form_client.cpp
     UIProcess/API/efl/ewk_view_loader_client.cpp
     UIProcess/API/efl/ewk_view_policy_client.cpp
     UIProcess/API/efl/ewk_view_resource_load_client.cpp
@@ -183,6 +185,7 @@
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h"
+    "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_form_submission_request.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_main.h"

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (123741 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -29,6 +29,7 @@
 
 #include "ewk_context.h"
 #include "ewk_cookie_manager.h"
+#include "ewk_form_submission_request.h"
 #include "ewk_intent.h"
 #include "ewk_intent_service.h"
 #include "ewk_main.h"

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp (0 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp	2012-07-26 13:28:25 UTC (rev 123742)
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_form_submission_request.h"
+
+#include "WKAPICast.h"
+#include "WKArray.h"
+#include "WKBase.h"
+#include "WKDictionary.h"
+#include "WKFormSubmissionListener.h"
+#include "WKRetainPtr.h"
+#include "WKString.h"
+#include "ewk_form_submission_request_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Form_Submission_Request
+ * @brief Contains the form submission request data.
+ */
+struct _Ewk_Form_Submission_Request {
+    unsigned int __ref; /**< the reference count of the object */
+    WKRetainPtr<WKDictionaryRef> wkValues;
+    WKRetainPtr<WKFormSubmissionListenerRef> wkListener;
+    bool handledRequest;
+
+    _Ewk_Form_Submission_Request(WKDictionaryRef values, WKFormSubmissionListenerRef listener)
+        : __ref(1)
+        , wkValues(values)
+        , wkListener(listener)
+        , handledRequest(false)
+    { }
+
+    ~_Ewk_Form_Submission_Request()
+    {
+        ASSERT(!__ref);
+
+        // Make sure the request is always handled before destroying.
+        if (!handledRequest)
+            WKFormSubmissionListenerContinue(wkListener.get());
+    }
+};
+
+void ewk_form_submission_request_ref(Ewk_Form_Submission_Request* request)
+{
+    EINA_SAFETY_ON_NULL_RETURN(request);
+    ++request->__ref;
+}
+
+void ewk_form_submission_request_unref(Ewk_Form_Submission_Request* request)
+{
+    EINA_SAFETY_ON_NULL_RETURN(request);
+
+    if (--request->__ref)
+        return;
+
+    delete request;
+}
+
+Eina_List* ewk_form_submission_request_field_names_get(Ewk_Form_Submission_Request* request)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+
+    Eina_List* names = 0;
+
+    WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(request->wkValues.get()));
+    const size_t numKeys = WKArrayGetSize(wkKeys.get());
+    for (size_t i = 0; i < numKeys; ++i) {
+        WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
+        names = eina_list_append(names, eina_stringshare_add(toImpl(wkKey)->string().utf8().data()));
+    }
+
+    return names;
+}
+
+const char* ewk_form_submission_request_field_value_get(Ewk_Form_Submission_Request* request, const char* name)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(name, 0);
+
+    WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(name));
+    WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(request->wkValues.get(), wkKey.get()));
+
+    return wkValue ? eina_stringshare_add(toImpl(wkValue)->string().utf8().data()) : 0;
+}
+
+Eina_Bool ewk_form_submission_request_submit(Ewk_Form_Submission_Request* request)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, false);
+
+    WKFormSubmissionListenerContinue(request->wkListener.get());
+    request->handledRequest = true;
+
+    return true;
+}
+
+/**
+ * @internal ewk_form_submission_request_new
+ * Creates a Ewk_Form_Submission_Request from a dictionary and a WKFormSubmissionListenerRef.
+ */
+Ewk_Form_Submission_Request* ewk_form_submission_request_new(WKDictionaryRef values, WKFormSubmissionListenerRef listener)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(values, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(listener, 0);
+
+    return new Ewk_Form_Submission_Request(values, listener);
+}

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h (0 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file    ewk_form_submission_request.h
+ * @brief   Describes the Ewk Form Submission Request API.
+ *
+ * @note Ewk_Form_Submission_Request provides information regarding
+ * a form about the be submitted, in particular its text fields.
+ */
+
+#ifndef ewk_form_submission_request_h
+#define ewk_form_submission_request_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Form_Submission_Request */
+typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param request the request object to increase the reference count
+ */
+EAPI void ewk_form_submission_request_ref(Ewk_Form_Submission_Request *request);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count reaches 0, the request is freed.
+ *
+ * If the reference count reaches 0 and the form request has not be submitted yet,
+ * ewk_form_submission_request_submit() will be called automatically before
+ * destruction.
+ *
+ * @param request the request object to decrease the reference count
+ */
+EAPI void ewk_form_submission_request_unref(Ewk_Form_Submission_Request *request);
+
+/**
+ * Returns the list of field names contained in the form associated to @a request.
+ *
+ * @param request the request object to query.
+ *
+ * @return a #Eina_List with the form text fields names, or @c NULL in case of error.
+ * The items of the list are guaranteed to be stringshared so use eina_stringshare_add()
+ * instead of strdup() to copy them and free them using eina_stringshare_del().
+ *
+ * @see ewk_form_submission_request_field_value_get()
+ */
+EAPI Eina_List *ewk_form_submission_request_field_names_get(Ewk_Form_Submission_Request *request);
+
+/**
+ * Returns the value of specific field contained in the form associated to @a request.
+ *
+ * @param request the request object to query.
+ * @param name name of the field to query the value for.
+ *
+ * @return a #Eina_List with the form text fields names, or @c NULL in case of error.
+ * The string returned is guaranteed to be stringshared. You need to call
+ * eina_stringshare_del() on the returned value once you are done with it.
+ *
+ * @see ewk_form_submission_request_field_names_get()
+ */
+EAPI const char *ewk_form_submission_request_field_value_get(Ewk_Form_Submission_Request *request, const char *name);
+
+/**
+ * Continues the form request submission.
+ *
+ * If you don't call this function explicitly, the form request will be submitted
+ * upon @a request object destruction.
+ *
+ * @param request the request object to submit.
+ *
+ * @return @c EINA_TRUE is if successful, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool ewk_form_submission_request_submit(Ewk_Form_Submission_Request *request);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_form_submission_request_h

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h (0 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_form_submission_request_private_h
+#define ewk_form_submission_request_private_h
+
+typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request;
+
+Ewk_Form_Submission_Request* ewk_form_submission_request_new(WKDictionaryRef values, WKFormSubmissionListenerRef);
+
+#endif // ewk_form_submission_request_private_h

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (123741 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-07-26 13:28:25 UTC (rev 123742)
@@ -32,6 +32,7 @@
 #include "ewk_context.h"
 #include "ewk_context_private.h"
 #include "ewk_intent_private.h"
+#include "ewk_view_form_client_private.h"
 #include "ewk_view_loader_client_private.h"
 #include "ewk_view_policy_client_private.h"
 #include "ewk_view_private.h"
@@ -547,6 +548,7 @@
     }
 
     priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
+    ewk_view_form_client_attach(toAPI(priv->pageClient->page()), ewkView);
     ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView);
     ewk_view_policy_client_attach(toAPI(priv->pageClient->page()), ewkView);
     ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView);
@@ -954,6 +956,17 @@
 
 /**
  * @internal
+ * Reports that a form request is about to be submitted.
+ *
+ * Emits signal: "form,submission,request" with pointer to Ewk_Form_Submission_Request.
+ */
+void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request* request)
+{
+    evas_object_smart_callback_call(ewkView, "form,submission,request", request);
+}
+
+/**
+ * @internal
  * Reports load failed with error information.
  *
  * Emits signal: "load,error" with pointer to Ewk_Web_Error.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (123741 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -26,6 +26,15 @@
  *
  * The following signals (see evas_object_smart_callback_add()) are emitted:
  *
+ * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted.
+ *   The Ewk_Form_Submission_Request passed contains information about the text fields of the form. This
+ *   is typically used to store login information that can be used later to pre-fill the form.
+ *   The form will not be submitted until ewk_form_submission_request_submit() is called.
+ *   It is possible to handle the form submission request asynchronously, by simply calling
+ *   ewk_form_submission_request_ref() on the request and calling ewk_form_submission_request_submit()
+ *   when done to continue with the form submission. If the last reference is removed on a
+ *   #Ewk_Form_Submission_Request and the form has not been submitted yet,
+ *   ewk_form_submission_request_submit() will be called automatically.
  * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request.
  * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
  * - "load,error", const Ewk_Web_Error*: reports main frame load failed.

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp (0 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp	2012-07-26 13:28:25 UTC (rev 123742)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WKPage.h"
+#include "ewk_form_submission_request.h"
+#include "ewk_form_submission_request_private.h"
+#include "ewk_view_form_client_private.h"
+#include "ewk_view_private.h"
+
+static void willSubmitForm(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo)
+{
+    Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+
+    Ewk_Form_Submission_Request* request = ewk_form_submission_request_new(values, listener);
+    ewk_view_form_submission_request_new(ewkView, request);
+    ewk_form_submission_request_unref(request);
+}
+
+void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
+{
+    WKPageFormClient formClient;
+    memset(&formClient, 0, sizeof(WKPageFormClient));
+    formClient.version = kWKPageFormClientCurrentVersion;
+    formClient.clientInfo = ewkView;
+    formClient.willSubmitForm = willSubmitForm;
+    WKPageSetPageFormClient(pageRef, &formClient);
+}

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h (0 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_view_form_client_private_h
+#define ewk_view_form_client_private_h
+
+#include <Evas.h>
+#include <WebKit2/WKBase.h>
+
+void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView);
+
+#endif // ewk_view_form_client_private_h

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h (123741 => 123742)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h	2012-07-26 13:20:40 UTC (rev 123741)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h	2012-07-26 13:28:25 UTC (rev 123742)
@@ -31,6 +31,7 @@
 class IntSize;
 }
 
+typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request;
 typedef struct _Ewk_Url_Request Ewk_Url_Request;
 typedef struct _Ewk_Url_Response Ewk_Url_Response;
 typedef struct _Ewk_Web_Error Ewk_Web_Error;
@@ -45,6 +46,7 @@
 
 void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor);
 void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect);
+void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request*);
 void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size);
 void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error);
 void ewk_view_load_finished(Evas_Object* ewkView);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to