Changeset 102670 in webkit
- Timestamp:
- Dec 13, 2011 4:35:20 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102667 r102670 1 2011-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 1 32 2011-12-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 33 -
trunk/Source/WebKit2/Target.pri
r102666 r102670 214 214 UIProcess/VisitedLinkProvider.h \ 215 215 UIProcess/WebApplicationCacheManagerProxy.h \ 216 UIProcess/WebBackForwardList.h \ 216 217 UIProcess/WebConnectionToWebProcess.h \ 217 218 UIProcess/WebContext.h \ -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r102666 r102670 25 25 #include "QtWebPageProxy.h" 26 26 #include "UtilsQt.h" 27 #include "WebBackForwardList.h" 27 28 #include "WebPageGroup.h" 28 29 #include "WebPreferences.h" … … 226 227 void QQuickWebViewPrivate::_q_onVisibleChanged() 227 228 { 228 WebPageProxy* wkPage = toImpl(pageProxy->pageRef()); 229 230 wkPage->viewStateDidChange(WebPageProxy::ViewIsVisible); 229 webPageProxy()->viewStateDidChange(WebPageProxy::ViewIsVisible); 231 230 } 232 231 … … 239 238 return; 240 239 241 WebPageProxy* wkPage = toImpl(pageProxy->pageRef());242 240 // Let the WebProcess know about the new viewport size, so that 243 241 // it can resize the content accordingly. 244 w kPage->setViewportSize(viewportSize);242 webPageProxy()->setViewportSize(viewportSize); 245 243 246 244 interactionEngine->applyConstraints(computeViewportConstraints()); … … 259 257 return newConstraints; 260 258 261 WebPageProxy* wkPage = toImpl(pageProxy->pageRef()); 262 WebPreferences* wkPrefs = wkPage->pageGroup()->preferences(); 259 WebPreferences* wkPrefs = webPageProxy()->pageGroup()->preferences(); 263 260 264 261 // FIXME: Remove later; Hardcode some values for now to make sure the DPI adjustment is being tested. … … 393 390 // Do not guard, testing for the same value, as we call this from the constructor. 394 391 395 toImpl(pageProxy->pageRef())->setUseFixedLayout(!enable);392 webPageProxy()->setUseFixedLayout(!enable); 396 393 397 394 useTraditionalDesktopBehaviour = enable; … … 409 406 } 410 407 408 // FIXME: Remove this once QtWebPageProxy is removed. 409 WebKit::WebPageProxy* QQuickWebViewPrivate::webPageProxy() const 410 { 411 return toImpl(pageProxy->pageRef()); 412 } 413 411 414 /*! 412 415 \qmlsignal WebView::onNavigationRequested(request) … … 580 583 { 581 584 Q_D(QQuickWebView); 582 d-> pageProxy->load(url);585 d->webPageProxy()->loadURL(url.toString()); 583 586 } 584 587 … … 586 589 { 587 590 Q_D(QQuickWebView); 588 d-> pageProxy->goBack();591 d->webPageProxy()->goBack(); 589 592 } 590 593 … … 592 595 { 593 596 Q_D(QQuickWebView); 594 d-> pageProxy->goForward();597 d->webPageProxy()->goForward(); 595 598 } 596 599 … … 598 601 { 599 602 Q_D(QQuickWebView); 600 d-> pageProxy->stop();603 d->webPageProxy()->stopLoading(); 601 604 } 602 605 … … 604 607 { 605 608 Q_D(QQuickWebView); 606 d->pageProxy->reload(); 609 const bool reloadFromOrigin = true; 610 d->webPageProxy()->reload(reloadFromOrigin); 607 611 } 608 612 … … 610 614 { 611 615 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())); 613 620 } 614 621 … … 622 629 { 623 630 Q_D(const QQuickWebView); 624 return d-> pageProxy->canGoBack();631 return d->webPageProxy()->canGoBack(); 625 632 } 626 633 … … 628 635 { 629 636 Q_D(const QQuickWebView); 630 return d-> pageProxy->canGoForward();637 return d->webPageProxy()->canGoForward(); 631 638 } 632 639 … … 634 641 { 635 642 Q_D(const QQuickWebView); 636 return d->pageProxy->loading(); 643 RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame(); 644 return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState()); 637 645 } 638 646 … … 640 648 { 641 649 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(); 643 654 } 644 655 … … 646 657 { 647 658 Q_D(const QQuickWebView); 648 return d-> pageProxy->title();659 return d->webPageProxy()->pageTitle(); 649 660 } 650 661 … … 719 730 { 720 731 Q_D(QQuickWebView); 721 d-> pageProxy->loadHTMLString(html, baseUrl);732 d->webPageProxy()->loadHTMLString(html, baseUrl.toString()); 722 733 } 723 734 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r102666 r102670 38 38 #include <wtf/OwnPtr.h> 39 39 40 namespace WebKit { 41 class WebPageProxy; 42 } 40 43 class QtWebPageProxy; 41 44 … … 88 91 void setViewInAttachedProperties(QObject*); 89 92 93 WebKit::WebPageProxy* webPageProxy() const; 94 90 95 private: 91 96 // This class is responsible for collecting and applying all properties … … 133 138 QScopedPointer<QtWebPageProxy> pageProxy; 134 139 140 OwnPtr<QWebNavigationHistory> navigationHistory; 141 135 142 QDeclarativeComponent* alertDialog; 136 143 QDeclarativeComponent* confirmDialog; -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r102666 r102670 156 156 QVariantMap variantMap; 157 157 variantMap.insert(QLatin1String("data"), QString(message)); 158 variantMap.insert(QLatin1String("origin"), url());158 variantMap.insert(QLatin1String("origin"), m_qmlWebView->url()); 159 159 emit receivedMessageFromNavigatorQtObject(variantMap); 160 160 } 161 161 162 bool QtWebPageProxy::canGoBack() const163 {164 return m_webPageProxy->canGoBack();165 }166 167 void QtWebPageProxy::goBack()168 {169 m_webPageProxy->goBack();170 }171 172 162 void QtWebPageProxy::goBackTo(int index) 173 163 { … … 175 165 } 176 166 177 bool QtWebPageProxy::canGoForward() const178 {179 return m_webPageProxy->canGoForward();180 }181 182 void QtWebPageProxy::goForward()183 {184 m_webPageProxy->goForward();185 }186 187 167 void QtWebPageProxy::goForwardTo(int index) 188 168 { 189 169 m_navigationHistory->d->goForwardTo(index); 190 }191 192 bool QtWebPageProxy::loading() const193 {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() const204 {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);214 170 } 215 171 … … 266 222 { 267 223 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() const285 {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() const293 {294 return WKStringCopyQString(adoptWK(WKPageCopyTitle(toAPI(m_webPageProxy.get()))).get());295 224 } 296 225 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r102666 r102670 74 74 void didReceiveMessageFromNavigatorQtObject(const String&); 75 75 76 bool canGoBack() const;77 void goBack();78 76 void goBackTo(int index); 79 bool canGoForward() const;80 void goForward();81 77 void goForwardTo(int index); 82 bool loading() const;83 void stop();84 bool canReload() const;85 void reload();86 78 87 79 void updateNavigationState(); … … 89 81 WKPageRef pageRef() const; 90 82 91 void load(const QUrl& url);92 void loadHTMLString(const QString& html, const QUrl& baseUrl);93 QUrl url() const;94 95 83 void setDrawingAreaSize(const QSize&); 96 84 97 85 QWebPreferences* preferences() const; 98 99 QString title() const;100 86 101 87 void setCustomUserAgent(const QString&);
Note: See TracChangeset
for help on using the changeset viewer.