Changeset 141882 in webkit


Ignore:
Timestamp:
Feb 5, 2013 2:58:41 AM (11 years ago)
Author:
Simon Hausmann
Message:

[Qt][WK2] Replace more uses of WebPageProxy with WKPage in QQuickWebView
https://bugs.webkit.org/show_bug.cgi?id=108826

Reviewed by Kenneth Rohde Christiansen and signed off for WK2 by
Benjamin Poulain.

This patch converts a few more usages of WebPageProxy to functions in
the WKPage API.

  • UIProcess/API/qt/qquickwebview.cpp:

(QQuickWebViewPrivate::initialize):
(QQuickWebViewLegacyPrivate::zoomFactor):
(QQuickWebViewLegacyPrivate::setZoomFactor):
(QQuickWebViewExperimental::postMessage):
(QQuickWebViewExperimental::userAgent):
(QQuickWebViewExperimental::setUserAgent):
(QQuickWebViewExperimental::evaluateJavaScript):
(QQuickWebViewExperimental::findText):
(QQuickWebView::goBack):
(QQuickWebView::goForward):
(QQuickWebView::stop):
(QQuickWebView::reload):
(QQuickWebView::setUrl):
(QQuickWebView::canGoBack):
(QQuickWebView::canGoForward):
(QQuickWebView::loading):
(QQuickWebView::title):
(QQuickWebView::pageRef):
(QQuickWebView::loadHtml):
(QQuickWebView::runJavaScriptInMainFrame):

  • UIProcess/API/qt/qquickwebview_p_p.h:

(QQuickWebViewPrivate):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r141853 r141882  
     12013-02-05  Simon Hausmann  <simon.hausmann@digia.com>
     2
     3        [Qt][WK2] Replace more uses of WebPageProxy with WKPage in QQuickWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=108826
     5
     6        Reviewed by Kenneth Rohde Christiansen and signed off for WK2 by
     7        Benjamin Poulain.
     8
     9        This patch converts a few more usages of WebPageProxy to functions in
     10        the WKPage API.
     11
     12        * UIProcess/API/qt/qquickwebview.cpp:
     13        (QQuickWebViewPrivate::initialize):
     14        (QQuickWebViewLegacyPrivate::zoomFactor):
     15        (QQuickWebViewLegacyPrivate::setZoomFactor):
     16        (QQuickWebViewExperimental::postMessage):
     17        (QQuickWebViewExperimental::userAgent):
     18        (QQuickWebViewExperimental::setUserAgent):
     19        (QQuickWebViewExperimental::evaluateJavaScript):
     20        (QQuickWebViewExperimental::findText):
     21        (QQuickWebView::goBack):
     22        (QQuickWebView::goForward):
     23        (QQuickWebView::stop):
     24        (QQuickWebView::reload):
     25        (QQuickWebView::setUrl):
     26        (QQuickWebView::canGoBack):
     27        (QQuickWebView::canGoForward):
     28        (QQuickWebView::loading):
     29        (QQuickWebView::title):
     30        (QQuickWebView::pageRef):
     31        (QQuickWebView::loadHtml):
     32        (QQuickWebView::runJavaScriptInMainFrame):
     33        * UIProcess/API/qt/qquickwebview_p_p.h:
     34        (QQuickWebViewPrivate):
     35
    1362013-02-04  Gwang Yoon Hwang  <ryumiel@company100.net>
    237
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r141756 r141882  
    6969#include <WKSerializedScriptValue.h>
    7070#include <WKString.h>
     71#include <WKStringQt.h>
     72#include <WKURLQt.h>
    7173#include <WebCore/IntPoint.h>
    7274#include <WebCore/IntRect.h>
     
    304306    context = contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext();
    305307    webPageProxy = context->createWebPage(&pageClient, toImpl(pageGroup.get()));
     308    webPage = toAPI(webPageProxy.get());
    306309    webPageProxy->setUseFixedLayout(s_flickableViewportEnabled);
    307310#if ENABLE(FULLSCREEN_API)
     
    312315    pageViewPrivate->initialize(webPageProxy.get());
    313316
    314     pageFindClient.reset(new QtWebPageFindClient(toAPI(webPageProxy.get()), q_ptr));
    315     pageLoadClient.reset(new QtWebPageLoadClient(toAPI(webPageProxy.get()), q_ptr));
    316     pagePolicyClient.reset(new QtWebPagePolicyClient(toAPI(webPageProxy.get()), q_ptr));
    317     pageUIClient.reset(new QtWebPageUIClient(toAPI(webPageProxy.get()), q_ptr));
    318     navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(toAPI(webPageProxy.get())));
     317    pageFindClient.reset(new QtWebPageFindClient(webPage.get(), q_ptr));
     318    pageLoadClient.reset(new QtWebPageLoadClient(webPage.get(), q_ptr));
     319    pagePolicyClient.reset(new QtWebPagePolicyClient(webPage.get(), q_ptr));
     320    pageUIClient.reset(new QtWebPageUIClient(webPage.get(), q_ptr));
     321    navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(webPage.get()));
    319322
    320323    QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
     
    851854qreal QQuickWebViewLegacyPrivate::zoomFactor() const
    852855{
    853     return webPageProxy->pageZoomFactor();
     856    return WKPageGetPageZoomFactor(webPage.get());
    854857}
    855858
    856859void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor)
    857860{
    858     webPageProxy->setPageZoomFactor(factor);
     861    WKPageSetPageZoomFactor(webPage.get(), factor);
    859862}
    860863
     
    10111014{
    10121015    Q_D(QQuickWebView);
    1013     static String messageName("MessageToNavigatorQtObject");
    1014     RefPtr<WebString> contents = WebString::create(String(message));
    1015     d->webPageProxy->postMessageToInjectedBundle(messageName, contents.get());
     1016    static WKStringRef messageName = WKStringCreateWithUTF8CString("MessageToNavigatorQtObject");
     1017    WKRetainPtr<WKStringRef> contents = adoptWK(WKStringCreateWithQString(message));
     1018    WKPagePostMessageToInjectedBundle(d->webPage.get(), messageName, contents.get());
    10161019}
    10171020
     
    11821185{
    11831186    Q_D(const QQuickWebView);
    1184     return d->webPageProxy->userAgent();
     1187    WKRetainPtr<WKStringRef> ua = adoptWK(WKPageCopyCustomUserAgent(d->webPage.get()));
     1188    return WKStringCopyQString(ua.get());
    11851189}
    11861190
     
    11881192{
    11891193    Q_D(QQuickWebView);
    1190     if (userAgent == QString(d->webPageProxy->userAgent()))
    1191         return;
    1192 
    1193     d->webPageProxy->setUserAgent(userAgent);
     1194    WKRetainPtr<WKStringRef> newUserAgent = adoptWK(WKStringCreateWithQString(userAgent));
     1195    WKRetainPtr<WKStringRef> currentUserAgent = adoptWK(WKPageCopyCustomUserAgent(d->webPage.get()));
     1196    if (WKStringIsEqual(newUserAgent.get(), currentUserAgent.get()))
     1197        return;
     1198
     1199    WKPageSetCustomUserAgent(d->webPage.get(), newUserAgent.get());
    11941200    emit userAgentChanged();
    11951201}
     
    12581264    closure->value = value;
    12591265
    1260     d_ptr->webPageProxy.get()->runJavaScriptInMainFrame(script, ScriptValueCallback::create(closure, javaScriptCallback));
     1266    WKRetainPtr<WKStringRef> scriptString = adoptWK(WKStringCreateWithQString(script));
     1267    WKPageRunJavaScriptInMainFrame(d_ptr->webPage.get(), scriptString.get(), closure, javaScriptCallback);
    12611268}
    12621269
     
    12651272    Q_D(QQuickWebView);
    12661273    if (string.isEmpty()) {
    1267         d->webPageProxy->hideFindUI();
     1274        WKPageHideFindUI(d->webPage.get());
    12681275        return;
    12691276    }
    1270     WebKit::FindOptions wkOptions = WebKit::FindOptionsCaseInsensitive;
     1277
     1278    WKFindOptions wkOptions = kWKFindOptionsCaseInsensitive;
    12711279    if (options & FindCaseSensitively)
    1272         wkOptions = static_cast<WebKit::FindOptions>(wkOptions & ~WebKit::FindOptionsCaseInsensitive);
     1280        wkOptions = wkOptions & ~kWKFindOptionsCaseInsensitive;
    12731281    if (options & FindBackward)
    1274         wkOptions = static_cast<WebKit::FindOptions>(wkOptions | FindOptionsBackwards);
     1282        wkOptions |= kWKFindOptionsBackwards;
    12751283    if (options & FindWrapsAroundDocument)
    1276         wkOptions = static_cast<WebKit::FindOptions>(wkOptions | FindOptionsWrapAround);
     1284        wkOptions |= kWKFindOptionsWrapAround;
    12771285    if (options & FindHighlightAllOccurrences)
    1278         wkOptions = static_cast<WebKit::FindOptions>(wkOptions | FindOptionsShowHighlight);
    1279 
    1280     d->webPageProxy->findString(string, wkOptions, std::numeric_limits<unsigned>::max() - 1);
     1286        wkOptions |= kWKFindOptionsShowHighlight;
     1287
     1288    WKRetainPtr<WKStringRef> str = adoptWK(WKStringCreateWithQString(string));
     1289
     1290    WKPageFindString(d->webPage.get(), str.get(), wkOptions, std::numeric_limits<unsigned>::max() - 1);
    12811291}
    12821292
     
    15021512{
    15031513    Q_D(QQuickWebView);
    1504     d->webPageProxy->goBack();
     1514    WKPageGoBack(d->webPage.get());
    15051515}
    15061516
     
    15141524{
    15151525    Q_D(QQuickWebView);
    1516     d->webPageProxy->goForward();
     1526    WKPageGoForward(d->webPage.get());
    15171527}
    15181528
     
    15251535{
    15261536    Q_D(QQuickWebView);
    1527     d->webPageProxy->stopLoading();
     1537    WKPageStopLoading(d->webPage.get());
    15281538}
    15291539
     
    15501560    }
    15511561
    1552     const bool reloadFromOrigin = true;
    1553     d->webPageProxy->reload(reloadFromOrigin);
     1562    WKPageReloadFromOrigin(d->webPage.get());
    15541563}
    15551564
     
    15801589        return;
    15811590
    1582     d->webPageProxy->loadURL(url.toString());
     1591    WKRetainPtr<WKURLRef> u = adoptWK(WKURLCreateWithQUrl(url));
     1592    WKPageLoadURL(d->webPage.get(), u.get());
    15831593    emitUrlChangeIfNeeded();
    15841594}
     
    16411651{
    16421652    Q_D(const QQuickWebView);
    1643     return d->webPageProxy->canGoBack();
     1653    return WKPageCanGoBack(d->webPage.get());
    16441654}
    16451655
     
    16531663{
    16541664    Q_D(const QQuickWebView);
    1655     return d->webPageProxy->canGoForward();
     1665    return WKPageCanGoForward(d->webPage.get());
    16561666}
    16571667
     
    16641674{
    16651675    Q_D(const QQuickWebView);
    1666     RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy->mainFrame();
    1667     return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
     1676    WKFrameRef mainFrame = WKPageGetMainFrame(d->webPage.get());
     1677    return mainFrame && !(kWKFrameLoadStateFinished == WKFrameGetFrameLoadState(mainFrame));
    16681678}
    16691679
     
    17161726{
    17171727    Q_D(const QQuickWebView);
    1718     return d->webPageProxy->pageTitle();
     1728    WKRetainPtr<WKStringRef> t = adoptWK(WKPageCopyTitle(d->webPage.get()));
     1729    return WKStringCopyQString(t.get());
    17191730}
    17201731
     
    19491960{
    19501961    Q_D(const QQuickWebView);
    1951     return toAPI(d->webPageProxy.get());
     1962    return d->webPage.get();
    19521963}
    19531964
     
    20162027{
    20172028    Q_D(QQuickWebView);
     2029    WKRetainPtr<WKStringRef> htmlRef = adoptWK(WKStringCreateWithQString(html));
     2030    WKRetainPtr<WKURLRef> baseUrlRef = adoptWK(WKURLCreateWithQUrl(baseUrl));
     2031    WKRetainPtr<WKURLRef> unreachableUrlRef = adoptWK(WKURLCreateWithQUrl(unreachableUrl));
     2032
    20182033    if (unreachableUrl.isValid())
    2019         d->webPageProxy->loadAlternateHTMLString(html, baseUrl.toString(), unreachableUrl.toString());
     2034        WKPageLoadAlternateHTMLString(d->webPage.get(), htmlRef.get(), baseUrlRef.get(), unreachableUrlRef.get());
    20202035    else
    2021         d->webPageProxy->loadHTMLString(html, baseUrl.toString());
     2036        WKPageLoadHTMLString(d->webPage.get(), htmlRef.get(), baseUrlRef.get());
    20222037}
    20232038
     
    20432058    closure->method = method;
    20442059
    2045     d->webPageProxy.get()->runJavaScriptInMainFrame(script, ScriptValueCallback::create(closure, javaScriptCallback));
     2060    WKRetainPtr<WKStringRef> scriptString = adoptWK(WKStringCreateWithQString(script));
     2061    WKPageRunJavaScriptInMainFrame(d->webPage.get(), scriptString.get(), closure, javaScriptCallback);
    20462062}
    20472063
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r141756 r141882  
    163163    RefPtr<WebKit::QtWebContext> context;
    164164    RefPtr<WebKit::WebPageProxy> webPageProxy;
     165    WKRetainPtr<WKPageRef> webPage;
    165166    WKRetainPtr<WKPageGroupRef> pageGroup;
    166167
Note: See TracChangeset for help on using the changeset viewer.