- Revision
- 102670
- Author
- [email protected]
- Date
- 2011-12-13 04:35:20 -0800 (Tue, 13 Dec 2011)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (102669 => 102670)
--- trunk/Source/WebKit2/ChangeLog 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/ChangeLog 2011-12-13 12:35:20 UTC (rev 102670)
@@ -1,3 +1,34 @@
+2011-12-13 Caio Marcelo de Oliveira Filho <[email protected]>
+
+ [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:
+
2011-12-13 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix GTK+ build after r102640.
Modified: trunk/Source/WebKit2/Target.pri (102669 => 102670)
--- trunk/Source/WebKit2/Target.pri 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/Target.pri 2011-12-13 12:35:20 UTC (rev 102670)
@@ -213,6 +213,7 @@
UIProcess/TiledDrawingAreaProxy.h \
UIProcess/VisitedLinkProvider.h \
UIProcess/WebApplicationCacheManagerProxy.h \
+ UIProcess/WebBackForwardList.h \
UIProcess/WebConnectionToWebProcess.h \
UIProcess/WebContext.h \
UIProcess/WebContextConnectionClient.h \
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (102669 => 102670)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2011-12-13 12:35:20 UTC (rev 102670)
@@ -24,6 +24,7 @@
#include "QtDialogRunner.h"
#include "QtWebPageProxy.h"
#include "UtilsQt.h"
+#include "WebBackForwardList.h"
#include "WebPageGroup.h"
#include "WebPreferences.h"
@@ -225,9 +226,7 @@
void QQuickWebViewPrivate::_q_onVisibleChanged()
{
- WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
-
- wkPage->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ webPageProxy()->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
void QQuickWebViewPrivate::updateViewportSize()
@@ -238,10 +237,9 @@
if (viewportSize.isEmpty())
return;
- WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
// Let the WebProcess know about the new viewport size, so that
// it can resize the content accordingly.
- wkPage->setViewportSize(viewportSize);
+ webPageProxy()->setViewportSize(viewportSize);
interactionEngine->applyConstraints(computeViewportConstraints());
updateVisibleContentRect();
@@ -258,8 +256,7 @@
if (availableSize.isEmpty())
return newConstraints;
- WebPageProxy* wkPage = toImpl(pageProxy->pageRef());
- WebPreferences* wkPrefs = wkPage->pageGroup()->preferences();
+ WebPreferences* wkPrefs = webPageProxy()->pageGroup()->preferences();
// FIXME: Remove later; Hardcode some values for now to make sure the DPI adjustment is being tested.
wkPrefs->setDeviceDPI(240);
@@ -392,7 +389,7 @@
// Do not guard, testing for the same value, as we call this from the constructor.
- toImpl(pageProxy->pageRef())->setUseFixedLayout(!enable);
+ webPageProxy()->setUseFixedLayout(!enable);
useTraditionalDesktopBehaviour = enable;
if (useTraditionalDesktopBehaviour)
@@ -408,6 +405,12 @@
attached->setView(q);
}
+// FIXME: Remove this once QtWebPageProxy is removed.
+WebKit::WebPageProxy* QQuickWebViewPrivate::webPageProxy() const
+{
+ return toImpl(pageProxy->pageRef());
+}
+
/*!
\qmlsignal WebView::onNavigationRequested(request)
@@ -579,37 +582,41 @@
void QQuickWebView::load(const QUrl& url)
{
Q_D(QQuickWebView);
- d->pageProxy->load(url);
+ d->webPageProxy()->loadURL(url.toString());
}
void QQuickWebView::goBack()
{
Q_D(QQuickWebView);
- d->pageProxy->goBack();
+ d->webPageProxy()->goBack();
}
void QQuickWebView::goForward()
{
Q_D(QQuickWebView);
- d->pageProxy->goForward();
+ d->webPageProxy()->goForward();
}
void QQuickWebView::stop()
{
Q_D(QQuickWebView);
- d->pageProxy->stop();
+ d->webPageProxy()->stopLoading();
}
void QQuickWebView::reload()
{
Q_D(QQuickWebView);
- d->pageProxy->reload();
+ const bool reloadFromOrigin = true;
+ d->webPageProxy()->reload(reloadFromOrigin);
}
QUrl QQuickWebView::url() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->url();
+ RefPtr<WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+ if (!mainFrame)
+ return QUrl();
+ return QUrl(QString(mainFrame->url()));
}
int QQuickWebView::loadProgress() const
@@ -621,31 +628,35 @@
bool QQuickWebView::canGoBack() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->canGoBack();
+ return d->webPageProxy()->canGoBack();
}
bool QQuickWebView::canGoForward() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->canGoForward();
+ return d->webPageProxy()->canGoForward();
}
bool QQuickWebView::loading() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->loading();
+ RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+ return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
}
bool QQuickWebView::canReload() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->canReload();
+ RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+ if (mainFrame)
+ return (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
+ return d->webPageProxy()->backForwardList()->currentItem();
}
QString QQuickWebView::title() const
{
Q_D(const QQuickWebView);
- return d->pageProxy->title();
+ return d->webPageProxy()->pageTitle();
}
QWebPreferences* QQuickWebView::preferences() const
@@ -718,7 +729,7 @@
void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl)
{
Q_D(QQuickWebView);
- d->pageProxy->loadHTMLString(html, baseUrl);
+ d->webPageProxy()->loadHTMLString(html, baseUrl.toString());
}
#include "moc_qquickwebview_p.cpp"
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (102669 => 102670)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2011-12-13 12:35:20 UTC (rev 102670)
@@ -37,6 +37,9 @@
#include <QtCore/QScopedPointer>
#include <wtf/OwnPtr.h>
+namespace WebKit {
+class WebPageProxy;
+}
class QtWebPageProxy;
QT_BEGIN_NAMESPACE
@@ -87,6 +90,8 @@
void setUseTraditionalDesktopBehaviour(bool enable);
void setViewInAttachedProperties(QObject*);
+ WebKit::WebPageProxy* webPageProxy() const;
+
private:
// This class is responsible for collecting and applying all properties
// on the viewport item, when transitioning from page A to page B is finished.
@@ -132,6 +137,8 @@
QQuickWebView* q_ptr;
QScopedPointer<QtWebPageProxy> pageProxy;
+ OwnPtr<QWebNavigationHistory> navigationHistory;
+
QDeclarativeComponent* alertDialog;
QDeclarativeComponent* confirmDialog;
QDeclarativeComponent* promptDialog;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (102669 => 102670)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-12-13 12:35:20 UTC (rev 102670)
@@ -155,64 +155,20 @@
{
QVariantMap variantMap;
variantMap.insert(QLatin1String("data"), QString(message));
- variantMap.insert(QLatin1String("origin"), url());
+ variantMap.insert(QLatin1String("origin"), m_qmlWebView->url());
emit receivedMessageFromNavigatorQtObject(variantMap);
}
-bool QtWebPageProxy::canGoBack() const
-{
- return m_webPageProxy->canGoBack();
-}
-
-void QtWebPageProxy::goBack()
-{
- m_webPageProxy->goBack();
-}
-
void QtWebPageProxy::goBackTo(int index)
{
m_navigationHistory->d->goBackTo(index);
}
-bool QtWebPageProxy::canGoForward() const
-{
- return m_webPageProxy->canGoForward();
-}
-
-void QtWebPageProxy::goForward()
-{
- m_webPageProxy->goForward();
-}
-
void QtWebPageProxy::goForwardTo(int index)
{
m_navigationHistory->d->goForwardTo(index);
}
-bool QtWebPageProxy::loading() const
-{
- RefPtr<WebKit::WebFrameProxy> mainFrame = m_webPageProxy->mainFrame();
- return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
-}
-
-void QtWebPageProxy::stop()
-{
- m_webPageProxy->stopLoading();
-}
-
-bool QtWebPageProxy::canReload() const
-{
- RefPtr<WebKit::WebFrameProxy> mainFrame = m_webPageProxy->mainFrame();
- if (mainFrame)
- return (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
- return m_webPageProxy->backForwardList()->currentItem();
-}
-
-void QtWebPageProxy::reload()
-{
- m_webPageProxy->reload(/* reloadFromOrigin */ true);
-}
-
void QtWebPageProxy::updateNavigationState()
{
emit m_qmlWebView->navigationStateChanged();
@@ -267,33 +223,6 @@
m_context->postMessageToNavigatorQtObject(m_webPageProxy.get(), message);
}
-void QtWebPageProxy::loadHTMLString(const QString& html, const QUrl& baseUrl)
-{
- WKRetainPtr<WKURLRef> wkUrl(WKURLCreateWithQUrl(baseUrl));
- WKRetainPtr<WKStringRef> wkHtmlString(WKStringCreateWithQString(html));
-
- WKPageLoadHTMLString(pageRef(), wkHtmlString.get(), wkUrl.get());
-}
-
-void QtWebPageProxy::load(const QUrl& url)
-{
- WKRetainPtr<WKURLRef> wkurl = adoptWK(WKURLCreateWithQUrl(url));
- WKPageLoadURL(pageRef(), wkurl.get());
-}
-
-QUrl QtWebPageProxy::url() const
-{
- WKRetainPtr<WKFrameRef> frame = WKPageGetMainFrame(pageRef());
- if (!frame)
- return QUrl();
- return WKURLCopyQUrl(adoptWK(WKFrameCopyURL(frame.get())).get());
-}
-
-QString QtWebPageProxy::title() const
-{
- return WKStringCopyQString(adoptWK(WKPageCopyTitle(toAPI(m_webPageProxy.get()))).get());
-}
-
void QtWebPageProxy::setDrawingAreaSize(const QSize& size)
{
if (!m_webPageProxy->drawingArea())
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (102669 => 102670)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-12-13 12:03:37 UTC (rev 102669)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-12-13 12:35:20 UTC (rev 102670)
@@ -73,31 +73,17 @@
void didReceiveMessageFromNavigatorQtObject(const String&);
- bool canGoBack() const;
- void goBack();
void goBackTo(int index);
- bool canGoForward() const;
- void goForward();
void goForwardTo(int index);
- bool loading() const;
- void stop();
- bool canReload() const;
- void reload();
void updateNavigationState();
WKPageRef pageRef() const;
- void load(const QUrl& url);
- void loadHTMLString(const QString& html, const QUrl& baseUrl);
- QUrl url() const;
-
void setDrawingAreaSize(const QSize&);
QWebPreferences* preferences() const;
- QString title() const;
-
void setCustomUserAgent(const QString&);
QString customUserAgent() const;