Title: [100739] trunk/Source/WebKit2
Revision
100739
Author
[email protected]
Date
2011-11-18 03:01:28 -0800 (Fri, 18 Nov 2011)

Log Message

[Qt] Removal of QtViewInterface part 1

Reviewed by Kenneth Rohde Christiansen.

Move all functions that forwarded from QtWebPageProxy to QtViewInterface and then
to QQuickWebView straight into QtWebPageProxy.

* UIProcess/API/qt/qquickwebpage_p.h:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::initialize):
* UIProcess/API/qt/qquickwebview_p_p.h:
* UIProcess/qt/QtViewInterface.cpp:
* UIProcess/qt/QtViewInterface.h:
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::QtWebPageProxy):
(QtWebPageProxy::setCursor):
(QtWebPageProxy::isViewWindowActive):
(QtWebPageProxy::isViewVisible):
(QtWebPageProxy::pageDidRequestScroll):
(QtWebPageProxy::didFinishFirstNonEmptyLayout):
(QtWebPageProxy::didChangeContentsSize):
(QtWebPageProxy::didChangeViewportProperties):
(QtWebPageProxy::toolTipChanged):
(QtWebPageProxy::didChangeUrl):
(QtWebPageProxy::didChangeTitle):
(QtWebPageProxy::loadDidBegin):
(QtWebPageProxy::loadDidCommit):
(QtWebPageProxy::loadDidSucceed):
(QtWebPageProxy::loadDidFail):
(QtWebPageProxy::didRelaunchProcess):
(QtWebPageProxy::processDidCrash):
(QtWebPageProxy::startDrag):
(QtWebPageProxy::didReceiveDownloadResponse):
* UIProcess/qt/QtWebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (100738 => 100739)


--- trunk/Source/WebKit2/ChangeLog	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-18 11:01:28 UTC (rev 100739)
@@ -4,6 +4,43 @@
 
         Reviewed by Kenneth Rohde Christiansen.
 
+        Move all functions that forwarded from QtWebPageProxy to QtViewInterface and then
+        to QQuickWebView straight into QtWebPageProxy.
+
+        * UIProcess/API/qt/qquickwebpage_p.h:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::initialize):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        * UIProcess/qt/QtViewInterface.cpp:
+        * UIProcess/qt/QtViewInterface.h:
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::QtWebPageProxy):
+        (QtWebPageProxy::setCursor):
+        (QtWebPageProxy::isViewWindowActive):
+        (QtWebPageProxy::isViewVisible):
+        (QtWebPageProxy::pageDidRequestScroll):
+        (QtWebPageProxy::didFinishFirstNonEmptyLayout):
+        (QtWebPageProxy::didChangeContentsSize):
+        (QtWebPageProxy::didChangeViewportProperties):
+        (QtWebPageProxy::toolTipChanged):
+        (QtWebPageProxy::didChangeUrl):
+        (QtWebPageProxy::didChangeTitle):
+        (QtWebPageProxy::loadDidBegin):
+        (QtWebPageProxy::loadDidCommit):
+        (QtWebPageProxy::loadDidSucceed):
+        (QtWebPageProxy::loadDidFail):
+        (QtWebPageProxy::didRelaunchProcess):
+        (QtWebPageProxy::processDidCrash):
+        (QtWebPageProxy::startDrag):
+        (QtWebPageProxy::didReceiveDownloadResponse):
+        * UIProcess/qt/QtWebPageProxy.h:
+
+2011-11-18  Simon Hausmann  <[email protected]>
+
+        [Qt] Removal of QtViewInterface part 1
+
+        Reviewed by Kenneth Rohde Christiansen.
+
         Replace functions of QtViewInterface that forward to QQuickWebPage with direct
         usage of QQuickWebPage. Also removed some dead code.
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h	2011-11-18 11:01:28 UTC (rev 100739)
@@ -34,6 +34,7 @@
 class QtViewInterface;
 class QtSGUpdateQueue;
 }
+class QtWebPageProxy;
 
 class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
     Q_OBJECT
