Title: [108816] trunk/Source/WebKit2
Revision
108816
Author
[email protected]
Date
2012-02-24 09:56:34 -0800 (Fri, 24 Feb 2012)

Log Message

[Qt] Signal and property cleanup in QQuickWebView
https://bugs.webkit.org/show_bug.cgi?id=78820

Reviewed by Simon Hausmann.

- Remove parameters from property change notify signals:
  titleChanged, urlChanged, iconChanged, loadProgressChanged
- Rename the parameters of linkHovered to prevent shadoing properties of WebView
- Rename navigationStateChanged to navigationHistoryChanged

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::_q_onUrlChanged):
(QQuickWebViewPrivate::setIcon):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
* UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml:
* UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml:
* UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
(tst_QQuickWebView::loadProgress):
* UIProcess/qt/QtWebPageLoadClient.cpp:
(QtWebPageLoadClient::didCommitLoadForFrame):
(QtWebPageLoadClient::didSameDocumentNavigationForFrame):
(QtWebPageLoadClient::didReceiveTitleForFrame):
(QtWebPageLoadClient::setLoadProgress):
* UIProcess/qt/QtWebPageLoadClient.h:
(QtWebPageLoadClient):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (108815 => 108816)


--- trunk/Source/WebKit2/ChangeLog	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-24 17:56:34 UTC (rev 108816)
@@ -1,5 +1,38 @@
 2012-02-24  Jocelyn Turcotte  <[email protected]>
 
+        [Qt] Signal and property cleanup in QQuickWebView
+        https://bugs.webkit.org/show_bug.cgi?id=78820
+
+        Reviewed by Simon Hausmann.
+
+        - Remove parameters from property change notify signals:
+          titleChanged, urlChanged, iconChanged, loadProgressChanged
+        - Rename the parameters of linkHovered to prevent shadoing properties of WebView
+        - Rename navigationStateChanged to navigationHistoryChanged
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebViewPrivate::initialize):
+        (QQuickWebViewPrivate::_q_onUrlChanged):
+        (QQuickWebViewPrivate::setIcon):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+        * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
+        * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml:
+        * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml:
+        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+        (tst_QQuickWebView::loadProgress):
+        * UIProcess/qt/QtWebPageLoadClient.cpp:
+        (QtWebPageLoadClient::didCommitLoadForFrame):
+        (QtWebPageLoadClient::didSameDocumentNavigationForFrame):
+        (QtWebPageLoadClient::didReceiveTitleForFrame):
+        (QtWebPageLoadClient::setLoadProgress):
+        * UIProcess/qt/QtWebPageLoadClient.h:
+        (QtWebPageLoadClient):
+
+2012-02-24  Jocelyn Turcotte  <[email protected]>
+
         [Qt] API: Unify the loading properties and signals.
         https://bugs.webkit.org/show_bug.cgi?id=79486
 

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-24 17:56:34 UTC (rev 108816)
@@ -84,6 +84,7 @@
 {
     viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
     QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
+    QObject::connect(viewport, SIGNAL(urlChanged()), viewport, SLOT(_q_onUrlChanged()));
     pageView.reset(new QQuickWebPage(viewport));
 }
 
@@ -114,7 +115,6 @@
 
     QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
     QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QUrl, QUrl)), q_ptr, SLOT(_q_onIconChangedForPageURL(QUrl, QUrl)));
-    QObject::connect(q_ptr, SIGNAL(urlChanged(QUrl)), iconDatabase, SLOT(requestIconForPageURL(QUrl)));
 
     // Any page setting should preferrable be set before creating the page.
     webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
@@ -230,6 +230,12 @@
     webPageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
 }
 
+void QQuickWebViewPrivate::_q_onUrlChanged()
+{
+    Q_Q(QQuickWebView);
+    context->iconDatabase()->requestIconForPageURL(q->url());
+}
+
 void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem)
 {
     // Now that our downloadItem has everything we need we can emit downloadRequested.
@@ -430,7 +436,7 @@
     }
 
     m_iconURL = iconURL;
