[Qt] [WK2] Remove QtWebPageProxy
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2011 14:09:48 +0000 (14:09 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2011 14:09:48 +0000 (14:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74540

Reviewed by Kenneth Rohde Christiansen.

Move WebPageProxy* to QQuickWebViewPrivate. The remaining functions in
QtWebPageProxy were simple wrappers to WebKit functionality (text zoom, page zoom
and user agent setting). Since those wrappers are unused, they were removed. The
signal in the class was also unused.

This patch also remove the code from WebContextMenuProxyQt, it was remains of a
previous QMenu-based implementation. We want to rewrite this code for QML anyway,
so I reverted to an empty state.

Farewell, QtWebPageProxy!

* Target.pri:
* UIProcess/API/qt/qquickwebpage.cpp:
* UIProcess/API/qt/qquickwebpage_p.h:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::~QQuickWebViewPrivate):
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::processDidCrash):
(QQuickWebViewPrivate::createDrawingAreaProxy):
(QQuickWebViewPrivate::updateVisibleContentRectAndScale):
(QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged):
(QQuickWebViewPrivate::_q_onVisibleChanged):
(QQuickWebViewPrivate::updateViewportSize):
(QQuickWebViewPrivate::computeViewportConstraints):
(QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
(QQuickWebViewPrivate::setNavigatorQtObjectEnabled):
(QQuickWebViewExperimental::postMessage):
(QQuickWebView::load):
(QQuickWebView::goBack):
(QQuickWebView::goForward):
(QQuickWebView::stop):
(QQuickWebView::reload):
(QQuickWebView::url):
(QQuickWebView::canGoBack):
(QQuickWebView::canGoForward):
(QQuickWebView::loading):
(QQuickWebView::canReload):
(QQuickWebView::title):
(QQuickWebView::pageRef):
(QQuickWebView::loadHtml):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
* UIProcess/API/qt/qwebnavigationhistory_p_p.h:
* UIProcess/API/qt/qwebpreferences.cpp:
(QWebPreferencesPrivate::preferencesRef):
* UIProcess/PageClient.h:
* UIProcess/qt/QtPageClient.cpp:
(QtPageClient::QtPageClient):
(QtPageClient::initialize):
(QtPageClient::createPopupMenuProxy):
(QtPageClient::createContextMenuProxy):
* UIProcess/qt/QtPageClient.h:
* UIProcess/qt/QtWebPageProxy.cpp: Removed.
* UIProcess/qt/QtWebPageProxy.h: Removed.
* UIProcess/qt/WebContextMenuProxyQt.cpp:
(WebKit::WebContextMenuProxyQt::WebContextMenuProxyQt):
(WebKit::WebContextMenuProxyQt::create):
(WebKit::WebContextMenuProxyQt::showContextMenu):
(WebKit::WebContextMenuProxyQt::hideContextMenu):
* UIProcess/qt/WebContextMenuProxyQt.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory_p_p.h
Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/qt/QtPageClient.cpp
Source/WebKit2/UIProcess/qt/QtPageClient.h
Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp [deleted file]
Source/WebKit2/UIProcess/qt/QtWebPageProxy.h [deleted file]
Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h

index e0a9a012d25accafdf3ddf8961e2f432d0771c55..e0d198f8a63672b3b3f1d04c6ca47387ec2eb89e 100644 (file)
@@ -1,3 +1,71 @@
+2011-12-15  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        [Qt] [WK2] Remove QtWebPageProxy
+        https://bugs.webkit.org/show_bug.cgi?id=74540
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Move WebPageProxy* to QQuickWebViewPrivate. The remaining functions in
+        QtWebPageProxy were simple wrappers to WebKit functionality (text zoom, page zoom
+        and user agent setting). Since those wrappers are unused, they were removed. The
+        signal in the class was also unused.
+
+        This patch also remove the code from WebContextMenuProxyQt, it was remains of a
+        previous QMenu-based implementation. We want to rewrite this code for QML anyway,
+        so I reverted to an empty state.
+
+        Farewell, QtWebPageProxy!
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        * UIProcess/API/qt/qquickwebpage_p.h:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::~QQuickWebViewPrivate):
+        (QQuickWebViewPrivate::initialize):
+        (QQuickWebViewPrivate::processDidCrash):
+        (QQuickWebViewPrivate::createDrawingAreaProxy):
+        (QQuickWebViewPrivate::updateVisibleContentRectAndScale):
+        (QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged):
+        (QQuickWebViewPrivate::_q_onVisibleChanged):
+        (QQuickWebViewPrivate::updateViewportSize):
+        (QQuickWebViewPrivate::computeViewportConstraints):
+        (QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
+        (QQuickWebViewPrivate::setNavigatorQtObjectEnabled):
+        (QQuickWebViewExperimental::postMessage):
+        (QQuickWebView::load):
+        (QQuickWebView::goBack):
+        (QQuickWebView::goForward):
+        (QQuickWebView::stop):
+        (QQuickWebView::reload):
+        (QQuickWebView::url):
+        (QQuickWebView::canGoBack):
+        (QQuickWebView::canGoForward):
+        (QQuickWebView::loading):
+        (QQuickWebView::canReload):
+        (QQuickWebView::title):
+        (QQuickWebView::pageRef):
+        (QQuickWebView::loadHtml):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        * UIProcess/API/qt/qwebnavigationhistory_p_p.h:
+        * UIProcess/API/qt/qwebpreferences.cpp:
+        (QWebPreferencesPrivate::preferencesRef):
+        * UIProcess/PageClient.h:
+        * UIProcess/qt/QtPageClient.cpp:
+        (QtPageClient::QtPageClient):
+        (QtPageClient::initialize):
+        (QtPageClient::createPopupMenuProxy):
+        (QtPageClient::createContextMenuProxy):
+        * UIProcess/qt/QtPageClient.h:
+        * UIProcess/qt/QtWebPageProxy.cpp: Removed.
+        * UIProcess/qt/QtWebPageProxy.h: Removed.
+        * UIProcess/qt/WebContextMenuProxyQt.cpp:
+        (WebKit::WebContextMenuProxyQt::WebContextMenuProxyQt):
+        (WebKit::WebContextMenuProxyQt::create):
+        (WebKit::WebContextMenuProxyQt::showContextMenu):
+        (WebKit::WebContextMenuProxyQt::hideContextMenu):
+        * UIProcess/qt/WebContextMenuProxyQt.h:
+
 2011-12-15  Simon Hausmann  <simon.hausmann@nokia.com>
 
         [WK2] Eliminate unnecessary GTK/QT ifdefs for shared memory implementation
index a06a161647f5cc037bd45f744244e48af5e1e8cb..59abb8f97fd780898d49235d68266f694569b7ed 100644 (file)
@@ -267,7 +267,6 @@ HEADERS += \
     UIProcess/qt/QtPageClient.h \
     UIProcess/qt/QtWebPageLoadClient.h \
     UIProcess/qt/QtWebPagePolicyClient.h \
-    UIProcess/qt/QtWebPageProxy.h \
     UIProcess/qt/QtWebPageUIClient.h \
     UIProcess/qt/QtSGUpdateQueue.h \
     UIProcess/qt/QtSGTileNode.h \
@@ -590,7 +589,6 @@ SOURCES += \
     UIProcess/qt/QtPageClient.cpp \
     UIProcess/qt/QtWebPageLoadClient.cpp \
     UIProcess/qt/QtWebPagePolicyClient.cpp \
-    UIProcess/qt/QtWebPageProxy.cpp \
     UIProcess/qt/QtWebPageUIClient.cpp \
     UIProcess/qt/QtSGUpdateQueue.cpp \
     UIProcess/qt/QtSGTileNode.cpp \
index c7e5d77075375080d5d8ac40e5e6284473838f9c..7d3b2d6a6d27219d8bb8960f201c90852d95c8a4 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "LayerTreeHostProxy.h"
 #include "QtWebPageEventHandler.h"
-#include "QtWebPageProxy.h"
 #include "TransformationMatrix.h"
 #include "qquickwebpage_p_p.h"
 #include <QtQuick/QQuickCanvas>
index 899ea763efbc1e07aab76a246e801e89eae61787..f7c35064ef80373dc44f2b178915e3b706abf72d 100644 (file)
@@ -32,7 +32,6 @@ class QWebPreferences;
 namespace WebKit {
 class QtSGUpdateQueue;
 }
-class QtWebPageProxy;
 
 class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
     Q_OBJECT
@@ -70,7 +69,6 @@ private:
     QQuickWebPagePrivate* d;
     friend class QQuickWebView;
     friend class QQuickWebViewPrivate;
-    friend class QtWebPageProxy;
 };
 
 QML_DECLARE_TYPE(QQuickWebPage)