@@ -74,6 +75,7 @@
     QQuickWebPagePrivate* d;
     friend class QQuickWebViewPrivate;
     friend class WebKit::QtViewInterface;
+    friend class QtWebPageProxy;
 };
 
 QML_DECLARE_TYPE(QQuickWebPage)

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-11-18 11:01:28 UTC (rev 100739)
@@ -73,7 +73,7 @@
     viewInterface.reset(new WebKit::QtViewInterface(viewport));
 
     QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    setPageProxy(new QtWebPageProxy(pageView.data(), viewInterface.data(), 0, this, contextRef, pageGroupRef));
+    setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, viewInterface.data(), 0, this, contextRef, pageGroupRef));
     pageViewPrivate->setPageProxy(pageProxy.data());
 
     QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2011-11-18 11:01:28 UTC (rev 100739)
@@ -27,6 +27,7 @@
 #include "QtWebPageProxy.h"
 
 #include "qquickwebview_p.h"
+#include "qquickwebpage_p.h"
 
 #include <QtCore/QObject>
 #include <QtCore/QScopedPointer>

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp	2011-11-18 11:01:28 UTC (rev 100739)
@@ -40,97 +40,11 @@
     Q_ASSERT(m_viewportView);
 }
 
-void QtViewInterface::didFinishFirstNonEmptyLayout()
-{
-    m_viewportView->d_func()->didFinishFirstNonEmptyLayout();
-}
-
-void QtViewInterface::didChangeContentsSize(const QSize& newSize)
-{
-    m_viewportView->d_func()->didChangeContentsSize(newSize);
-}
-
-void QtViewInterface::didChangeViewportProperties(const WebCore::ViewportArguments& args)
-{
-    m_viewportView->d_func()->didChangeViewportProperties(args);
-}
-
-void QtViewInterface::scrollPositionRequested(const QPoint& pos)
-{
-    m_viewportView->d_func()->scrollPositionRequested(pos);
-}
-
-bool QtViewInterface::isActive()
-{
-    // FIXME: The scene graph does not have the concept of being active or not when this was written.
-    return true;
-}
-
-bool QtViewInterface::isVisible()
-{
-    return m_viewportView->isVisible();
-}
-
-void QtViewInterface::startDrag(Qt::DropActions supportedDropActions, const QImage& dragImage, QMimeData* data, QPoint* clientPosition, QPoint* globalPosition, Qt::DropAction* dropAction)
-{
-    QWindow* window = m_viewportView->canvas();
-    if (!window)
-        return;
-
-    QDrag* drag = new QDrag(window);
-    drag->setPixmap(QPixmap::fromImage(dragImage));
-    drag->setMimeData(data);
-    *dropAction = drag->exec(supportedDropActions);
-    *globalPosition = QCursor::pos();
-    *clientPosition = window->mapFromGlobal(*globalPosition);
-}
-
-void QtViewInterface::didChangeUrl(const QUrl& url)
-{
-    emit m_viewportView->urlChanged(url);
-}
-
-void QtViewInterface::didChangeTitle(const QString& newTitle)
-{
-    emit m_viewportView->titleChanged(newTitle);
-}
-
-void QtViewInterface::didChangeToolTip(const QString&)
-{
-    // There is not yet any UI defined for the tooltips for mobile so we ignore the change.
-}
-
 void QtViewInterface::didChangeStatusText(const QString& newMessage)
 {
     emit m_viewportView->statusBarMessageChanged(newMessage);
 }
 
-void QtViewInterface::didChangeCursor(const QCursor& newCursor)
-{
-    // FIXME: This is a temporary fix until we get cursor support in QML items.
-    QGuiApplication::setOverrideCursor(newCursor);
-}
-
-void QtViewInterface::loadDidBegin()
-{
-    emit m_viewportView->loadStarted();
-}
-
-void QtViewInterface::loadDidCommit()
-{
-    m_viewportView->d_func()->loadDidCommit();
-}
-
-void QtViewInterface::loadDidSucceed()
-{
-    emit m_viewportView->loadSucceeded();
-}
-
-void QtViewInterface::loadDidFail(const QtWebError& error)
-{
-    emit m_viewportView->loadFailed(static_cast<QQuickWebView::ErrorType>(error.type()), error.errorCode(), error.url());
-}
-
 void QtViewInterface::didChangeLoadProgress(int percentageLoaded)
 {
     emit m_viewportView->loadProgressChanged(percentageLoaded);
@@ -192,26 +106,6 @@
     return m_viewportView->d_func()->runJavaScriptPrompt(message, defaultValue, ok);
 }
 
