Title: [142750] trunk/Source/WebKit2
Revision
142750
Author
[email protected]
Date
2013-02-13 08:16:45 -0800 (Wed, 13 Feb 2013)

Log Message

[EFL][WK2] Introduce WKViewClient C API
https://bugs.webkit.org/show_bug.cgi?id=109559

Reviewed by Anders Carlsson.

This patch introduces the WKViewClient C API for EFL's WKView. The purpose of
this new C API is to eventually remove the interdependency between EFL's
PageClient and EwkView. When completed, PageClient should only interact with
WebView and not be aware of EwkView so that we have a clean separation between
internal WebKit2 classes and our EFL Ewk API implementation.

This patch is only a first step towards this goal as there is a lot of work
to do to achieve complete separation between EwkView and PageClient. The purpose
of this patch is to introduce the needed architecture which will later be
extended by introducing new WKViewClient callbacks.

* PlatformEfl.cmake: Add new ViewClientEfl.cpp and WebViewClient.cpp to EFL's CMake
configuration.
* UIProcess/API/C/efl/WKView.cpp:
(WKViewSetViewClient):
* UIProcess/API/C/efl/WKView.h: Introduce new WKViewClient C API.
* UIProcess/API/efl/EwkView.cpp:
(EwkView::EwkView): Initialize ViewClientEfl.
* UIProcess/API/efl/EwkView.h: Add new ViewClientEfl member.
(WebKit):
(EwkView):
* UIProcess/API/efl/EwkViewCallbacks.h: Update ContentsSizeChanged smart callback to
accept a WKSize in parameter instead of an IntRect.
* UIProcess/efl/PageClientBase.cpp: Start calling WKViewClient callbacks instead of
interacting directly with EwkView to avoid violating API layering.
(WebKit::PageClientBase::view):
(WebKit::PageClientBase::setViewNeedsDisplay):
* UIProcess/efl/PageClientBase.h:
(WebKit):
(PageClientBase):
* UIProcess/efl/PageClientDefaultImpl.cpp: Start calling WKViewClient callbacks instead of
interacting directly with EwkView to avoid violating API layering.
(WebKit::PageClientDefaultImpl::didChangeContentsSize):
* UIProcess/efl/PageClientLegacyImpl.cpp: Start calling WKViewClient callbacks instead of
interacting directly with EwkView to avoid violating API layering.
(WebKit::PageClientLegacyImpl::didChangeContentsSize):
* UIProcess/efl/ViewClientEfl.cpp:
(WebKit):
(WebKit::ViewClientEfl::toEwkView):
(WebKit::ViewClientEfl::viewNeedsDisplay):
(WebKit::ViewClientEfl::didChangeContentsSize):
(WebKit::ViewClientEfl::ViewClientEfl):
(WebKit::ViewClientEfl::~ViewClientEfl):
* UIProcess/efl/ViewClientEfl.h: Introduce new ViewClientEfl which handles WKViewClient callbacks
and interacts with EwkView.
(WebKit):
(ViewClientEfl):
(WebKit::ViewClientEfl::create):
* UIProcess/efl/WebView.cpp:
(WebKit::WebView::initializeClient):
(WebKit):
(WebKit::WebView::setViewNeedsDisplay):
(WebKit::WebView::didChangeContentsSize):
* UIProcess/efl/WebView.h: Add new WebViewClient member and corresponding methods to interact
with it.
(WebView):
* UIProcess/efl/WebViewClient.cpp:
(WebKit):
(WebKit::WebViewClient::viewNeedsDisplay):
(WebKit::WebViewClient::didChangeContentsSize):
* UIProcess/efl/WebViewClient.h: Add new WebViewClient APIClient for WKViewClient.
(WebCore):
(WebKit):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (142749 => 142750)