index c10d9fcee7317f3298ba98352913779104668107..a8e7eaa8720030abc6b0edc2939210e89bb36059 100644 (file)
@@ -27,7 +27,6 @@
 #include "QtDownloadManager.h"
 #include "QtWebContext.h"
 #include "QtWebPageEventHandler.h"
-#include "QtWebPageProxy.h"
 #include "UtilsQt.h"
 #include "WebBackForwardList.h"
 #include "WebPageGroup.h"
@@ -68,29 +67,29 @@ QQuickWebViewPrivate::~QQuickWebViewPrivate()
 {
     if (interactionEngine)
         interactionEngine->disconnect();
+    webPageProxy->close();
 }
 
 // Note: we delay this initialization to make sure that QQuickWebView has its d-ptr in-place.
 void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
 {
     context = contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext();
+    webPageProxy = context->createWebPage(&pageClient, toImpl(pageGroupRef));
+
     QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    setPageProxy(new QtWebPageProxy(q_ptr, &pageClient, context, pageGroupRef));
-    pageViewPrivate->initialize(webPageProxy());
+    pageViewPrivate->initialize(webPageProxy.get());
 
-    pageLoadClient.reset(new QtWebPageLoadClient(pageProxy->pageRef(), q_ptr));
-    pagePolicyClient.reset(new QtWebPagePolicyClient(pageProxy->pageRef(), q_ptr));
-    pageUIClient.reset(new QtWebPageUIClient(pageProxy->pageRef(), q_ptr));
-    navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(pageProxy->pageRef()));
+    pageLoadClient.reset(new QtWebPageLoadClient(toAPI(webPageProxy.get()), q_ptr));
+    pagePolicyClient.reset(new QtWebPagePolicyClient(toAPI(webPageProxy.get()), q_ptr));
+    pageUIClient.reset(new QtWebPageUIClient(toAPI(webPageProxy.get()), q_ptr));
+    navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(toAPI(webPageProxy.get())));
 