-    emit q->iconChanged(m_iconURL);
+    emit q->iconChanged();
 }
 
 bool QQuickWebViewPrivate::navigatorQtObjectEnabled() const

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-02-24 17:56:34 UTC (rev 108816)
@@ -70,10 +70,10 @@
     Q_PROPERTY(QString title READ title NOTIFY titleChanged)
     Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
     Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged FINAL)
+    Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationHistoryChanged FINAL)
+    Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationHistoryChanged FINAL)
     Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged FINAL)
     Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
-    Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationStateChanged FINAL)
-    Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationStateChanged FINAL)
     Q_ENUMS(NavigationRequestAction)
     Q_ENUMS(LoadStatus)
     Q_ENUMS(ErrorDomain)
@@ -146,13 +146,13 @@
     void reload();
 
 Q_SIGNALS:
-    void titleChanged(const QString& title);
-    void loadProgressChanged(int progress);
-    void urlChanged(const QUrl& url);
-    void iconChanged(const QUrl& iconURL);
-    void linkHovered(const QUrl& url, const QString& title);
-    void navigationStateChanged();
+    void titleChanged();
+    void navigationHistoryChanged();
     void loadingChanged(QWebLoadRequest* loadRequest);
+    void loadProgressChanged();
+    void urlChanged();
+    void iconChanged();
+    void linkHovered(const QUrl& hoveredUrl, const QString& hoveredTitle);
     void navigationRequested(QWebNavigationRequest* request);
 
 protected:
@@ -192,6 +192,7 @@
     Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFilesSelected());
     Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
     Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
+    Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged());
     Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*));
     Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QUrl&, const QUrl&));
     // Hides QObject::d_ptr allowing us to use the convenience macros.

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-02-24 17:56:34 UTC (rev 108816)
@@ -95,6 +95,7 @@
     void _q_onOpenPanelFilesSelected();
     void _q_onOpenPanelFinished(int result);
     void _q_onVisibleChanged();
+    void _q_onUrlChanged();
     void _q_onReceivedResponseFromDownload(QWebDownloadItem*);
     void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString);
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp	2012-02-24 17:56:34 UTC (rev 108816)
@@ -58,17 +58,17 @@
     << "QQuickWebView.title --> QString"
     << "QQuickWebView.url --> QUrl"
     << "QQuickWebView.icon --> QUrl"
-    << "QQuickWebView.loadProgress --> int"
     << "QQuickWebView.canGoBack --> bool"
     << "QQuickWebView.canGoForward --> bool"
     << "QQuickWebView.loading --> bool"
-    << "QQuickWebView.titleChanged(QString) --> void"
-    << "QQuickWebView.loadProgressChanged(int) --> void"
-    << "QQuickWebView.urlChanged(QUrl) --> void"
-    << "QQuickWebView.iconChanged(QUrl) --> void"
+    << "QQuickWebView.loadProgress --> int"
+    << "QQuickWebView.titleChanged() --> void"
+    << "QQuickWebView.navigationHistoryChanged() --> void"
     << "QQuickWebView.loadingChanged(QWebLoadRequest*) --> void"
+    << "QQuickWebView.loadProgressChanged() --> void"
+    << "QQuickWebView.urlChanged() --> void"
+    << "QQuickWebView.iconChanged() --> void"
     << "QQuickWebView.linkHovered(QUrl,QString) --> void"
