Title: [91831] trunk/Source/WebKit2
Revision
91831
Author
[email protected]
Date
2011-07-27 03:24:08 -0700 (Wed, 27 Jul 2011)

Log Message

[Qt][WK2] Simplify the PageUIClient
https://bugs.webkit.org/show_bug.cgi?id=65198

Reviewed by Andreas Kling.

The only function of WKPageLoaderClient with a complete implementation
is qt_wk_setStatusText(). The other functions were what is left from
before the refactoring of QWKPage.

This patch removes the unused functions to simplify the client. Since the dependency
on QtWebPageProxy is removed from that client, it now calls the ViewInterface directly.

* UIProcess/qt/ClientImpl.cpp:
(toViewInterface):
(qt_wk_setStatusText):
* UIProcess/qt/ClientImpl.h:
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::QtWebPageProxy):
(QtWebPageProxy::init):
* UIProcess/qt/QtWebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (91830 => 91831)


--- trunk/Source/WebKit2/ChangeLog	2011-07-27 10:03:00 UTC (rev 91830)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-27 10:24:08 UTC (rev 91831)
@@ -1,3 +1,26 @@
+2011-07-27  Benjamin Poulain  <[email protected]>
+
+        [Qt][WK2] Simplify the PageUIClient
+        https://bugs.webkit.org/show_bug.cgi?id=65198
+
+        Reviewed by Andreas Kling.
+
+        The only function of WKPageLoaderClient with a complete implementation
+        is qt_wk_setStatusText(). The other functions were what is left from
+        before the refactoring of QWKPage.
+
+        This patch removes the unused functions to simplify the client. Since the dependency
+        on QtWebPageProxy is removed from that client, it now calls the ViewInterface directly.
+
+        * UIProcess/qt/ClientImpl.cpp:
+        (toViewInterface):
+        (qt_wk_setStatusText):
+        * UIProcess/qt/ClientImpl.h:
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::QtWebPageProxy):
+        (QtWebPageProxy::init):
+        * UIProcess/qt/QtWebPageProxy.h:
+
 2011-07-26  Sadrul Habib Chowdhury  <[email protected]>
 
         Add support for download='filename' attribute in anchors.

Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (91830 => 91831)


--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp	2011-07-27 10:03:00 UTC (rev 91830)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp	2011-07-27 10:24:08 UTC (rev 91831)
@@ -28,6 +28,7 @@
 #include "qweberror_p.h"
 #include <qwkcontext.h>
 #include <QtWebPageProxy.h>
+#include <ViewInterface.h>
 #include <WKFrame.h>
 #include <WKType.h>
 
@@ -47,6 +48,12 @@
     return 0;
 }
 
+static inline ViewInterface* toViewInterface(const void* clientInfo)
+{
+    ASSERT(clientInfo);
+    return reinterpret_cast<ViewInterface*>(const_cast<void*>(clientInfo));
+}
+
 static void dispatchLoadSucceeded(WKFrameRef frame, const void* clientInfo)
 {
     if (!WKFrameIsMainFrame(frame))
@@ -153,43 +160,10 @@
 {
 }
 
-WKPageRef qt_wk_createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo)
-{
-    QtWebPageProxy* wkPage = toQtWebPageProxy(clientInfo);
-    QtWebPageProxy::CreateNewPageFn createNewPageFn = wkPage->createNewPageFunction();
-
-    if (!createNewPageFn)
-        return 0;
-
-    if (QtWebPageProxy* newPage = createNewPageFn(wkPage)) {
-        WKRetain(newPage->pageRef());
-        return newPage->pageRef();
-    }
-
-    return 0;
-}
-
-void qt_wk_showPage(WKPageRef page, const void* clientInfo)
-{
-}
-
-void qt_wk_close(WKPageRef page, const void* clientInfo)
-{
-    emit toQtWebPageProxy(clientInfo)->windowCloseRequested();
-}
-
-void qt_wk_takeFocus(WKPageRef page, WKFocusDirection direction, const void *clientInfo)
-{
-}
-
-void qt_wk_runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
-{
-}
-
 void qt_wk_setStatusText(WKPageRef, WKStringRef text, const void *clientInfo)
 {
     QString qText = WKStringCopyQString(text);
-    toQtWebPageProxy(clientInfo)->didChangeStatusText(qText);
+    toViewInterface(clientInfo)->didChangeStatusText(qText);
 }
 
 void qt_wk_didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)

Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h (91830 => 91831)