-void QtViewInterface::processDidCrash(const QUrl& url)
-{
-    qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(url.toString(QUrl::RemoveUserInfo)));
-
-}
-
-void QtViewInterface::didRelaunchProcess()
-{
-    qWarning("WARNING: The web process has been successfully restarted.");
-}
-
-void QtViewInterface::downloadRequested(QWebDownloadItem* downloadItem)
-{
-    if (!downloadItem)
-        return;
-
-    QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::_javascript_Ownership);
-    emit m_viewportView->downloadRequested(downloadItem);
-}
-
 void QtViewInterface::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtViewInterface::FileChooserType type)
 {
     m_viewportView->d_func()->chooseFiles(listenerRef, selectedFileNames, type);

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h	2011-11-18 11:01:28 UTC (rev 100739)
@@ -60,26 +60,7 @@
 
     QtViewInterface(QQuickWebView* viewportView);
 
-    virtual void scrollPositionRequested(const QPoint& pos);
-
-    virtual bool isActive();
-    virtual bool isVisible();
-
-    virtual void startDrag(Qt::DropActions supportedDropActions, const QImage& dragImage, QMimeData*, QPoint* clientPosition, QPoint* globalPosition, Qt::DropAction*);
-
-    virtual void didFinishFirstNonEmptyLayout();
-    virtual void didChangeContentsSize(const QSize&);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
-
-    virtual void didChangeUrl(const QUrl&);
-    virtual void didChangeTitle(const QString&);
-    virtual void didChangeToolTip(const QString&);
     virtual void didChangeStatusText(const QString&);
-    virtual void didChangeCursor(const QCursor&);
-    virtual void loadDidBegin();
-    virtual void loadDidCommit();
-    virtual void loadDidSucceed();
-    virtual void loadDidFail(const QtWebError&);
     virtual void didChangeLoadProgress(int);
 
     virtual void showContextMenu(QSharedPointer<QMenu>);
@@ -89,15 +70,10 @@
     virtual bool runJavaScriptConfirm(const QString&);
     virtual QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
 
-    virtual void processDidCrash(const QUrl&);
-    virtual void didRelaunchProcess();
-
     virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, FileChooserType);
 
     virtual void didMouseMoveOverElement(const QUrl&, const QString&);
 
-    virtual void downloadRequested(QWebDownloadItem*);
-
 private:
     QQuickWebView* const m_viewportView;
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-11-18 11:01:28 UTC (rev 100739)
@@ -21,6 +21,10 @@
 #include "config.h"
 #include "QtWebPageProxy.h"
 
+#include <qdeclarativeengine.h>
+#include <qquickcanvas.h>
+#include "qquickwebview_p.h"
+#include "qquickwebview_p_p.h"
 #include "qquickwebpage_p.h"
 #include "QtWebError.h"
 #include "qwebdownloaditem_p.h"
@@ -52,6 +56,7 @@
 #include "WebPopupMenuProxyQt.h"
 #include "WKStringQt.h"
 #include "WKURLQt.h"
+#include <QDrag>
 #include <QGuiApplication>
 #include <QGraphicsSceneMouseEvent>
 #include <QJSEngine>
@@ -129,8 +134,9 @@
     return (DragOperation)result;
 }
 
-QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QtViewInterface* viewInterface, QtViewportInteractionEngine* viewportInteractionEngine, QtPolicyInterface* policyInterface, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, QtViewInterface* viewInterface, QtViewportInteractionEngine* viewportInteractionEngine, QtPolicyInterface* policyInterface, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
     : m_qmlWebPage(qmlWebPage)