-    // Any page setting should preferrable be set before creating the page, so set them here:
+    // Any page setting should preferrable be set before creating the page.
     setUseTraditionalDesktopBehaviour(false);
-    webPageProxy()->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
-
-    pageClient.initialize(q_ptr, pageProxy.data(), pageViewPrivate->eventHandler.data(), &undoController);
+    webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
 
-    // Creates a page with the page creation parameters.
-    pageProxy->init();
+    pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController);
+    webPageProxy->initializeWebPage();
 
     // Trigger setting of correct visibility flags after everything was allocated and initialized.
     _q_onVisibleChanged();
@@ -229,7 +228,7 @@ void QQuickWebViewPrivate::processDidCrash()
 {
     emit q_ptr->navigationStateChanged();
     pageView->d->eventHandler->resetGestureRecognizers();
-    WebCore::KURL url(WebCore::ParsedURLString, webPageProxy()->urlAtProcessExit());
+    WebCore::KURL url(WebCore::ParsedURLString, webPageProxy->urlAtProcessExit());
     qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(QUrl(url).toString(QUrl::RemoveUserInfo)));
 }
 
@@ -242,7 +241,7 @@ void QQuickWebViewPrivate::didRelaunchProcess()
 
 PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy()
 {
-    return DrawingAreaProxyImpl::create(webPageProxy());
+    return DrawingAreaProxyImpl::create(webPageProxy.get());
 }
 
 void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download)
@@ -261,7 +260,7 @@ void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download)
 
 void QQuickWebViewPrivate::updateVisibleContentRectAndScale()
 {
-    DrawingAreaProxy* drawingArea = webPageProxy()->drawingArea();
+    DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
     if (!drawingArea)
         return;
 
@@ -273,13 +272,13 @@ void QQuickWebViewPrivate::updateVisibleContentRectAndScale()
     drawingArea->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale);
 
     // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended.
-    webPageProxy()->setFixedVisibleContentRect(alignedVisibleContentRect);
+    webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);
     q->m_experimental->viewportInfo()->didUpdateCurrentScale();
 }
 
 void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector)
 {
-    DrawingAreaProxy* drawingArea = webPageProxy()->drawingArea();
+    DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
     if (!drawingArea)
         return;
     drawingArea->setVisibleContentRectTrajectoryVector(trajectoryVector);
@@ -287,7 +286,7 @@ void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& tra
 
 void QQuickWebViewPrivate::_q_onVisibleChanged()
 {
-    webPageProxy()->viewStateDidChange(WebPageProxy::ViewIsVisible);
+    webPageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
 }
 
 void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem)
@@ -311,7 +310,7 @@ void QQuickWebViewPrivate::updateViewportSize()
 
     // Let the WebProcess know about the new viewport size, so that
     // it can resize the content accordingly.
