Changeset 141882 in webkit
- Timestamp:
- Feb 5, 2013 2:58:41 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r141853 r141882 1 2013-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 1 36 2013-02-04 Gwang Yoon Hwang <ryumiel@company100.net> 2 37 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r141756 r141882 69 69 #include <WKSerializedScriptValue.h> 70 70 #include <WKString.h> 71 #include <WKStringQt.h> 72 #include <WKURLQt.h> 71 73 #include <WebCore/IntPoint.h> 72 74 #include <WebCore/IntRect.h> … … 304 306 context = contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext(); 305 307 webPageProxy = context->createWebPage(&pageClient, toImpl(pageGroup.get())); 308 webPage = toAPI(webPageProxy.get()); 306 309 webPageProxy->setUseFixedLayout(s_flickableViewportEnabled); 307 310 #if ENABLE(FULLSCREEN_API) … … 312 315 pageViewPrivate->initialize(webPageProxy.get()); 313 316 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())); 319 322 320 323 QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); … … 851 854 qreal QQuickWebViewLegacyPrivate::zoomFactor() const 852 855 { 853 return webPageProxy->pageZoomFactor();856 return WKPageGetPageZoomFactor(webPage.get()); 854 857 } 855 858 856 859 void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor) 857 860 { 858 webPageProxy->setPageZoomFactor(factor);861 WKPageSetPageZoomFactor(webPage.get(), factor); 859 862 } 860 863 … … 1011 1014 { 1012 1015 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()); 1016 1019 } 1017 1020 … … 1182 1185 { 1183 1186 Q_D(const QQuickWebView); 1184 return d->webPageProxy->userAgent(); 1187 WKRetainPtr<WKStringRef> ua = adoptWK(WKPageCopyCustomUserAgent(d->webPage.get())); 1188 return WKStringCopyQString(ua.get()); 1185 1189 } 1186 1190 … … 1188 1192 { 1189 1193 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()); 1194 1200 emit userAgentChanged(); 1195 1201 } … … 1258 1264 closure->value = value; 1259 1265 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); 1261 1268 } 1262 1269 … … 1265 1272 Q_D(QQuickWebView); 1266 1273 if (string.isEmpty()) { 1267 d->webPageProxy->hideFindUI();1274 WKPageHideFindUI(d->webPage.get()); 1268 1275 return; 1269 1276 } 1270 WebKit::FindOptions wkOptions = WebKit::FindOptionsCaseInsensitive; 1277 1278 WKFindOptions wkOptions = kWKFindOptionsCaseInsensitive; 1271 1279 if (options & FindCaseSensitively) 1272 wkOptions = static_cast<WebKit::FindOptions>(wkOptions & ~WebKit::FindOptionsCaseInsensitive);1280 wkOptions = wkOptions & ~kWKFindOptionsCaseInsensitive; 1273 1281 if (options & FindBackward) 1274 wkOptions = static_cast<WebKit::FindOptions>(wkOptions | FindOptionsBackwards);1282 wkOptions |= kWKFindOptionsBackwards; 1275 1283 if (options & FindWrapsAroundDocument) 1276 wkOptions = static_cast<WebKit::FindOptions>(wkOptions | FindOptionsWrapAround);1284 wkOptions |= kWKFindOptionsWrapAround; 1277 1285 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); 1281 1291 } 1282 1292 … … 1502 1512 { 1503 1513 Q_D(QQuickWebView); 1504 d->webPageProxy->goBack();1514 WKPageGoBack(d->webPage.get()); 1505 1515 } 1506 1516 … … 1514 1524 { 1515 1525 Q_D(QQuickWebView); 1516 d->webPageProxy->goForward();1526 WKPageGoForward(d->webPage.get()); 1517 1527 } 1518 1528 … … 1525 1535 { 1526 1536 Q_D(QQuickWebView); 1527 d->webPageProxy->stopLoading();1537 WKPageStopLoading(d->webPage.get()); 1528 1538 } 1529 1539 … … 1550 1560 } 1551 1561 1552 const bool reloadFromOrigin = true; 1553 d->webPageProxy->reload(reloadFromOrigin); 1562 WKPageReloadFromOrigin(d->webPage.get()); 1554 1563 } 1555 1564 … … 1580 1589 return; 1581 1590 1582 d->webPageProxy->loadURL(url.toString()); 1591 WKRetainPtr<WKURLRef> u = adoptWK(WKURLCreateWithQUrl(url)); 1592 WKPageLoadURL(d->webPage.get(), u.get()); 1583 1593 emitUrlChangeIfNeeded(); 1584 1594 } … … 1641 1651 { 1642 1652 Q_D(const QQuickWebView); 1643 return d->webPageProxy->canGoBack();1653 return WKPageCanGoBack(d->webPage.get()); 1644 1654 } 1645 1655 … … 1653 1663 { 1654 1664 Q_D(const QQuickWebView); 1655 return d->webPageProxy->canGoForward();1665 return WKPageCanGoForward(d->webPage.get()); 1656 1666 } 1657 1667 … … 1664 1674 { 1665 1675 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)); 1668 1678 } 1669 1679 … … 1716 1726 { 1717 1727 Q_D(const QQuickWebView); 1718 return d->webPageProxy->pageTitle(); 1728 WKRetainPtr<WKStringRef> t = adoptWK(WKPageCopyTitle(d->webPage.get())); 1729 return WKStringCopyQString(t.get()); 1719 1730 } 1720 1731 … … 1949 1960 { 1950 1961 Q_D(const QQuickWebView); 1951 return toAPI(d->webPageProxy.get());1962 return d->webPage.get(); 1952 1963 } 1953 1964 … … 2016 2027 { 2017 2028 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 2018 2033 if (unreachableUrl.isValid()) 2019 d->webPageProxy->loadAlternateHTMLString(html, baseUrl.toString(), unreachableUrl.toString());2034 WKPageLoadAlternateHTMLString(d->webPage.get(), htmlRef.get(), baseUrlRef.get(), unreachableUrlRef.get()); 2020 2035 else 2021 d->webPageProxy->loadHTMLString(html, baseUrl.toString());2036 WKPageLoadHTMLString(d->webPage.get(), htmlRef.get(), baseUrlRef.get()); 2022 2037 } 2023 2038 … … 2043 2058 closure->method = method; 2044 2059 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); 2046 2062 } 2047 2063 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r141756 r141882 163 163 RefPtr<WebKit::QtWebContext> context; 164 164 RefPtr<WebKit::WebPageProxy> webPageProxy; 165 WKRetainPtr<WKPageRef> webPage; 165 166 WKRetainPtr<WKPageGroupRef> pageGroup; 166 167
Note: See TracChangeset
for help on using the changeset viewer.