+    , m_qmlWebView(qmlWebView)
     , m_viewInterface(viewInterface)
     , m_interactionEngine(viewportInteractionEngine)
     , m_panGestureRecognizer(viewportInteractionEngine)
@@ -384,7 +390,8 @@
 
 void QtWebPageProxy::setCursor(const WebCore::Cursor& cursor)
 {
-    m_viewInterface->didChangeCursor(*cursor.platformCursor());
+    // FIXME: This is a temporary fix until we get cursor support in QML items.
+    QGuiApplication::setOverrideCursor(*cursor.platformCursor());
 }
 
 void QtWebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
@@ -414,7 +421,8 @@
 
 bool QtWebPageProxy::isViewWindowActive()
 {
-    return m_viewInterface->isActive();
+    // FIXME: The scene graph does not have the concept of being active or not when this was written.
+    return true;
 }
 
 bool QtWebPageProxy::isViewFocused()
@@ -424,7 +432,7 @@
 
 bool QtWebPageProxy::isViewVisible()
 {
-    return m_viewInterface->isVisible() && m_qmlWebPage->isVisible();
+    return m_qmlWebView->isVisible() && m_qmlWebPage->isVisible();
 }
 
 bool QtWebPageProxy::isViewInWindow()
@@ -445,27 +453,27 @@
 
 void QtWebPageProxy::pageDidRequestScroll(const IntPoint& pos)
 {
-    m_viewInterface->scrollPositionRequested(pos);
+    m_qmlWebView->d_func()->scrollPositionRequested(pos);
 }
 
 void QtWebPageProxy::didFinishFirstNonEmptyLayout()
 {
-    m_viewInterface->didFinishFirstNonEmptyLayout();
+    m_qmlWebView->d_func()->didFinishFirstNonEmptyLayout();
 }
 
 void QtWebPageProxy::didChangeContentsSize(const IntSize& newSize)
 {
-    m_viewInterface->didChangeContentsSize(QSize(newSize));
+    m_qmlWebView->d_func()->didChangeContentsSize(newSize);
 }
 
 void QtWebPageProxy::didChangeViewportProperties(const WebCore::ViewportArguments& args)
 {
-    m_viewInterface->didChangeViewportProperties(args);
+    m_qmlWebView->d_func()->didChangeViewportProperties(args);
 }
 
 void QtWebPageProxy::toolTipChanged(const String&, const String& newTooltip)
 {
-    m_viewInterface->didChangeToolTip(QString(newTooltip));
+    // There is not yet any UI defined for the tooltips for mobile so we ignore the change.
 }
 
 void QtWebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo)
@@ -575,32 +583,32 @@
 
 void QtWebPageProxy::didChangeUrl(const QUrl& url)
 {
-    m_viewInterface->didChangeUrl(url);
+    emit m_qmlWebView->urlChanged(url);
 }
 
 void QtWebPageProxy::didChangeTitle(const QString& newTitle)
 {
-    m_viewInterface->didChangeTitle(newTitle);
+    emit m_qmlWebView->titleChanged(newTitle);
 }
 
 void QtWebPageProxy::loadDidBegin()
 {
-    m_viewInterface->loadDidBegin();
+    emit m_qmlWebView->loadStarted();
 }
 
 void QtWebPageProxy::loadDidCommit()
 {
-    m_viewInterface->loadDidCommit();
+    m_qmlWebView->d_func()->loadDidCommit();
 }
 
 void QtWebPageProxy::loadDidSucceed()
 {
-    m_viewInterface->loadDidSucceed();
+    emit m_qmlWebView->loadSucceeded();
 }
 
 void QtWebPageProxy::loadDidFail(const QtWebError& error)
 {
-    m_viewInterface->loadDidFail(error);
+    emit m_qmlWebView->loadFailed(static_cast<QQuickWebView::ErrorType>(error.type()), error.errorCode(), error.url());
 }
 
 void QtWebPageProxy::didChangeLoadProgress(int newLoadProgress)