--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h	2011-07-27 10:03:00 UTC (rev 91830)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h	2011-07-27 10:24:08 UTC (rev 91831)
@@ -46,11 +46,6 @@
 void qt_wk_didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo);
 
 // ui client
-WKPageRef qt_wk_createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
-void qt_wk_showPage(WKPageRef page, const void *clientInfo);
-void qt_wk_close(WKPageRef page, const void *clientInfo);
-void qt_wk_takeFocus(WKPageRef page, WKFocusDirection direction, const void *clientInfo);
-void qt_wk_runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo);
 void qt_wk_setStatusText(WKPageRef page, WKStringRef text, const void *clientInfo);
 
 // IconDatabase client.

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (91830 => 91831)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-07-27 10:03:00 UTC (rev 91830)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-07-27 10:24:08 UTC (rev 91831)
@@ -98,7 +98,6 @@
     : m_viewInterface(viewInterface)
     , m_context(c)
     , m_preferences(0)
-    , m_createNewPageFn(0)
     , m_undoStack(adoptPtr(new QUndoStack(this)))
 {
     ASSERT(viewInterface);
@@ -143,14 +142,14 @@
 
     WKPageUIClient uiClient = {
         0,      /* version */
-        this,   /* clientInfo */
-        qt_wk_createNewPage,
-        qt_wk_showPage,
-        qt_wk_close,
-        qt_wk_takeFocus,
+        m_viewInterface,   /* clientInfo */
+        0,  /* createNewPage */
+        0,  /* showPage */
+        0,  /* close */
+        0,  /* takeFocus */
         0,  /* focus */
         0,  /* unfocus */
-        qt_wk_runJavaScriptAlert,
+        0,  /* runJavaScriptAlert */
         0,  /* runJavaScriptConfirm */
         0,  /* runJavaScriptPrompt */
         qt_wk_setStatusText,
@@ -410,11 +409,6 @@
     m_viewInterface->didChangeTitle(newTitle);
 }
 
-void QtWebPageProxy::didChangeStatusText(const QString& text)
-{
-    m_viewInterface->didChangeStatusText(text);
-}
-
 void QtWebPageProxy::loadDidBegin()
 {
     m_viewInterface->loadDidBegin();
@@ -516,11 +510,6 @@
     return m_preferences;
 }
 
-void QtWebPageProxy::setCreateNewPageFunction(CreateNewPageFn function)
-{
-    m_createNewPageFn = function;
-}
-
 void QtWebPageProxy::setCustomUserAgent(const QString& userAgent)
 {
     WKRetainPtr<WKStringRef> wkUserAgent(WKStringCreateWithQString(userAgent));

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (91830 => 91831)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-07-27 10:03:00 UTC (rev 91830)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-07-27 10:24:08 UTC (rev 91831)
@@ -56,9 +56,6 @@
     Q_OBJECT
 
 public:
-    // FIXME: Add a nice API for view creation.
-    typedef QtWebPageProxy* (*CreateNewPageFn)(QtWebPageProxy*);
-
     enum WebAction {
         NoWebAction = - 1,
 
@@ -132,7 +129,6 @@
 
     void didChangeUrl(const QUrl&);
     void didChangeTitle(const QString&);
-    void didChangeStatusText(const QString&);
 
     void loadDidBegin();
     void loadDidSucceed();
@@ -150,8 +146,6 @@
     void load(const QUrl& url);
     QUrl url() const;
 
-    CreateNewPageFn createNewPageFunction() const { return m_createNewPageFn; }
-
     void setDrawingAreaSize(const QSize&);
 
     QWKPreferences* preferences() const;
@@ -162,7 +156,6 @@
 
     QAction* action(WebAction action) const;
     void triggerAction(WebAction action, bool checked = false);
-    void setCreateNewPageFunction(CreateNewPageFn function);
 
     void setCustomUserAgent(const QString&);
     QString customUserAgent() const;
@@ -182,7 +175,6 @@
 
 public:
     Q_SIGNAL void scrollRequested(int dx, int dy);
-    Q_SIGNAL void windowCloseRequested();
     Q_SIGNAL void zoomableAreaFound(const QRect&);
 
 protected:
@@ -204,8 +196,6 @@
     mutable QAction* m_actions[QtWebPageProxy::WebActionCount];
     mutable QWKPreferences* m_preferences;
 
-    CreateNewPageFn m_createNewPageFn;
-
     OwnPtr<QUndoStack> m_undoStack;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to