Title: [142073] trunk/Source/WebKit2
Revision
142073
Author
hausm...@webkit.org
Date
2013-02-07 00:34:11 -0800 (Thu, 07 Feb 2013)

Log Message

[Qt][WK2] Fold QtWebPageFindClient into QQuickWebViewPrivate
https://bugs.webkit.org/show_bug.cgi?id=108920

Reviewed by Jocelyn Turcotte, signed off for WK2 by Benjamin.

Employ the pattern suggested by Jocelyn to simply implement the C
callbacks directly using static functions.

* Target.pri:
* UIProcess/API/qt/qquickwebview.cpp:
(toQQuickWebViewPrivate):
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::didFindString):
(QQuickWebViewPrivate::didFailToFindString):
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/qt/QtWebPageFindClient.cpp: Removed.
* UIProcess/qt/QtWebPageFindClient.h: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (142072 => 142073)


--- trunk/Source/WebKit2/ChangeLog	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-07 08:34:11 UTC (rev 142073)
@@ -1,3 +1,24 @@
+2013-02-07  Simon Hausmann  <simon.hausm...@digia.com>
+
+        [Qt][WK2] Fold QtWebPageFindClient into QQuickWebViewPrivate
+        https://bugs.webkit.org/show_bug.cgi?id=108920
+
+        Reviewed by Jocelyn Turcotte, signed off for WK2 by Benjamin.
+
+        Employ the pattern suggested by Jocelyn to simply implement the C
+        callbacks directly using static functions.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (toQQuickWebViewPrivate):
+        (QQuickWebViewPrivate::initialize):
+        (QQuickWebViewPrivate::didFindString):
+        (QQuickWebViewPrivate::didFailToFindString):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+        * UIProcess/qt/QtWebPageFindClient.cpp: Removed.
+        * UIProcess/qt/QtWebPageFindClient.h: Removed.
+
 2013-02-03  Sam Weinig  <s...@webkit.org>
 
         Make CustomProtocolManagerProxy a MessageReceiver

Modified: trunk/Source/WebKit2/Target.pri (142072 => 142073)


--- trunk/Source/WebKit2/Target.pri	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/Target.pri	2013-02-07 08:34:11 UTC (rev 142073)
@@ -785,7 +785,6 @@
         UIProcess/qt/QtDialogRunner.h \
         UIProcess/qt/QtDownloadManager.h \
         UIProcess/qt/QtPageClient.h \
-        UIProcess/qt/QtWebPageFindClient.h \
         UIProcess/qt/QtWebPageLoadClient.h \
         UIProcess/qt/QtWebPagePolicyClient.h \
         UIProcess/qt/QtWebPageSGNode.h \
@@ -813,7 +812,6 @@
         UIProcess/qt/QtDialogRunner.cpp \
         UIProcess/qt/QtDownloadManager.cpp \
         UIProcess/qt/QtPageClient.cpp \
-        UIProcess/qt/QtWebPageFindClient.cpp \
         UIProcess/qt/QtWebPageLoadClient.cpp \
         UIProcess/qt/QtWebPagePolicyClient.cpp \
         UIProcess/qt/QtWebPageSGNode.cpp \

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (142072 => 142073)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-02-07 08:34:11 UTC (rev 142073)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+ * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -31,7 +32,6 @@
 #include "QtWebError.h"
 #include "QtWebIconDatabaseClient.h"
 #include "QtWebPageEventHandler.h"
-#include "QtWebPageFindClient.h"
 #include "QtWebPageLoadClient.h"
 #include "QtWebPagePolicyClient.h"
 #include "WebBackForwardList.h"
@@ -86,6 +86,12 @@
 static const qreal kAxisLockVelocityThreshold = 300;
 static const qreal kAxisLockVelocityDirectionThreshold = 50;
 
+static inline QQuickWebViewPrivate* toQQuickWebViewPrivate(const void* clientInfo)
+{
+    ASSERT(clientInfo);
+    return reinterpret_cast<QQuickWebViewPrivate*>(const_cast<void*>(clientInfo));
+}
+
 struct JSCallbackClosure {
     QPointer<QObject> receiver;
     QByteArray method;
@@ -314,7 +320,16 @@
     QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
     pageViewPrivate->initialize(webPageProxy.get());
 
-    pageFindClient.reset(new QtWebPageFindClient(webPage.get(), q_ptr));
+    {
+        WKPageFindClient findClient;
+        memset(&findClient, 0, sizeof(WKPageFindClient));
+        findClient.version = kWKPageFindClientCurrentVersion;
+        findClient.clientInfo = this;
+        findClient.didFindString = didFindString;
+        findClient.didFailToFindString = didFailToFindString;
+        WKPageSetPageFindClient(webPage.get(), &findClient);
+    }
+
     pageLoadClient.reset(new QtWebPageLoadClient(webPage.get(), q_ptr));
     pagePolicyClient.reset(new QtWebPagePolicyClient(webPage.get(), q_ptr));
     pageUIClient.reset(new QtWebPageUIClient(webPage.get(), q_ptr));
@@ -2073,12 +2088,17 @@
     d->m_allowAnyHTTPSCertificateForLocalHost = allow;
 }
 