-    webPageProxy()->setViewportSize(viewportSize);
+    webPageProxy->setViewportSize(viewportSize);
 
     interactionEngine->applyConstraints(computeViewportConstraints());
     updateVisibleContentRectAndScale();
@@ -344,7 +343,7 @@ QtViewportInteractionEngine::Constraints QQuickWebViewPrivate::computeViewportCo
     if (availableSize.isEmpty())
         return newConstraints;
 
-    WebPreferences* wkPrefs = webPageProxy()->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);
@@ -480,7 +479,7 @@ void QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour(bool enable)
 
     // Do not guard, testing for the same value, as we call this from the constructor.
 
-    webPageProxy()->setUseFixedLayout(!enable);
+    webPageProxy->setUseFixedLayout(!enable);
 
     useTraditionalDesktopBehaviour = enable;
     if (useTraditionalDesktopBehaviour)
@@ -506,13 +505,7 @@ void QQuickWebViewPrivate::setNavigatorQtObjectEnabled(bool enabled)
     ASSERT(enabled != m_navigatorQtObjectEnabled);
     // FIXME: Currently we have to keep this information in both processes and the setting is asynchronous.
     m_navigatorQtObjectEnabled = enabled;
-    context->setNavigatorQtObjectEnabled(webPageProxy(), enabled);
-}
-
-// FIXME: Remove this once QtWebPageProxy is removed.
-WebKit::WebPageProxy* QQuickWebViewPrivate::webPageProxy() const
-{
-    return toImpl(pageProxy->pageRef());
+    context->setNavigatorQtObjectEnabled(webPageProxy.get(), enabled);
 }
 
 WebCore::IntSize QQuickWebViewPrivate::viewSize() const
@@ -540,11 +533,6 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String&
     The request object cannot be used after the signal handler function ends.
 */
 
-void QQuickWebViewPrivate::setPageProxy(QtWebPageProxy* pageProxy)
-{
-    this->pageProxy.reset(pageProxy);
-}
-
 QQuickWebViewAttached::QQuickWebViewAttached(QObject* object)
     : QObject(object)
     , m_view(0)
@@ -585,7 +573,7 @@ void QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour(bool enable)
 void QQuickWebViewExperimental::postMessage(const QString& message)
 {
     Q_D(QQuickWebView);
-    d->context->postMessageToNavigatorQtObject(d->webPageProxy(), message);
+    d->context->postMessageToNavigatorQtObject(d->webPageProxy.get(), message);
 }
 
 QDeclarativeComponent* QQuickWebViewExperimental::alertDialog() const