@@ -661,7 +669,7 @@
 void QtWebPageProxy::didRelaunchProcess()
 {
     updateNavigationState();
-    m_viewInterface->didRelaunchProcess();
+    qWarning("WARNING: The web process has been successfully restarted.");
     setDrawingAreaSize(viewSize());
 }
 
@@ -673,7 +681,7 @@
     m_tapGestureRecognizer.reset();
 
     WebCore::KURL url(WebCore::ParsedURLString, m_webPageProxy->urlAtProcessExit());
-    m_viewInterface->processDidCrash(QUrl(url));
+    qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(QUrl(url).toString(QUrl::RemoveUserInfo)));
 }
 
 QWebPreferences* QtWebPageProxy::preferences() const
@@ -790,10 +798,16 @@
 
     QPoint clientPosition;
     QPoint globalPosition;
-    Qt::DropAction actualDropAction;
+    Qt::DropAction actualDropAction = Qt::IgnoreAction;
 
-    m_viewInterface->startDrag(supportedDropActions, dragQImage, mimeData,
-                               &clientPosition, &globalPosition, &actualDropAction);
+    if (QWindow* window = m_qmlWebView->canvas()) {
+        QDrag* drag = new QDrag(window);
+        drag->setPixmap(QPixmap::fromImage(dragQImage));
+        drag->setMimeData(mimeData);
+        actualDropAction = drag->exec(supportedDropActions);
+        globalPosition = QCursor::pos();
+        clientPosition = window->mapFromGlobal(globalPosition);
+    }
 
     m_webPageProxy->dragEnded(clientPosition, globalPosition, dropActionToDragOperation(actualDropAction));
 }
@@ -811,10 +825,14 @@
     s_downloadManager->addDownload(download, downloadItem);
 }
 
-void QtWebPageProxy::didReceiveDownloadResponse(QWebDownloadItem* download)
+void QtWebPageProxy::didReceiveDownloadResponse(QWebDownloadItem* downloadItem)
 {
     // Now that our downloadItem has everything we need we can emit downloadRequested.
-    m_viewInterface->downloadRequested(download);
+    if (!downloadItem)
+        return;
+
+    QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::_javascript_Ownership);
+    emit m_qmlWebView->downloadRequested(downloadItem);
 }
 
 PassOwnPtr<DrawingAreaProxy> QtWebPageProxy::createDrawingAreaProxy()

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (100738 => 100739)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-11-18 10:54:04 UTC (rev 100738)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-11-18 11:01:28 UTC (rev 100739)
@@ -50,6 +50,7 @@
 class QWebPreferences;
 class QWKHistory;
 class QQuickWebPage;
+class QQuickWebView;
 
 using namespace WebKit;
 
@@ -74,7 +75,7 @@
         WebActionCount
     };
 
-    QtWebPageProxy(QQuickWebPage*, WebKit::QtViewInterface*, WebKit::QtViewportInteractionEngine* = 0, WebKit::QtPolicyInterface* = 0, WKContextRef = 0, WKPageGroupRef = 0);
+    QtWebPageProxy(QQuickWebPage*, QQuickWebView*, WebKit::QtViewInterface*, WebKit::QtViewportInteractionEngine* = 0, WebKit::QtPolicyInterface* = 0, WKContextRef = 0, WKPageGroupRef = 0);
     ~QtWebPageProxy();
 
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
@@ -203,7 +204,7 @@
 
 public Q_SLOTS:
     void navigationStateChanged();
-    void didReceiveDownloadResponse(QWebDownloadItem*);
+    void didReceiveDownloadResponse(QWebDownloadItem* downloadItem);
 
 public:
     Q_SIGNAL void zoomableAreaFound(const QRect&);
@@ -212,6 +213,7 @@
 
 protected:
     QQuickWebPage* m_qmlWebPage;
+    QQuickWebView* m_qmlWebView;
     RefPtr<WebKit::WebPageProxy> m_webPageProxy;
     WebKit::QtViewInterface* const m_viewInterface;
     QtViewportInteractionEngine* m_interactionEngine;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to