Changeset 102670 in webkit


Ignore:
Timestamp:
Dec 13, 2011 4:35:20 AM (12 years ago)
Author:
caio.oliveira@openbossa.org
Message:

[Qt][WK2] Move load & navigation related functions out of QtWebPageProxy
https://bugs.webkit.org/show_bug.cgi?id=74395

Reviewed by Simon Hausmann.

  • Target.pri:
  • UIProcess/API/qt/qquickwebview.cpp:

(QQuickWebViewPrivate::_q_onVisibleChanged):
(QQuickWebViewPrivate::updateViewportSize):
(QQuickWebViewPrivate::computeViewportConstraints):
(QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
(QQuickWebViewPrivate::webPageProxy):
(QQuickWebView::load):
(QQuickWebView::goBack):
(QQuickWebView::goForward):
(QQuickWebView::stop):
(QQuickWebView::reload):
(QQuickWebView::url):
(QQuickWebView::canGoBack):
(QQuickWebView::canGoForward):
(QQuickWebView::loading):
(QQuickWebView::canReload):
(QQuickWebView::title):
(QQuickWebView::loadHtml):

  • UIProcess/API/qt/qquickwebview_p_p.h:
  • UIProcess/qt/QtWebPageProxy.cpp:

(QtWebPageProxy::didReceiveMessageFromNavigatorQtObject):

  • UIProcess/qt/QtWebPageProxy.h:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r102667 r102670  
     12011-12-13  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        [Qt][WK2] Move load & navigation related functions out of QtWebPageProxy
     4        https://bugs.webkit.org/show_bug.cgi?id=74395
     5
     6        Reviewed by Simon Hausmann.
     7
     8        * Target.pri:
     9        * UIProcess/API/qt/qquickwebview.cpp:
     10        (QQuickWebViewPrivate::_q_onVisibleChanged):
     11        (QQuickWebViewPrivate::updateViewportSize):
     12        (QQuickWebViewPrivate::computeViewportConstraints):
     13        (QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
     14        (QQuickWebViewPrivate::webPageProxy):
     15        (QQuickWebView::load):
     16        (QQuickWebView::goBack):
     17        (QQuickWebView::goForward):
     18        (QQuickWebView::stop):
     19        (QQuickWebView::reload):
     20        (QQuickWebView::url):
     21        (QQuickWebView::canGoBack):
     22        (QQuickWebView::canGoForward):
     23        (QQuickWebView::loading):
     24        (QQuickWebView::canReload):
     25        (QQuickWebView::title):
     26        (QQuickWebView::loadHtml):
     27        * UIProcess/API/qt/qquickwebview_p_p.h:
     28        * UIProcess/qt/QtWebPageProxy.cpp:
     29        (QtWebPageProxy::didReceiveMessageFromNavigatorQtObject):
     30        * UIProcess/qt/QtWebPageProxy.h:
     31
    1322011-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
    233
  • trunk/Source/WebKit2/Target.pri

    r102666 r102670  
    214214    UIProcess/VisitedLinkProvider.h \
    215215    UIProcess/WebApplicationCacheManagerProxy.h \
     216    UIProcess/WebBackForwardList.h \
    216217    UIProcess/WebConnectionToWebProcess.h \
    217218    UIProcess/WebContext.h \
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r102666 r102670  
    2525#include "QtWebPageProxy.h"
    2626#include "UtilsQt.h"
     27#include "WebBackForwardList.h"
    2728#include "WebPageGroup.h"
    2829#include "WebPreferences.h"
     
    226227void QQuickWebViewPrivate::_q_onVisibleChanged()
    227228{
    228     WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
    229 
    230     wkPage->viewStateDidChange(WebPageProxy::ViewIsVisible);
     229    webPageProxy()->viewStateDidChange(WebPageProxy::ViewIsVisible);
    231230}
    232231
     
    239238        return;
    240239
    241     WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
    242240    // Let the WebProcess know about the new viewport size, so that
    243241    // it can resize the content accordingly.
    244     wkPage->setViewportSize(viewportSize);
     242    webPageProxy()->setViewportSize(viewportSize);
    245243
    246244    interactionEngine->applyConstraints(computeViewportConstraints());
     
    259257        return newConstraints;
    260258
    261     WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
    262     WebPreferences* wkPrefs = wkPage->pageGroup()->preferences();
     259    WebPreferences* wkPrefs = webPageProxy()->pageGroup()->preferences();
    263260
    264261    // FIXME: Remove later; Hardcode some values for now to make sure the DPI adjustment is being tested.
     
    393390    // Do not guard, testing for the same value, as we call this from the constructor.
    394391
    395     toImpl(pageProxy->pageRef())->setUseFixedLayout(!enable);
     392    webPageProxy()->setUseFixedLayout(!enable);
    396393
    397394    useTraditionalDesktopBehaviour = enable;
     
    409406}
    410407
     408// FIXME: Remove this once QtWebPageProxy is removed.
     409WebKit::WebPageProxy* QQuickWebViewPrivate::webPageProxy() const
     410{
     411    return toImpl(pageProxy->pageRef());
     412}
     413
    411414/*!
    412415    \qmlsignal WebView::onNavigationRequested(request)
     
    580583{
    581584    Q_D(QQuickWebView);
    582     d->pageProxy->load(url);
     585    d->webPageProxy()->loadURL(url.toString());
    583586}
    584587
     
    586589{
    587590    Q_D(QQuickWebView);
    588     d->pageProxy->goBack();
     591    d->webPageProxy()->goBack();
    589592}
    590593
     
    592595{
    593596    Q_D(QQuickWebView);
    594     d->pageProxy->goForward();
     597    d->webPageProxy()->goForward();
    595598}
    596599
     
    598601{
    599602    Q_D(QQuickWebView);
    600     d->pageProxy->stop();
     603    d->webPageProxy()->stopLoading();
    601604}
    602605
     
    604607{
    605608    Q_D(QQuickWebView);
    606     d->pageProxy->reload();
     609    const bool reloadFromOrigin = true;
     610    d->webPageProxy()->reload(reloadFromOrigin);
    607611}
    608612
     
    610614{
    611615    Q_D(const QQuickWebView);
    612     return d->pageProxy->url();
     616    RefPtr<WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
     617    if (!mainFrame)
     618        return QUrl();
     619    return QUrl(QString(mainFrame->url()));
    613620}
    614621
     
    622629{
    623630    Q_D(const QQuickWebView);
    624     return d->pageProxy->canGoBack();
     631    return d->webPageProxy()->canGoBack();
    625632}
    626633
     
    628635{
    629636    Q_D(const QQuickWebView);
    630     return d->pageProxy->canGoForward();
     637    return d->webPageProxy()->canGoForward();
    631638}
    632639
     
    634641{
    635642    Q_D(const QQuickWebView);
    636     return d->pageProxy->loading();
     643    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
     644    return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
    637645}
    638646
     
    640648{
    641649    Q_D(const QQuickWebView);
    642     return d->pageProxy->canReload();
     650    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
     651    if (mainFrame)
     652        return (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
     653    return d->webPageProxy()->backForwardList()->currentItem();
    643654}
    644655
     
    646657{
    647658    Q_D(const QQuickWebView);
    648     return d->pageProxy->title();
     659    return d->webPageProxy()->pageTitle();
    649660}
    650661
     
    719730{
    720731    Q_D(QQuickWebView);
    721     d->pageProxy->loadHTMLString(html, baseUrl);
     732    d->webPageProxy()->loadHTMLString(html, baseUrl.toString());
    722733}
    723734
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r102666 r102670  
    3838#include <wtf/OwnPtr.h>
    3939
     40namespace WebKit {
     41class WebPageProxy;
     42}
    4043class QtWebPageProxy;
    4144
     
    8891    void setViewInAttachedProperties(QObject*);
    8992
     93    WebKit::WebPageProxy* webPageProxy() const;
     94
    9095private:
    9196    // This class is responsible for collecting and applying all properties
     
    133138    QScopedPointer<QtWebPageProxy> pageProxy;
    134139
     140    OwnPtr<QWebNavigationHistory> navigationHistory;
     141
    135142    QDeclarativeComponent* alertDialog;
    136143    QDeclarativeComponent* confirmDialog;
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp

    r102666 r102670  
    156156    QVariantMap variantMap;
    157157    variantMap.insert(QLatin1String("data"), QString(message));
    158     variantMap.insert(QLatin1String("origin"), url());
     158    variantMap.insert(QLatin1String("origin"), m_qmlWebView->url());
    159159    emit receivedMessageFromNavigatorQtObject(variantMap);
    160160}
    161161
    162 bool QtWebPageProxy::canGoBack() const
    163 {
    164     return m_webPageProxy->canGoBack();
    165 }
    166 
    167 void QtWebPageProxy::goBack()
    168 {
    169     m_webPageProxy->goBack();
    170 }
    171 
    172162void QtWebPageProxy::goBackTo(int index)
    173163{
     
    175165}
    176166
    177 bool QtWebPageProxy::canGoForward() const
    178 {
    179     return m_webPageProxy->canGoForward();
    180 }
    181 
    182 void QtWebPageProxy::goForward()
    183 {
    184     m_webPageProxy->goForward();
    185 }
    186 
    187167void QtWebPageProxy::goForwardTo(int index)
    188168{
    189169    m_navigationHistory->d->goForwardTo(index);
    190 }
    191 
    192 bool QtWebPageProxy::loading() const
    193 {
    194     RefPtr<WebKit::WebFrameProxy> mainFrame = m_webPageProxy->mainFrame();
    195     return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
    196 }
    197 
    198 void QtWebPageProxy::stop()
    199 {
    200     m_webPageProxy->stopLoading();
    201 }
    202 
    203 bool QtWebPageProxy::canReload() const
    204 {
    205     RefPtr<WebKit::WebFrameProxy> mainFrame = m_webPageProxy->mainFrame();
    206     if (mainFrame)
    207         return (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
    208     return m_webPageProxy->backForwardList()->currentItem();
    209 }
    210 
    211 void QtWebPageProxy::reload()
    212 {
    213     m_webPageProxy->reload(/* reloadFromOrigin */ true);
    214170}
    215171
     
    266222{
    267223    m_context->postMessageToNavigatorQtObject(m_webPageProxy.get(), message);
    268 }
    269 
    270 void QtWebPageProxy::loadHTMLString(const QString& html, const QUrl& baseUrl)
    271 {
    272     WKRetainPtr<WKURLRef> wkUrl(WKURLCreateWithQUrl(baseUrl));
    273     WKRetainPtr<WKStringRef> wkHtmlString(WKStringCreateWithQString(html));
    274 
    275     WKPageLoadHTMLString(pageRef(), wkHtmlString.get(), wkUrl.get());
    276 }
    277 
    278 void QtWebPageProxy::load(const QUrl& url)
    279 {
    280     WKRetainPtr<WKURLRef> wkurl = adoptWK(WKURLCreateWithQUrl(url));
    281     WKPageLoadURL(pageRef(), wkurl.get());
    282 }
    283 
    284 QUrl QtWebPageProxy::url() const
    285 {
    286     WKRetainPtr<WKFrameRef> frame = WKPageGetMainFrame(pageRef());
    287     if (!frame)
    288         return QUrl();
    289     return WKURLCopyQUrl(adoptWK(WKFrameCopyURL(frame.get())).get());
    290 }
    291 
    292 QString QtWebPageProxy::title() const
    293 {
    294     return WKStringCopyQString(adoptWK(WKPageCopyTitle(toAPI(m_webPageProxy.get()))).get());
    295224}
    296225
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h

    r102666 r102670  
    7474    void didReceiveMessageFromNavigatorQtObject(const String&);
    7575
    76     bool canGoBack() const;
    77     void goBack();
    7876    void goBackTo(int index);
    79     bool canGoForward() const;
    80     void goForward();
    8177    void goForwardTo(int index);
    82     bool loading() const;
    83     void stop();
    84     bool canReload() const;
    85     void reload();
    8678
    8779    void updateNavigationState();
     
    8981    WKPageRef pageRef() const;
    9082
    91     void load(const QUrl& url);
    92     void loadHTMLString(const QString& html, const QUrl& baseUrl);
    93     QUrl url() const;
    94 
    9583    void setDrawingAreaSize(const QSize&);
    9684
    9785    QWebPreferences* preferences() const;
    98 
    99     QString title() const;
    10086
    10187    void setCustomUserAgent(const QString&);
Note: See TracChangeset for help on using the changeset viewer.