@@ -706,38 +694,38 @@ QQuickWebPage* QQuickWebView::page()
 void QQuickWebView::load(const QUrl& url)
 {
     Q_D(QQuickWebView);
-    d->webPageProxy()->loadURL(url.toString());
+    d->webPageProxy->loadURL(url.toString());
 }
 
 void QQuickWebView::goBack()
 {
     Q_D(QQuickWebView);
-    d->webPageProxy()->goBack();
+    d->webPageProxy->goBack();
 }
 
 void QQuickWebView::goForward()
 {
     Q_D(QQuickWebView);
-    d->webPageProxy()->goForward();
+    d->webPageProxy->goForward();
 }
 
 void QQuickWebView::stop()
 {
     Q_D(QQuickWebView);
-    d->webPageProxy()->stopLoading();
+    d->webPageProxy->stopLoading();
 }
 
 void QQuickWebView::reload()
 {
     Q_D(QQuickWebView);
     const bool reloadFromOrigin = true;
-    d->webPageProxy()->reload(reloadFromOrigin);
+    d->webPageProxy->reload(reloadFromOrigin);
 }
 
 QUrl QQuickWebView::url() const
 {
     Q_D(const QQuickWebView);
-    RefPtr<WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+    RefPtr<WebFrameProxy> mainFrame = d->webPageProxy->mainFrame();
     if (!mainFrame)
         return QUrl();
     return QUrl(QString(mainFrame->url()));
@@ -752,35 +740,35 @@ int QQuickWebView::loadProgress() const
 bool QQuickWebView::canGoBack() const
 {
     Q_D(const QQuickWebView);
-    return d->webPageProxy()->canGoBack();
+    return d->webPageProxy->canGoBack();
 }
 
 bool QQuickWebView::canGoForward() const
 {
     Q_D(const QQuickWebView);
-    return d->webPageProxy()->canGoForward();
+    return d->webPageProxy->canGoForward();
 }
 
 bool QQuickWebView::loading() const
 {
     Q_D(const QQuickWebView);
-    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy->mainFrame();
     return mainFrame && !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
 }
 
 bool QQuickWebView::canReload() const
 {
     Q_D(const QQuickWebView);
-    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy()->mainFrame();
+    RefPtr<WebKit::WebFrameProxy> mainFrame = d->webPageProxy->mainFrame();
     if (mainFrame)
         return (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
-    return d->webPageProxy()->backForwardList()->currentItem();
+    return d->webPageProxy->backForwardList()->currentItem();
 }
 
 QString QQuickWebView::title() const
 {
     Q_D(const QQuickWebView);
-    return d->webPageProxy()->pageTitle();
+    return d->webPageProxy->pageTitle();
 }
 
 QWebPreferences* QQuickWebView::preferences() const
@@ -835,7 +823,7 @@ void QQuickWebView::focusOutEvent(QFocusEvent* event)
 WKPageRef QQuickWebView::pageRef() const
 {
     Q_D(const QQuickWebView);
-    return d->pageProxy->pageRef();
+    return toAPI(d->webPageProxy.get());
 }
 
 /*!
@@ -849,7 +837,7 @@ WKPageRef QQuickWebView::pageRef() const
 void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl)
 {
     Q_D(QQuickWebView);
-    d->webPageProxy()->loadHTMLString(html, baseUrl.toString());
+    d->webPageProxy->loadHTMLString(html, baseUrl.toString());
 }
 
 #include "moc_qquickwebview_p.cpp"
index 9222e745f8557f5ba741b2ace0e743b7edde6fec..673fd139202150edb0a1b2e886ecc63f89e343df 100644 (file)
@@ -141,7 +141,6 @@ private:
 
     friend class QtWebPageLoadClient;
     friend class QtWebPagePolicyClient;
-    friend class QtWebPageProxy;
     friend class QtWebPageUIClient;
     friend class WTR::PlatformWebView;
     friend class QQuickWebViewExperimental;
@@ -215,7 +214,6 @@ private:
     QQuickWebViewPrivate* d_ptr;
     QWebViewportInfo* m_viewportInfo;
 
-    friend class QtWebPageProxy;
     friend class QtWebPageUIClient;
 
     Q_DECLARE_PRIVATE(QQuickWebView)
index debdfda23b8ff5b83f15ff6616f32569e286bcdd..a96d43462044d4d39704db17bd3080cd3ca5c5a9 100644 (file)
@@ -26,9 +26,9 @@
 #include "QtViewportInteractionEngine.h"
 #include "QtWebPageLoadClient.h"
 #include "QtWebPagePolicyClient.h"
-#include "QtWebPageProxy.h"
 #include "QtWebPageUIClient.h"
 #include "QtWebUndoController.h"
+#include "WebPageProxy.h"
 
 #include "qquickwebview_p.h"
 #include "qquickwebpage_p.h"
@@ -43,7 +43,6 @@ class DownloadProxy;
 class QtWebContext;
 class WebPageProxy;
 }
-class QtWebPageProxy;
 class QWebNavigationHistory;
 class QWebViewportInfo;
 
@@ -56,6 +55,7 @@ class QQuickWebViewPrivate {
     Q_DECLARE_PUBLIC(QQuickWebView)
     friend class QQuickWebViewExperimental;
     friend class QQuickWebPage;
+    friend class QWebPreferencesPrivate;
     friend class QWebViewportInfo;
 
 public:
@@ -65,7 +65,6 @@ public:
     virtual ~QQuickWebViewPrivate();
 
     void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
-    void setPageProxy(QtWebPageProxy*);
 
     void initializeTouch(QQuickWebView* viewport);
     void initializeDesktop(QQuickWebView* viewport);
@@ -102,8 +101,6 @@ public:
     bool navigatorQtObjectEnabled() const;
     void setNavigatorQtObjectEnabled(bool);
 
-    WebKit::WebPageProxy* webPageProxy() const;
-
     // PageClient.
     WebCore::IntSize viewSize() const;
     void didReceiveMessageFromNavigatorQtObject(const String& message);
@@ -132,6 +129,7 @@ private:
     };
 
     RefPtr<QtWebContext> context;
+    RefPtr<WebKit::WebPageProxy> webPageProxy;
 
     QtPageClient pageClient;
     QtWebUndoController undoController;
@@ -146,7 +144,6 @@ private:
     QScopedPointer<QtViewportInteractionEngine> interactionEngine;
 
     QQuickWebView* q_ptr;
-    QScopedPointer<QtWebPageProxy> pageProxy;
 
     QDeclarativeComponent* alertDialog;
     QDeclarativeComponent* confirmDialog;
index 29b715948110a0856222ca35dbe7fd962ffdc1ec..c8cc5ab32fe2498e65e63363eb2b60606c804fb1 100644 (file)
@@ -40,7 +40,6 @@ class WebBackForwardList;
 
 class QWebNavigationHistory;
 class QWebNavigationListModel;
-class QtWebPageProxy;
 
 class QWebNavigationListModelPrivate {
 public:
index d85b3e344de71e64c6ae4d28abe28d4d0777b8ed..71c11afe5764f9d0e61e565f2ed3e3c8f98dee25 100644 (file)
@@ -394,7 +394,7 @@ void QWebPreferences::setDefaultFixedFontSize(unsigned size)
 
 WKPreferencesRef QWebPreferencesPrivate::preferencesRef() const
 {
-    WKPageGroupRef pageGroupRef = toAPI(webViewPrivate->webPageProxy()->pageGroup());
+    WKPageGroupRef pageGroupRef = toAPI(webViewPrivate->webPageProxy->pageGroup());
     return WKPageGroupGetPreferences(pageGroupRef);
 }
 
index f9aa023ffebf92fc9b159256e552c446abc269b0..1db4eaa9b22b1641e43ff1f45a139dbf6ef527c8 100644 (file)
@@ -44,10 +44,6 @@ namespace WebCore {
     struct ViewportArguments;
 }
 
-#if PLATFORM(QT)
-class QtWebPageProxy;
-#endif
-
 namespace WebKit {
 
 class DrawingAreaProxy;
index 3c796aea319809bd3764363a3dbae49cfede3010..41535050a4e1b32d69b1242c478af0a8bce703d1 100644 (file)
@@ -22,7 +22,6 @@
 #include "QtPageClient.h"
 
 #include "QtWebPageEventHandler.h"
-#include "QtWebPageProxy.h"
 #include "QtWebUndoController.h"
 #include "WebContextMenuProxyQt.h"
 #include "WebEditCommandProxy.h"
@@ -40,7 +39,6 @@ using namespace WebCore;
 
 QtPageClient::QtPageClient()
     : m_webView(0)
-    , m_qtWebPageProxy(0)
     , m_eventHandler(0)
     , m_undoController(0)
 {
@@ -50,6 +48,13 @@ QtPageClient::~QtPageClient()
 {
 }
 
+void QtPageClient::initialize(QQuickWebView* webView, QtWebPageEventHandler* eventHandler, QtWebUndoController* undoController)
+{
+    m_webView = webView;
+    m_eventHandler = eventHandler;
+    m_undoController = undoController;
+}
+
 PassOwnPtr<DrawingAreaProxy> QtPageClient::createDrawingAreaProxy()
 {
     return QQuickWebViewPrivate::get(m_webView)->createDrawingAreaProxy();
@@ -153,12 +158,12 @@ IntRect QtPageClient::windowToScreen(const IntRect& rect)
 
 PassRefPtr<WebPopupMenuProxy> QtPageClient::createPopupMenuProxy(WebPageProxy* webPageProxy)
 {
-    return WebPopupMenuProxyQt::create(toImpl(m_qtWebPageProxy->pageRef()), m_webView);
+    return WebPopupMenuProxyQt::create(webPageProxy, m_webView);
 }
 
-PassRefPtr<WebContextMenuProxy> QtPageClient::createContextMenuProxy(WebPageProxy*)
+PassRefPtr<WebContextMenuProxy> QtPageClient::createContextMenuProxy(WebPageProxy* webPageProxy)
 {
-    return WebContextMenuProxyQt::create(m_qtWebPageProxy);
+    return WebContextMenuProxyQt::create(webPageProxy);
 }
 
 void QtPageClient::flashBackingStoreUpdates(const Vector<IntRect>&)
index e0e560947bcdc476a1159cb3cf7325b6e1fd2f20..6e726036a7d3263b4d0a82befa84eb664282e33d 100644 (file)
@@ -38,6 +38,8 @@ public:
     QtPageClient();
     ~QtPageClient();
 
+    void initialize(QQuickWebView*, QtWebPageEventHandler*, QtWebUndoController*);
+
     // QQuickWebView.
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
     virtual WebCore::IntSize viewSize();
@@ -95,17 +97,8 @@ public:
     virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
 #endif
 
-    void initialize(QQuickWebView* webView, QtWebPageProxy* pageProxy, QtWebPageEventHandler* eventHandler, QtWebUndoController* undoController)
-    {
-        m_webView = webView;
-        m_eventHandler = eventHandler;
-        m_qtWebPageProxy = pageProxy;
-        m_undoController = undoController;
-    }
-
 private:
     QQuickWebView* m_webView;
-    QtWebPageProxy* m_qtWebPageProxy;
     QtWebPageEventHandler* m_eventHandler;
     QtWebUndoController* m_undoController;
 };
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
deleted file mode 100644 (file)
index 148a54f..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "QtWebPageProxy.h"
-
-#include <QtQuick/qquickcanvas.h>
-#include "qquickwebview_p.h"
-#include "qquickwebview_p_p.h"
-
-#include "QtPageClient.h"
-#include "QtWebContext.h"
-#include "WebBackForwardList.h"
-#include "WKStringQt.h"
-#include <WebKit2/WKFrame.h>
-#include <WebKit2/WKPageGroup.h>
-#include <WebKit2/WKRetainPtr.h>
-
-using namespace WebKit;
-using namespace WebCore;
-
-QtWebPageProxy::QtWebPageProxy(QQuickWebView* qmlWebView, QtPageClient *pageClient, PassRefPtr<QtWebContext> context, WKPageGroupRef pageGroupRef)
-    : m_qmlWebView(qmlWebView)
-    , m_context(context)
-{
-    m_webPageProxy = m_context->createWebPage(pageClient, toImpl(pageGroupRef));
-}
-
-void QtWebPageProxy::init()
-{
-    m_webPageProxy->initializeWebPage();
-}
-
-QtWebPageProxy::~QtWebPageProxy()
-{
-    m_webPageProxy->close();
-}
-
-void QtWebPageProxy::showContextMenu(QSharedPointer<QMenu> menu)
-{
-    // Remove the active menu in case this function is called twice.
-    if (activeMenu)
-        activeMenu->hide();
-
-    if (menu->isEmpty())
-        return;
-
-    QWindow* window = m_qmlWebView->canvas();
-    if (!window)
-        return;
-
-    activeMenu = menu;
-
-    activeMenu->window()->winId(); // Ensure that the menu has a window
-    Q_ASSERT(activeMenu->window()->windowHandle());
-    activeMenu->window()->windowHandle()->setTransientParent(window);
-
-    QPoint menuPositionInScene = m_qmlWebView->mapToScene(menu->pos()).toPoint();
-    menu->exec(window->mapToGlobal(menuPositionInScene));
-    // The last function to get out of exec() clear the local copy.
-    if (activeMenu == menu)
-        activeMenu.clear();
-}
-
-void QtWebPageProxy::hideContextMenu()
-{
-    if (activeMenu)
-        activeMenu->hide();
-}
-
-WKPageRef QtWebPageProxy::pageRef() const
-{
-    return toAPI(m_webPageProxy.get());;
-}
-
-void QtWebPageProxy::setCustomUserAgent(const QString& userAgent)
-{
-    WKRetainPtr<WKStringRef> wkUserAgent(WKStringCreateWithQString(userAgent));
-    WKPageSetCustomUserAgent(pageRef(), wkUserAgent.get());
-}
-
-QString QtWebPageProxy::customUserAgent() const
-{
-    return WKStringCopyQString(WKPageCopyCustomUserAgent(pageRef()));
-}
-
-qreal QtWebPageProxy::textZoomFactor() const
-{
-    return WKPageGetTextZoomFactor(pageRef());
-}
-
-void QtWebPageProxy::setTextZoomFactor(qreal zoomFactor)
-{
-    WKPageSetTextZoomFactor(pageRef(), zoomFactor);
-}
-
-qreal QtWebPageProxy::pageZoomFactor() const
-{
-    return WKPageGetPageZoomFactor(pageRef());
-}
-
-void QtWebPageProxy::setPageZoomFactor(qreal zoomFactor)
-{
-    WKPageSetPageZoomFactor(pageRef(), zoomFactor);
-}
-
-void QtWebPageProxy::setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor)
-{
-    WKPageSetPageAndTextZoomFactors(pageRef(), pageZoomFactor, textZoomFactor);
-}
-
-#include "moc_QtWebPageProxy.cpp"
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h b/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
deleted file mode 100644 (file)
index 780743f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef QtWebPageProxy_h
-#define QtWebPageProxy_h
-
-#include "WebPageProxy.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <QMenu>
-#include <QSharedPointer>
-
-class QtPageClient;
-class QQuickWebView;
-
-namespace WebKit {
-class QtWebContext;
-}
-
-using namespace WebKit;
-
-// FIXME: needs focus in/out, window activation, support through viewStateDidChange().
-class QtWebPageProxy : public QObject {
-    Q_OBJECT
-
-public:
-    QtWebPageProxy(QQuickWebView*, QtPageClient*, PassRefPtr<QtWebContext>, WKPageGroupRef = 0);
-    ~QtWebPageProxy();
-
-    WKPageRef pageRef() const;
-
-    void setCustomUserAgent(const QString&);
-    QString customUserAgent() const;
-
-    qreal textZoomFactor() const;
-    qreal pageZoomFactor() const;
-    void setTextZoomFactor(qreal zoomFactor);
-    void setPageZoomFactor(qreal zoomFactor);
-    void setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor);
-
-    void contextMenuItemSelected(const WebContextMenuItemData& data)
-    {
-        m_webPageProxy->contextMenuItemSelected(data);
-    }
-
-    void init();
-
-    void showContextMenu(QSharedPointer<QMenu>);
-    void hideContextMenu();
-
-public:
-    Q_SIGNAL void zoomableAreaFound(const QRect&);
-
-protected:
-    QQuickWebView* m_qmlWebView;
-    RefPtr<WebKit::WebPageProxy> m_webPageProxy;
-
-private:
-    RefPtr<QtWebContext> m_context;
-
-    QSharedPointer<QMenu> activeMenu;
-};
-
-#endif /* QtWebPageProxy_h */
index 8c89977b294c3d70813ff13e5e0474338290996b..b00951014ff2194c9fd841976fad5a12ea0fc9e4 100644 (file)
 #include "config.h"
 #include "WebContextMenuProxyQt.h"
 
-#include <IntPoint.h>
-#include <OwnPtr.h>
-#include <WebContextMenuItemData.h>
-#include <qmenu.h>
-#include <QtWebPageProxy.h>
-
 using namespace WebCore;
 
-Q_DECLARE_METATYPE(WebKit::WebContextMenuItemData);
-
 namespace WebKit {
 
-WebContextMenuProxyQt::WebContextMenuProxyQt(QtWebPageProxy* pageProxy)
-    : m_webPageProxy(pageProxy)
-{
-}
-
-PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QtWebPageProxy *pageProxy)
+WebContextMenuProxyQt::WebContextMenuProxyQt(WebPageProxy*)
 {
-    return adoptRef(new WebContextMenuProxyQt(pageProxy));
 }
 
-void WebContextMenuProxyQt::actionTriggered(bool)
+PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(WebPageProxy* webPageProxy)
 {
-    QAction* qtAction = qobject_cast<QAction*>(sender());
-    if (!qtAction) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    QVariant data = qtAction->data();
-    if (!data.canConvert<WebContextMenuItemData>()) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    m_webPageProxy->contextMenuItemSelected(qtAction->data().value<WebContextMenuItemData>());
+    return adoptRef(new WebContextMenuProxyQt(webPageProxy));
 }
 
 void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items)
 {
-    // FIXME: Make this a QML compatible context menu.
 }
 
 void WebContextMenuProxyQt::hideContextMenu()
 {
-    m_webPageProxy->hideContextMenu();
-}
-
-PassOwnPtr<QMenu> WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) const
-{
-    // FIXME: Make this a QML compatible context menu.
-    return nullptr;
 }
 
 #include "moc_WebContextMenuProxyQt.cpp"