--- trunk/Source/WebKit2/ChangeLog	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-13 16:16:45 UTC (rev 142750)
@@ -1,3 +1,74 @@
+2013-02-13  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] Introduce WKViewClient C API
+        https://bugs.webkit.org/show_bug.cgi?id=109559
+
+        Reviewed by Anders Carlsson.
+
+        This patch introduces the WKViewClient C API for EFL's WKView. The purpose of
+        this new C API is to eventually remove the interdependency between EFL's
+        PageClient and EwkView. When completed, PageClient should only interact with
+        WebView and not be aware of EwkView so that we have a clean separation between
+        internal WebKit2 classes and our EFL Ewk API implementation.
+
+        This patch is only a first step towards this goal as there is a lot of work
+        to do to achieve complete separation between EwkView and PageClient. The purpose
+        of this patch is to introduce the needed architecture which will later be
+        extended by introducing new WKViewClient callbacks.
+
+        * PlatformEfl.cmake: Add new ViewClientEfl.cpp and WebViewClient.cpp to EFL's CMake
+        configuration.
+        * UIProcess/API/C/efl/WKView.cpp:
+        (WKViewSetViewClient):
+        * UIProcess/API/C/efl/WKView.h: Introduce new WKViewClient C API.
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::EwkView): Initialize ViewClientEfl.
+        * UIProcess/API/efl/EwkView.h: Add new ViewClientEfl member.
+        (WebKit):
+        (EwkView):
+        * UIProcess/API/efl/EwkViewCallbacks.h: Update ContentsSizeChanged smart callback to
+        accept a WKSize in parameter instead of an IntRect.
+        * UIProcess/efl/PageClientBase.cpp: Start calling WKViewClient callbacks instead of
+        interacting directly with EwkView to avoid violating API layering.
+        (WebKit::PageClientBase::view):
+        (WebKit::PageClientBase::setViewNeedsDisplay):
+        * UIProcess/efl/PageClientBase.h:
+        (WebKit):
+        (PageClientBase):
+        * UIProcess/efl/PageClientDefaultImpl.cpp: Start calling WKViewClient callbacks instead of
+        interacting directly with EwkView to avoid violating API layering.
+        (WebKit::PageClientDefaultImpl::didChangeContentsSize):
+        * UIProcess/efl/PageClientLegacyImpl.cpp: Start calling WKViewClient callbacks instead of
+        interacting directly with EwkView to avoid violating API layering.
+        (WebKit::PageClientLegacyImpl::didChangeContentsSize):
+        * UIProcess/efl/ViewClientEfl.cpp:
+        (WebKit):
+        (WebKit::ViewClientEfl::toEwkView):
+        (WebKit::ViewClientEfl::viewNeedsDisplay):
+        (WebKit::ViewClientEfl::didChangeContentsSize):
+        (WebKit::ViewClientEfl::ViewClientEfl):
+        (WebKit::ViewClientEfl::~ViewClientEfl):
+        * UIProcess/efl/ViewClientEfl.h: Introduce new ViewClientEfl which handles WKViewClient callbacks
+        and interacts with EwkView.
+        (WebKit):
+        (ViewClientEfl):
+        (WebKit::ViewClientEfl::create):
+        * UIProcess/efl/WebView.cpp:
+        (WebKit::WebView::initializeClient):
+        (WebKit):
+        (WebKit::WebView::setViewNeedsDisplay):
+        (WebKit::WebView::didChangeContentsSize):
+        * UIProcess/efl/WebView.h: Add new WebViewClient member and corresponding methods to interact
+        with it.
+        (WebView):
+        * UIProcess/efl/WebViewClient.cpp:
+        (WebKit):
+        (WebKit::WebViewClient::viewNeedsDisplay):
+        (WebKit::WebViewClient::didChangeContentsSize):
+        * UIProcess/efl/WebViewClient.h: Add new WebViewClient APIClient for WKViewClient.
+        (WebCore):
+        (WebKit):
+
 2013-02-13  Mikhail Pozdnyakov  <[email protected]>
 
         [WK2][EFL][WTR] Regression(r141836): WTR crashes on exit

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (142749 => 142750)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2013-02-13 16:16:45 UTC (rev 142750)
@@ -99,6 +99,7 @@
     UIProcess/efl/RequestManagerClientEfl.cpp
     UIProcess/efl/TextCheckerEfl.cpp
     UIProcess/efl/VibrationClientEfl.cpp
+    UIProcess/efl/ViewClientEfl.cpp
     UIProcess/efl/WebContextEfl.cpp
     UIProcess/efl/WebContextMenuProxyEfl.cpp
     UIProcess/efl/WebFullScreenManagerProxyEfl.cpp
