Changeset 109130 in webkit


Ignore:
Timestamp:
Feb 28, 2012 11:40:45 AM (12 years ago)
Author:
jocelyn.turcotte@nokia.com
Message:

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

Reviewed by Noam Rosenthal.

  • 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):

Location:
trunk/Source/WebKit2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r109129 r109130  
     12012-02-28  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
     2
     3        [Qt] Signal and property cleanup in QQuickWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=78820
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        - Remove parameters from property change notify signals:
     9          titleChanged, urlChanged, iconChanged, loadProgressChanged
     10        - Rename the parameters of linkHovered to prevent shadoing properties of WebView
     11        - Rename navigationStateChanged to navigationHistoryChanged
     12
     13        * UIProcess/API/qt/qquickwebview.cpp:
     14        (QQuickWebViewPrivate::QQuickWebViewPrivate):
     15        (QQuickWebViewPrivate::initialize):
     16        (QQuickWebViewPrivate::_q_onUrlChanged):
     17        (QQuickWebViewPrivate::setIcon):
     18        * UIProcess/API/qt/qquickwebview_p.h:
     19        * UIProcess/API/qt/qquickwebview_p_p.h:
     20        (QQuickWebViewPrivate):
     21        * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
     22        * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml:
     23        * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml:
     24        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
     25        (tst_QQuickWebView::loadProgress):
     26        * UIProcess/qt/QtWebPageLoadClient.cpp:
     27        (QtWebPageLoadClient::didCommitLoadForFrame):
     28        (QtWebPageLoadClient::didSameDocumentNavigationForFrame):
     29        (QtWebPageLoadClient::didReceiveTitleForFrame):
     30        (QtWebPageLoadClient::setLoadProgress):
     31        * UIProcess/qt/QtWebPageLoadClient.h:
     32        (QtWebPageLoadClient):
     33
    1342012-02-28  Mario Sanchez Prada  <msanchez@igalia.com>
    235
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r108889 r109130  
    8585    viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
    8686    QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
     87    QObject::connect(viewport, SIGNAL(urlChanged()), viewport, SLOT(_q_onUrlChanged()));
    8788    pageView.reset(new QQuickWebPage(viewport));
    8889}
     
    115116    QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
    116117    QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QUrl, QUrl)), q_ptr, SLOT(_q_onIconChangedForPageURL(QUrl, QUrl)));
    117     QObject::connect(q_ptr, SIGNAL(urlChanged(QUrl)), iconDatabase, SLOT(requestIconForPageURL(QUrl)));
    118118
    119119    // Any page setting should preferrable be set before creating the page.
     
    231231}
    232232
     233void QQuickWebViewPrivate::_q_onUrlChanged()
     234{
     235    Q_Q(QQuickWebView);
     236    context->iconDatabase()->requestIconForPageURL(q->url());
     237}
     238
    233239void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem)
    234240{
     
    431437
    432438    m_iconURL = iconURL;
    433     emit q->iconChanged(m_iconURL);
     439    emit q->iconChanged();
    434440}
    435441
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h

    r108889 r109130  
    7171    Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
    7272    Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged FINAL)
     73    Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationHistoryChanged FINAL)
     74    Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationHistoryChanged FINAL)
    7375    Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged FINAL)
    7476    Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
    75     Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationStateChanged FINAL)
    76     Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationStateChanged FINAL)
    7777    Q_ENUMS(NavigationRequestAction)
    7878    Q_ENUMS(LoadStatus)
     
    147147
    148148Q_SIGNALS:
    149     void titleChanged(const QString& title);
    150     void loadProgressChanged(int progress);
    151     void urlChanged(const QUrl& url);
    152     void iconChanged(const QUrl& iconURL);
    153     void linkHovered(const QUrl& url, const QString& title);
    154     void navigationStateChanged();
     149    void titleChanged();
     150    void navigationHistoryChanged();
    155151    void loadingChanged(QWebLoadRequest* loadRequest);
     152    void loadProgressChanged();
     153    void urlChanged();
     154    void iconChanged();
     155    void linkHovered(const QUrl& hoveredUrl, const QString& hoveredTitle);
    156156    void navigationRequested(QWebNavigationRequest* request);
    157157
     
    193193    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
    194194    Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
     195    Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged());
    195196    Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*));
    196197    Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QUrl&, const QUrl&));
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r108889 r109130  
    9696    void _q_onOpenPanelFinished(int result);
    9797    void _q_onVisibleChanged();
     98    void _q_onUrlChanged();
    9899    void _q_onReceivedResponseFromDownload(QWebDownloadItem*);
    99100    void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString);
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp

    r109113 r109130  
    5959    << "QQuickWebView.url --> QUrl"
    6060    << "QQuickWebView.icon --> QUrl"
    61     << "QQuickWebView.loadProgress --> int"
    6261    << "QQuickWebView.canGoBack --> bool"
    6362    << "QQuickWebView.canGoForward --> bool"
    6463    << "QQuickWebView.loading --> bool"
    65     << "QQuickWebView.titleChanged(QString) --> void"
    66     << "QQuickWebView.loadProgressChanged(int) --> void"
    67     << "QQuickWebView.urlChanged(QUrl) --> void"
    68     << "QQuickWebView.iconChanged(QUrl) --> void"
     64    << "QQuickWebView.loadProgress --> int"
     65    << "QQuickWebView.titleChanged() --> void"
     66    << "QQuickWebView.navigationHistoryChanged() --> void"
    6967    << "QQuickWebView.loadingChanged(QWebLoadRequest*) --> void"
     68    << "QQuickWebView.loadProgressChanged() --> void"
     69    << "QQuickWebView.urlChanged() --> void"
     70    << "QQuickWebView.iconChanged() --> void"
    7071    << "QQuickWebView.linkHovered(QUrl,QString) --> void"
    71     << "QQuickWebView.navigationStateChanged() --> void"
    7272    << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void"
    7373    << "QQuickWebView.load(QUrl) --> void"
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml

    r108889 r109130  
    2020
    2121    onLinkHovered: {
    22         webView.lastUrl = url
    23         webView.lastTitle = title
     22        webView.lastUrl = hoveredUrl
     23        webView.lastTitle = hoveredTitle
    2424    }
    2525
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml

    r108889 r109130  
    1919
    2020    onLinkHovered: {
    21         webView.lastUrl = url
     21        webView.lastUrl = hoveredUrl
    2222    }
    2323
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp

    r108889 r109130  
    253253
    254254    webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
    255     QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged(int)));
     255    QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged()));
    256256    QVERIFY(waitForLoadSucceeded(webView()));
    257257
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp

    r108889 r109130  
    5757}
    5858
    59 void QtWebPageLoadClient::didCommitLoadForFrame(const QUrl& url)
     59void QtWebPageLoadClient::didCommitLoadForFrame()
    6060{
    61     emit m_webView->navigationStateChanged();
    62     emit m_webView->urlChanged(url);
     61    emit m_webView->navigationHistoryChanged();
     62    emit m_webView->urlChanged();
    6363    m_webView->d_func()->loadDidCommit();
    6464}
    6565
    66 void QtWebPageLoadClient::didSameDocumentNavigationForFrame(const QUrl& url)
     66void QtWebPageLoadClient::didSameDocumentNavigationForFrame()
    6767{
    68     emit m_webView->navigationStateChanged();
    69     emit m_webView->urlChanged(url);
     68    emit m_webView->navigationHistoryChanged();
     69    emit m_webView->urlChanged();
    7070}
    7171
    72 void QtWebPageLoadClient::didReceiveTitleForFrame(const QString& title)
     72void QtWebPageLoadClient::didReceiveTitleForFrame()
    7373{
    74     emit m_webView->titleChanged(title);
     74    emit m_webView->titleChanged();
    7575}
    7676
     
    107107{
    108108    m_loadProgress = loadProgress;
    109     emit m_webView->loadProgressChanged(m_loadProgress);
     109    emit m_webView->loadProgressChanged();
    110110}
    111111
     
    137137    if (!WKFrameIsMainFrame(frame))
    138138        return;
    139     WebFrameProxy* wkframe = toImpl(frame);
    140     QString urlStr(wkframe->url());
    141     QUrl qUrl = urlStr;
    142     toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame(qUrl);
     139    toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame();
    143140}
    144141
     
    159156void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
    160157{
    161     WebFrameProxy* wkframe = toImpl(frame);
    162     QString urlStr(wkframe->url());
    163     QUrl qUrl = urlStr;
    164     toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame(qUrl);
     158    toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame();
    165159}
    166160
     
    169163    if (!WKFrameIsMainFrame(frame))
    170164        return;
    171     QString qTitle = WKStringCopyQString(title);
    172     toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame(qTitle);
     165    toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame();
    173166}
    174167
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h

    r108889 r109130  
    3636
    3737private:
    38     void didCommitLoadForFrame(const QUrl&);
    39     void didSameDocumentNavigationForFrame(const QUrl&);
    40     void didReceiveTitleForFrame(const QString&);
    4138    void didStartProvisionalLoadForFrame(const QUrl&);
     39    void didCommitLoadForFrame();
     40    void didSameDocumentNavigationForFrame();
     41    void didReceiveTitleForFrame();
    4242    void didFirstVisuallyNonEmptyLayoutForFrame();
    4343    void didChangeBackForwardList();
Note: See TracChangeset for help on using the changeset viewer.