index 79af961163e916b8597cd80e6983b129bed4c590..bd7aebd6ff3a48c974e9adc050063909b995444b 100644 (file)
 #define WebContextMenuProxyQt_h
 
 #include "WebContextMenuProxy.h"
-#include <PassOwnPtr.h>
 #include <QtCore/QObject>
 
-class QMenu;
-class QtWebPageProxy;
-
 namespace WebKit {
-class WebContextMenuItemData;
-}
-class QtWebPageProxy;
 
-namespace WebKit {
+class WebPageProxy;
 
 class WebContextMenuProxyQt : public QObject, public WebContextMenuProxy {
     Q_OBJECT
 public:
-    static PassRefPtr<WebContextMenuProxyQt> create(QtWebPageProxy*);
-
-private Q_SLOTS:
-    void actionTriggered(bool);
+    static PassRefPtr<WebContextMenuProxyQt> create(WebPageProxy*);
 
 private:
-    WebContextMenuProxyQt(QtWebPageProxy*);
+    WebContextMenuProxyQt(WebPageProxy*);
 
     virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
     virtual void hideContextMenu();
-
-    PassOwnPtr<QMenu> createContextMenu(const Vector<WebContextMenuItemData>& items) const;
-
-    QtWebPageProxy* const m_webPageProxy;
 };
 
 } // namespace WebKit