-void QQuickWebViewPrivate::didFindString(unsigned matchCount)
+void QQuickWebViewPrivate::didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    QQuickWebView* q = toQQuickWebViewPrivate(clientInfo)->q_ptr;
     emit q->experimental()->textFound(matchCount);
 }
 
+void QQuickWebViewPrivate::didFailToFindString(WKPageRef page, WKStringRef string, const void* clientInfo)
+{
+    QQuickWebViewPrivate::didFindString(page, string, 0, clientInfo);
+}
+
 /*!
     \qmlsignal WebView::onLoadingChanged(loadRequest)
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (142072 => 142073)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-02-07 08:34:11 UTC (rev 142073)
@@ -85,7 +85,8 @@
     virtual void loadDidFail(const WebKit::QtWebError& error);
     virtual void handleMouseEvent(QMouseEvent*);
 
-    void didFindString(unsigned matchCount);
+    static void didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
+    static void didFailToFindString(WKPageRef page, WKStringRef string, const void* clientInfo);
 
     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes& attr) { }
 
@@ -171,7 +172,6 @@
     OwnPtr<QWebPreferences> preferences;
 
     QScopedPointer<WebKit::QtWebPageLoadClient> pageLoadClient;
-    QScopedPointer<WebKit::QtWebPageFindClient> pageFindClient;
     QScopedPointer<WebKit::QtWebPagePolicyClient> pagePolicyClient;
     QScopedPointer<WebKit::QtWebPageUIClient> pageUIClient;
 

Deleted: trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.cpp (142072 => 142073)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.cpp	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.cpp	2013-02-07 08:34:11 UTC (rev 142073)
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "QtWebPageFindClient.h"
-
-#include "qquickwebview_p_p.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-QtWebPageFindClient::QtWebPageFindClient(WKPageRef pageRef, QQuickWebView* webView)
-    : m_webView(webView)
-{
-    WKPageFindClient findClient;
-    memset(&findClient, 0, sizeof(WKPageFindClient));
-    findClient.version = kWKPageFindClientCurrentVersion;
-    findClient.clientInfo = this;
-    findClient.didFindString = didFindString;
-    findClient.didFailToFindString = didFailToFindString;
-    WKPageSetPageFindClient(pageRef, &findClient);
-}
-
-void QtWebPageFindClient::didFindString(unsigned matchCount)
-{
-    m_webView->d_func()->didFindString(matchCount);
-}
-
-static QtWebPageFindClient* toQtWebPageFindClient(const void* clientInfo)
-{
-    ASSERT(clientInfo);
-    return reinterpret_cast<QtWebPageFindClient*>(const_cast<void*>(clientInfo));
-}
-
-void QtWebPageFindClient::didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo)
-{
-    toQtWebPageFindClient(clientInfo)->didFindString(matchCount);
-}
-
-void QtWebPageFindClient::didFailToFindString(WKPageRef page, WKStringRef string, const void* clientInfo)
-{
-    toQtWebPageFindClient(clientInfo)->didFindString(0);
-}
-
-} // namespace Webkit

Deleted: trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.h (142072 => 142073)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.h	2013-02-07 08:30:00 UTC (rev 142072)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageFindClient.h	2013-02-07 08:34:11 UTC (rev 142073)
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef QtWebPageFindClient_h
-#define QtWebPageFindClient_h
-
-#include <WKPage.h>
-#include <wtf/text/WTFString.h>
-
-class QQuickWebView;
-
-namespace WebKit {
-
-class QtWebPageFindClient {
-public:
-    QtWebPageFindClient(WKPageRef, QQuickWebView*);
-
-private:
-
-    void didFindString(unsigned matchCount);
-
-    // WKPageFindClient callbacks.
-    static void didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo);
-    static void didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo);
-
-    QQuickWebView* m_webView;
-};
-
-} // namespace Webkit
-
-#endif // QtWebPageFindClient_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to