-    << "QQuickWebView.navigationStateChanged() --> void"
     << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void"
     << "QQuickWebView.load(QUrl) --> void"
     << "QQuickWebView.loadHtml(QString,QUrl) --> void"

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml	2012-02-24 17:56:34 UTC (rev 108816)
@@ -19,8 +19,8 @@
     }
 
     onLinkHovered: {
-        webView.lastUrl = url
-        webView.lastTitle = title
+        webView.lastUrl = hoveredUrl
+        webView.lastTitle = hoveredTitle
     }
 
     TestCase {

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml	2012-02-24 17:56:34 UTC (rev 108816)
@@ -18,7 +18,7 @@
     }
 
     onLinkHovered: {
-        webView.lastUrl = url
+        webView.lastUrl = hoveredUrl
     }
 
     TestCase {

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-02-24 17:56:34 UTC (rev 108816)
@@ -252,7 +252,7 @@
     QCOMPARE(webView()->loadProgress(), 0);
 
     webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
-    QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged(int)));
+    QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged()));
     QVERIFY(waitForLoadSucceeded(webView()));
 
     QVERIFY(loadProgressChangedSpy.count() >= 1);

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2012-02-24 17:56:34 UTC (rev 108816)
@@ -56,22 +56,22 @@
     m_webView->d_func()->didChangeLoadingState(&loadRequest);
 }
 
-void QtWebPageLoadClient::didCommitLoadForFrame(const QUrl& url)
+void QtWebPageLoadClient::didCommitLoadForFrame()
 {
-    emit m_webView->navigationStateChanged();
-    emit m_webView->urlChanged(url);
+    emit m_webView->navigationHistoryChanged();
+    emit m_webView->urlChanged();
     m_webView->d_func()->loadDidCommit();
 }
 
-void QtWebPageLoadClient::didSameDocumentNavigationForFrame(const QUrl& url)
+void QtWebPageLoadClient::didSameDocumentNavigationForFrame()
 {
-    emit m_webView->navigationStateChanged();
-    emit m_webView->urlChanged(url);
+    emit m_webView->navigationHistoryChanged();
+    emit m_webView->urlChanged();
 }
 
-void QtWebPageLoadClient::didReceiveTitleForFrame(const QString& title)
+void QtWebPageLoadClient::didReceiveTitleForFrame()
 {
-    emit m_webView->titleChanged(title);
+    emit m_webView->titleChanged();
 }
 
 void QtWebPageLoadClient::didFirstVisuallyNonEmptyLayoutForFrame()
@@ -106,7 +106,7 @@
 void QtWebPageLoadClient::setLoadProgress(int loadProgress)
 {
     m_loadProgress = loadProgress;
-    emit m_webView->loadProgressChanged(m_loadProgress);
+    emit m_webView->loadProgressChanged();
 }
 
 static QtWebPageLoadClient* toQtWebPageLoadClient(const void* clientInfo)
@@ -136,10 +136,7 @@
 {
     if (!WKFrameIsMainFrame(frame))
         return;
-    WebFrameProxy* wkframe = toImpl(frame);
-    QString urlStr(wkframe->url());
-    QUrl qUrl = urlStr;
-    toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame(qUrl);
+    toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame();
 }
 
 void QtWebPageLoadClient::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
@@ -158,18 +155,14 @@
 
 void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
 {
-    WebFrameProxy* wkframe = toImpl(frame);
-    QString urlStr(wkframe->url());
-    QUrl qUrl = urlStr;
-    toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame(qUrl);
+    toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame();
 }
 
 void QtWebPageLoadClient::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
     if (!WKFrameIsMainFrame(frame))
         return;
-    QString qTitle = WKStringCopyQString(title);
-    toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame(qTitle);
+    toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame();
 }
 
 void QtWebPageLoadClient::didStartProgress(WKPageRef, const void* clientInfo)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h (108815 => 108816)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h	2012-02-24 17:50:43 UTC (rev 108815)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h	2012-02-24 17:56:34 UTC (rev 108816)
@@ -35,10 +35,10 @@
     int loadProgress() const { return m_loadProgress; }
 
 private:
-    void didCommitLoadForFrame(const QUrl&);
-    void didSameDocumentNavigationForFrame(const QUrl&);
-    void didReceiveTitleForFrame(const QString&);
     void didStartProvisionalLoadForFrame(const QUrl&);
+    void didCommitLoadForFrame();
+    void didSameDocumentNavigationForFrame();
+    void didReceiveTitleForFrame();
     void didFirstVisuallyNonEmptyLayoutForFrame();
     void didChangeBackForwardList();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to