@@ -108,6 +109,7 @@
     UIProcess/efl/WebPreferencesEfl.cpp
     UIProcess/efl/WebProcessProxyEfl.cpp
     UIProcess/efl/WebView.cpp
+    UIProcess/efl/WebViewClient.cpp
 
     UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp
     UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -52,6 +52,11 @@
     toImpl(viewRef)->initialize();
 }
 
+void WKViewSetViewClient(WKViewRef viewRef, const WKViewClient* client)
+{
+    toImpl(viewRef)->initializeClient(client);
+}
+
 WKPageRef WKViewGetPage(WKViewRef viewRef)
 {
     return toImpl(viewRef)->pageRef();

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -21,6 +21,7 @@
 #define WKView_h
 
 #include <WebKit2/WKBase.h>
+#include <WebKit2/WKGeometry.h>
 
 #if USE(EO)
 typedef struct _Eo Evas;
@@ -34,11 +35,27 @@
 extern "C" {
 #endif
 
+typedef void (*WKViewViewNeedsDisplayCallback)(WKViewRef view, WKRect area, const void* clientInfo);
+typedef void (*WKViewPageDidChangeContentsSizeCallback)(WKViewRef view, WKSize size, const void* clientInfo);
+
+struct WKViewClient {
+    int                                              version;
+    const void*                                      clientInfo;
+
+    // Version 0
+    WKViewViewNeedsDisplayCallback                   viewNeedsDisplay;
+    WKViewPageDidChangeContentsSizeCallback          didChangeContentsSize;
+};
+typedef struct WKViewClient WKViewClient;
+
+enum { kWKViewClientCurrentVersion = 0 };
+
 WK_EXPORT WKViewRef WKViewCreate(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
 
 WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
 
 WK_EXPORT void WKViewInitialize(WKViewRef);
+WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*);
 
 WK_EXPORT WKPageRef WKViewGetPage(WKViewRef);
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -37,6 +37,7 @@
 #include "PagePolicyClientEfl.h"
 #include "PageUIClientEfl.h"
 #include "SnapshotImageGL.h"
+#include "ViewClientEfl.h"
 #include "WKDictionary.h"
 #include "WKGeometry.h"
 #include "WKNumber.h"
@@ -232,6 +233,7 @@
     , m_contextMenuClient(ContextMenuClientEfl::create(this))
     , m_findClient(FindClientEfl::create(this))
     , m_formClient(FormClientEfl::create(this))
+    , m_viewClient(ViewClientEfl::create(this))
 #if ENABLE(VIBRATION)
     , m_vibrationClient(VibrationClientEfl::create(this))
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -61,6 +61,7 @@
 class PageLoadClientEfl;
 class PagePolicyClientEfl;
 class PageUIClientEfl;
+class ViewClientEfl;
 class WebContextMenuItemData;
 class WebContextMenuProxyEfl;
 class WebPageGroup;
@@ -267,6 +268,7 @@
     OwnPtr<WebKit::ContextMenuClientEfl> m_contextMenuClient;
     OwnPtr<WebKit::FindClientEfl> m_findClient;
     OwnPtr<WebKit::FormClientEfl> m_formClient;
+    OwnPtr<WebKit::ViewClientEfl> m_viewClient;
 #if ENABLE(VIBRATION)
     OwnPtr<WebKit::VibrationClientEfl> m_vibrationClient;
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -28,8 +28,9 @@
 
 #include "WKEinaSharedString.h"
 #include "ewk_private.h"
+#include "ewk_view.h"
 #include <Evas.h>
-#include <WebCore/IntSize.h>
+#include <WebKit2/WKGeometry.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -40,9 +41,6 @@
 typedef struct EwkObject Ewk_Navigation_Policy_Decision;
 typedef struct EwkError Ewk_Error;
 
-struct Ewk_Download_Job_Error;
-struct Ewk_CSS_Size;
-
 namespace EwkViewCallbacks {
 
 enum CallbackType {
@@ -141,9 +139,9 @@
         evas_object_smart_callback_call(m_object, CallBackInfo<callbackType>::name(), size);
     }
 
-    void call(const WebCore::IntSize& arg)
+    void call(const WKSize& arg)
     {
-        Ewk_CSS_Size size = { arg.width(), arg.height() };
+        Ewk_CSS_Size size = { arg.width, arg.height };
         call(&size);
     }
 };

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientBase.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -61,9 +61,11 @@
 {
 }
 
-EwkView* PageClientBase::view() const
+WebView* PageClientBase::view()
 {
-    return m_view;
+    // FIXME: This is temporary. In the future, m_view should be
+    // a WebView instead of an EwkView.
+    return toImpl(m_view->wkView());
 }
 
 // PageClient
@@ -73,9 +75,9 @@
     return drawingArea.release();
 }
 
-void PageClientBase::setViewNeedsDisplay(const WebCore::IntRect&)
+void PageClientBase::setViewNeedsDisplay(const WebCore::IntRect& area)
 {
-    m_view->scheduleUpdateDisplay();
+    view()->setViewNeedsDisplay(area);
 }
 
 void PageClientBase::displayView()

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientBase.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -34,6 +34,8 @@
 
 namespace WebKit {
 
+class WebView;
+
 class PageClientBase : public PageClient {
 public:
     virtual ~PageClientBase();
@@ -42,7 +44,7 @@
     virtual void updateViewportSize() = 0;
     virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
 
-    EwkView* view() const;
+    WebView* view();
 
 protected:
     explicit PageClientBase(EwkView*);
@@ -112,7 +114,7 @@
     virtual void pageTransitionViewportReady() = 0;
 
 protected:
-    EwkView* m_view;
+    EwkView* m_view; // FIXME: Should be a WebView when possible.
     DefaultUndoController m_undoController;
 };
 

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientDefaultImpl.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -81,7 +81,7 @@
 {
     ASSERT(m_pageViewportController);
     m_pageViewportController->didChangeContentsSize(size);
-    m_view->smartCallback<ContentsSizeChanged>().call(size);
+    view()->didChangeContentsSize(size);
 }
 
 void PageClientDefaultImpl::pageDidRequestScroll(const IntPoint& position)

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -71,8 +71,7 @@
 
 void PageClientLegacyImpl::didChangeContentsSize(const WebCore::IntSize& size)
 {
-    m_view->scheduleUpdateDisplay();
-    m_view->smartCallback<ContentsSizeChanged>().call(size);
+    view()->didChangeContentsSize(size);
 }
 
 void PageClientLegacyImpl::pageDidRequestScroll(const IntPoint& position)

Copied: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp (from rev 142749, trunk/Source/WebKit2/UIProcess/efl/WebView.h) (0 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
+ * 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 "ViewClientEfl.h"
+
+#include "EwkView.h"
+#include "WKView.h"
+
+using namespace EwkViewCallbacks;
+
+namespace WebKit {
+
+EwkView* ViewClientEfl::toEwkView(const void* clientInfo)
+{
+    return static_cast<ViewClientEfl*>(const_cast<void*>(clientInfo))->m_view;
+}
+
+void ViewClientEfl::viewNeedsDisplay(WKViewRef, WKRect, const void* clientInfo)
+{
+    toEwkView(clientInfo)->scheduleUpdateDisplay();
+}
+
+void ViewClientEfl::didChangeContentsSize(WKViewRef, WKSize size, const void* clientInfo)
+{
+    EwkView* ewkView = toEwkView(clientInfo);
+    ewkView->scheduleUpdateDisplay();
+    ewkView->smartCallback<ContentsSizeChanged>().call(size);
+}
+
+ViewClientEfl::ViewClientEfl(EwkView* view)
+    : m_view(view)
+{
+    ASSERT(m_view);
+
+    WKViewClient viewClient;
+    memset(&viewClient, 0, sizeof(WKViewClient));
+    viewClient.version = kWKViewClientCurrentVersion;
+    viewClient.clientInfo = this;
+    viewClient.didChangeContentsSize = didChangeContentsSize;
+    viewClient.viewNeedsDisplay = viewNeedsDisplay;
+
+    WKViewSetViewClient(m_view->wkView(), &viewClient);
+}
+
+ViewClientEfl::~ViewClientEfl()
+{
+    WKViewSetViewClient(m_view->wkView(), 0);
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h (from rev 142749, trunk/Source/WebKit2/UIProcess/efl/WebView.h) (0 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
+ * 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 ViewClientEfl_h
+#define ViewClientEfl_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKGeometry.h>
+#include <wtf/PassOwnPtr.h>
+
+class EwkView;
+
+namespace WebKit {
+
+class ViewClientEfl {
+public:
+    static PassOwnPtr<ViewClientEfl> create(EwkView* view)
+    {
+        return adoptPtr(new ViewClientEfl(view));
+    }
+
+    ~ViewClientEfl();
+
+private:
+    explicit ViewClientEfl(EwkView*);
+
+    static EwkView* toEwkView(const void* clientInfo);
+    static void viewNeedsDisplay(WKViewRef, WKRect area, const void* clientInfo);
+    static void didChangeContentsSize(WKViewRef, WKSize, const void* clientInfo);
+
+    EwkView* m_view;
+};
+
+} // namespace WebKit
+
+#endif // ViewClientEfl_h

Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.cpp (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/WebView.cpp	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -97,4 +97,19 @@
     m_webPageProxy->resumeActiveDOMObjectsAndAnimations();
 }
 
+void WebView::initializeClient(const WKViewClient* client)
+{
+    m_client.initialize(client);
+}
+
+void WebView::setViewNeedsDisplay(const WebCore::IntRect& area)
+{
+    m_client.viewNeedsDisplay(this, area);
+}
+
+void WebView::didChangeContentsSize(const WebCore::IntSize& size)
+{
+    m_client.didChangeContentsSize(this, size);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (142749 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/WebView.h	2013-02-13 16:12:44 UTC (rev 142749)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -32,6 +32,7 @@
 #include "WebPageGroup.h"
 #include "WebPageProxy.h"
 #include "WebPreferences.h"
+#include "WebViewClient.h"
 
 namespace WebKit {
 
@@ -56,6 +57,11 @@
     void suspendActiveDOMObjectsAndAnimations();
     void resumeActiveDOMObjectsAndAnimations();
 
+    // View client.
+    void initializeClient(const WKViewClient*);
+    void setViewNeedsDisplay(const WebCore::IntRect&);
+    void didChangeContentsSize(const WebCore::IntSize&);
+
     // FIXME: Remove when possible.
     Evas_Object* evasObject() { return m_evasObject; }
     WebPageProxy* page() { return m_webPageProxy.get(); }
@@ -63,6 +69,7 @@
 private:
     virtual Type type() const { return APIType; }
 
+    WebViewClient m_client;
     RefPtr<WebPageProxy> m_webPageProxy;
     Evas_Object* m_evasObject;
 };

Copied: trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp (from rev 142749, trunk/Source/WebKit2/UIProcess/efl/WebView.h) (0 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp	2013-02-13 16:16:45 UTC (rev 142750)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
+ * 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 "WebViewClient.h"
+
+#include "WKAPICast.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebViewClient::viewNeedsDisplay(WebView* view, const IntRect& area)
+{
+    if (!m_client.viewNeedsDisplay)
+        return;
+
+    m_client.viewNeedsDisplay(toAPI(view), toAPI(area), m_client.clientInfo);
+}
+
+void WebViewClient::didChangeContentsSize(WebView* view, const IntSize& size)
+{
+    if (!m_client.didChangeContentsSize)
+        return;
+
+    m_client.didChangeContentsSize(toAPI(view), toAPI(size), m_client.clientInfo);
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h (from rev 142749, trunk/Source/WebKit2/UIProcess/efl/WebView.h) (0 => 142750)


--- trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h	2013-02-13 16:16:45 UTC (rev 142750)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
+ * 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 WebViewClient_h
+#define WebViewClient_h
+
+#include "APIClient.h"
+#include "WKView.h"
+
+namespace WebCore {
+class IntRect;
+class IntSize;
+}
+
+namespace WebKit {
+
+class WebView;
+
+class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
+public:
+    void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
+    void didChangeContentsSize(WebView*, const WebCore::IntSize&);
+};
+
+} // namespace WebKit
+
+#endif // WebViewClient_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to