Title: [101788] trunk/Source/WebKit2
Revision
101788
Author
[email protected]
Date
2011-12-02 05:37:20 -0800 (Fri, 02 Dec 2011)

Log Message

[Qt][WK2] Split the QtWebPageProxy into PageClient and QtPageProxy
https://bugs.webkit.org/show_bug.cgi?id=66668

Reviewed by Simon Hausmann.

Split QtPageClient out of QtWebPageProxy.
This client will live in QQuickWebViewPrivate and communicate directly
with QtWebPageProxy and QtWebPageEventHandler. The functions that need
anything else than these entities will need to call the proper implementation
through QtWebPageProxy itself.
With this we have a clear separation between PageClient and PageProxy, having
two well defined and separated entities for hooking our clients with our API layer (QtWebPageProxy)
and for hooking the WebPageProxy with our client implementations (QtPageClient).
As a positive side-effect we have a cleaner QtWebPageProxy.

* Target.pri:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
* UIProcess/API/qt/qquickwebview_p_p.h:
* UIProcess/qt/QtPageClient.cpp: Added.
(QtPageClient::QtPageClient):
(QtPageClient::~QtPageClient):
(QtPageClient::createDrawingAreaProxy):
(QtPageClient::setViewNeedsDisplay):
(QtPageClient::pageDidRequestScroll):
(QtPageClient::processDidCrash):
(QtPageClient::didRelaunchProcess):
(QtPageClient::didChangeContentsSize):
(QtPageClient::didChangeViewportProperties):
(QtPageClient::startDrag):
(QtPageClient::handleDownloadRequest):
(QtPageClient::setCursor):
(QtPageClient::setCursorHiddenUntilMouseMoves):
(QtPageClient::toolTipChanged):
(QtPageClient::registerEditCommand):
(QtPageClient::clearAllEditCommands):
(QtPageClient::canUndoRedo):
(QtPageClient::executeUndoRedo):
(QtPageClient::convertToDeviceSpace):
(QtPageClient::convertToUserSpace):
(QtPageClient::screenToWindow):
(QtPageClient::windowToScreen):
(QtPageClient::createPopupMenuProxy):
(QtPageClient::createContextMenuProxy):
(QtPageClient::flashBackingStoreUpdates):
(QtPageClient::didFindZoomableArea):
(QtPageClient::didReceiveMessageFromNavigatorQtObject):
(QtPageClient::doneWithTouchEvent):
(QtPageClient::displayView):
(QtPageClient::scrollView):
(QtPageClient::viewSize):
(QtPageClient::isViewWindowActive):
(QtPageClient::isViewFocused):
(QtPageClient::isViewVisible):
(QtPageClient::isViewInWindow):
(QtPageClient::enterAcceleratedCompositingMode):
(QtPageClient::exitAcceleratedCompositingMode):
* UIProcess/qt/QtPageClient.h: Added.
(QtPageClient::pageClosed):
(QtPageClient::doneWithKeyEvent):
(QtPageClient::setFindIndicator):
(QtPageClient::didCommitLoadForMainFrame):
(QtPageClient::didFinishLoadingDataForCustomRepresentation):
(QtPageClient::customRepresentationZoomFactor):
(QtPageClient::setCustomRepresentationZoomFactor):
(QtPageClient::didChangeScrollbarsForMainFrame):
(QtPageClient::findStringInCustomRepresentation):
(QtPageClient::countStringMatchesInCustomRepresentation):
(QtPageClient::setEventHandler):
(QtPageClient::setPageProxy):
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::QtWebPageProxy):
* UIProcess/qt/QtWebPageProxy.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (101787 => 101788)


--- trunk/Source/WebKit2/ChangeLog	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-02 13:37:20 UTC (rev 101788)
@@ -1,3 +1,79 @@
+2011-12-02  Jesus Sanchez-Palencia  <[email protected]>
+
+        [Qt][WK2] Split the QtWebPageProxy into PageClient and QtPageProxy
+        https://bugs.webkit.org/show_bug.cgi?id=66668
+
+        Reviewed by Simon Hausmann.
+
+        Split QtPageClient out of QtWebPageProxy.
+        This client will live in QQuickWebViewPrivate and communicate directly
+        with QtWebPageProxy and QtWebPageEventHandler. The functions that need
+        anything else than these entities will need to call the proper implementation
+        through QtWebPageProxy itself.
+        With this we have a clear separation between PageClient and PageProxy, having
+        two well defined and separated entities for hooking our clients with our API layer (QtWebPageProxy)
+        and for hooking the WebPageProxy with our client implementations (QtPageClient).
+        As a positive side-effect we have a cleaner QtWebPageProxy.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        * UIProcess/qt/QtPageClient.cpp: Added.
+        (QtPageClient::QtPageClient):
+        (QtPageClient::~QtPageClient):
+        (QtPageClient::createDrawingAreaProxy):
+        (QtPageClient::setViewNeedsDisplay):
+        (QtPageClient::pageDidRequestScroll):
+        (QtPageClient::processDidCrash):
+        (QtPageClient::didRelaunchProcess):
+        (QtPageClient::didChangeContentsSize):
+        (QtPageClient::didChangeViewportProperties):
+        (QtPageClient::startDrag):
+        (QtPageClient::handleDownloadRequest):
+        (QtPageClient::setCursor):
+        (QtPageClient::setCursorHiddenUntilMouseMoves):
+        (QtPageClient::toolTipChanged):
+        (QtPageClient::registerEditCommand):
+        (QtPageClient::clearAllEditCommands):
+        (QtPageClient::canUndoRedo):
+        (QtPageClient::executeUndoRedo):
+        (QtPageClient::convertToDeviceSpace):
+        (QtPageClient::convertToUserSpace):
+        (QtPageClient::screenToWindow):
+        (QtPageClient::windowToScreen):
+        (QtPageClient::createPopupMenuProxy):
+        (QtPageClient::createContextMenuProxy):
+        (QtPageClient::flashBackingStoreUpdates):
+        (QtPageClient::didFindZoomableArea):
+        (QtPageClient::didReceiveMessageFromNavigatorQtObject):
+        (QtPageClient::doneWithTouchEvent):
+        (QtPageClient::displayView):
+        (QtPageClient::scrollView):
+        (QtPageClient::viewSize):
+        (QtPageClient::isViewWindowActive):
+        (QtPageClient::isViewFocused):
+        (QtPageClient::isViewVisible):
+        (QtPageClient::isViewInWindow):
+        (QtPageClient::enterAcceleratedCompositingMode):
+        (QtPageClient::exitAcceleratedCompositingMode):
+        * UIProcess/qt/QtPageClient.h: Added.
+        (QtPageClient::pageClosed):
+        (QtPageClient::doneWithKeyEvent):
+        (QtPageClient::setFindIndicator):
+        (QtPageClient::didCommitLoadForMainFrame):
+        (QtPageClient::didFinishLoadingDataForCustomRepresentation):
+        (QtPageClient::customRepresentationZoomFactor):
+        (QtPageClient::setCustomRepresentationZoomFactor):
+        (QtPageClient::didChangeScrollbarsForMainFrame):
+        (QtPageClient::findStringInCustomRepresentation):
+        (QtPageClient::countStringMatchesInCustomRepresentation):
+        (QtPageClient::setEventHandler):
+        (QtPageClient::setPageProxy):
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::QtWebPageProxy):
+        * UIProcess/qt/QtWebPageProxy.h:
+
 2011-12-02  Kenneth Rohde Christiansen  <[email protected]>
 
         [Qt] Do not apply the transition state before we are unsuspended

Modified: trunk/Source/WebKit2/Target.pri (101787 => 101788)


--- trunk/Source/WebKit2/Target.pri	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/Target.pri	2011-12-02 13:37:20 UTC (rev 101788)
@@ -252,6 +252,7 @@
     UIProcess/qt/QtWebError.h \
     UIProcess/qt/QtDialogRunner.h \
     UIProcess/qt/QtDownloadManager.h \
+    UIProcess/qt/QtPageClient.h \
     UIProcess/qt/QtWebPageLoadClient.h \
     UIProcess/qt/QtWebPagePolicyClient.h \
     UIProcess/qt/QtWebPageProxy.h \
@@ -564,6 +565,7 @@
     UIProcess/qt/QtWebError.cpp \
     UIProcess/qt/QtDialogRunner.cpp \
     UIProcess/qt/QtDownloadManager.cpp \
+    UIProcess/qt/QtPageClient.cpp \
     UIProcess/qt/QtWebPageLoadClient.cpp \
     UIProcess/qt/QtWebPagePolicyClient.cpp \
     UIProcess/qt/QtWebPageProxy.cpp \

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-12-02 13:37:20 UTC (rev 101788)
@@ -50,8 +50,10 @@
     QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
     pageView.reset(new QQuickWebPage(viewport));
 
+    pageClient.reset(new QtPageClient());
+
     QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, contextRef, pageGroupRef));
+    setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, pageClient.data(), contextRef, pageGroupRef));
     pageViewPrivate->setPageProxy(pageProxy.data());
 
     pageLoadClient.reset(new QtWebPageLoadClient(pageProxy->pageRef(), q_ptr));
@@ -63,6 +65,9 @@
     setUseTraditionalDesktopBehaviour(false);
     QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);
 
+    pageClient->setEventHandler(eventHandler.data());
+    pageClient->setPageProxy(pageProxy.data());
+
     // Creates a page with the page creation parameters.
     pageProxy->init(eventHandler.data());
 }

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2011-12-02 13:37:20 UTC (rev 101788)
@@ -21,6 +21,7 @@
 #ifndef qquickwebview_p_p_h
 #define qquickwebview_p_p_h
 
+#include "QtPageClient.h"
 #include "QtWebPageEventHandler.h"
 #include "QtViewportInteractionEngine.h"
 #include "QtWebPageLoadClient.h"
@@ -110,6 +111,7 @@
 
     void setViewInAttachedProperties(QObject*);
 
+    QScopedPointer<QtPageClient> pageClient;
     QScopedPointer<QtWebPageEventHandler> eventHandler;
 
     QScopedPointer<QtWebPageLoadClient> pageLoadClient;

Added: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (0 => 101788)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2011-12-02 13:37:20 UTC (rev 101788)
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 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 "QtPageClient.h"
+
+#include "QtWebPageEventHandler.h"
+#include "QtWebPageProxy.h"
+#include "QtWebUndoCommand.h"
+#include "WebContextMenuProxyQt.h"
+#include "WebEditCommandProxy.h"
+#include "WebPopupMenuProxyQtDesktop.h"
+#include <QGuiApplication>
+#include <QUndoStack>
+#include <WebCore/Cursor.h>
+#include <WebCore/DragData.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/NotImplemented.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+QtPageClient::QtPageClient()
+    : m_qtWebPageProxy(0)
+{
+}
+
+QtPageClient::~QtPageClient()
+{
+}
+
+PassOwnPtr<DrawingAreaProxy> QtPageClient::createDrawingAreaProxy()
+{
+    return m_qtWebPageProxy->createDrawingAreaProxy();
+}
+
+void QtPageClient::setViewNeedsDisplay(const WebCore::IntRect& rect)
+{
+    m_qtWebPageProxy->setViewNeedsDisplay(rect);
+}
+
+void QtPageClient::pageDidRequestScroll(const IntPoint& pos)
+{
+    m_qtWebPageProxy->pageDidRequestScroll(pos);
+}
+
+void QtPageClient::processDidCrash()
+{
+    m_qtWebPageProxy->processDidCrash();
+}
+
+void QtPageClient::didRelaunchProcess()
+{
+    m_qtWebPageProxy->didRelaunchProcess();
+}
+
+void QtPageClient::didChangeContentsSize(const IntSize& newSize)
+{
+    m_qtWebPageProxy->didChangeContentsSize(newSize);
+}
+
+void QtPageClient::didChangeViewportProperties(const WebCore::ViewportArguments& args)
+{
+    m_qtWebPageProxy->didChangeViewportProperties(args);
+}
+
+void QtPageClient::startDrag(const WebCore::DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
+{
+    m_qtWebPageProxy->startDrag(dragData, dragImage);
+}
+
+void QtPageClient::handleDownloadRequest(DownloadProxy* download)
+{
+    m_qtWebPageProxy->handleDownloadRequest(download);
+}
+
+void QtPageClient::setCursor(const WebCore::Cursor& cursor)
+{
+    // FIXME: This is a temporary fix until we get cursor support in QML items.
+    QGuiApplication::setOverrideCursor(*cursor.platformCursor());
+}
+
+void QtPageClient::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
+{
+    notImplemented();
+}
+
+void QtPageClient::toolTipChanged(const String&, const String& newTooltip)
+{
+    // There is not yet any UI defined for the tooltips for mobile so we ignore the change.
+}
+
+void QtPageClient::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+    m_qtWebPageProxy->registerEditCommand(command, undoOrRedo);
+}
+
+void QtPageClient::clearAllEditCommands()
+{
+    m_qtWebPageProxy->clearAllEditCommands();
+}
+
+bool QtPageClient::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+    return m_qtWebPageProxy->canUndoRedo(undoOrRedo);
+}
+
+void QtPageClient::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+    m_qtWebPageProxy->executeUndoRedo(undoOrRedo);
+}
+
+FloatRect QtPageClient::convertToDeviceSpace(const FloatRect& rect)
+{
+    return rect;
+}
+
+FloatRect QtPageClient::convertToUserSpace(const FloatRect& rect)
+{
+    return rect;
+}
+
+IntPoint QtPageClient::screenToWindow(const IntPoint& point)
+{
+    return point;
+}
+
+IntRect QtPageClient::windowToScreen(const IntRect& rect)
+{
+    return rect;
+}
+
+PassRefPtr<WebPopupMenuProxy> QtPageClient::createPopupMenuProxy(WebPageProxy* webPageProxy)
+{
+    return m_qtWebPageProxy->createPopupMenuProxy(webPageProxy);
+}
+
+PassRefPtr<WebContextMenuProxy> QtPageClient::createContextMenuProxy(WebPageProxy*)
+{
+    return WebContextMenuProxyQt::create(m_qtWebPageProxy);
+}
+
+void QtPageClient::flashBackingStoreUpdates(const Vector<IntRect>&)
+{
+    notImplemented();
+}
+
+void QtPageClient::didFindZoomableArea(const IntPoint& target, const IntRect& area)
+{
+    ASSERT(m_eventHandler);
+    m_eventHandler->didFindZoomableArea(target, area);
+}
+
+void QtPageClient::didReceiveMessageFromNavigatorQtObject(const String& message)
+{
+    m_qtWebPageProxy->didReceiveMessageFromNavigatorQtObject(message);
+}
+
+#if ENABLE(TOUCH_EVENTS)
+void QtPageClient::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
+{
+    ASSERT(m_eventHandler);
+    m_eventHandler->doneWithTouchEvent(event, wasEventHandled);
+}
+#endif
+
+void QtPageClient::displayView()
+{
+    // FIXME: Implement.
+}
+
+void QtPageClient::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset)
+{
+    // FIXME: Implement.
+}
+
+WebCore::IntSize QtPageClient::viewSize()
+{
+    return m_qtWebPageProxy->viewSize();
+}
+
+bool QtPageClient::isViewWindowActive()
+{
+    // FIXME: The scene graph does not have the concept of being active or not when this was written.
+    return true;
+}
+
+bool QtPageClient::isViewFocused()
+{
+    if (!m_qtWebPageProxy)
+        return false;
+
+    return m_qtWebPageProxy->isViewFocused();
+}
+
+bool QtPageClient::isViewVisible()
+{
+    if (!m_qtWebPageProxy)
+        return false;
+
+    return m_qtWebPageProxy->isViewVisible();
+}
+
+bool QtPageClient::isViewInWindow()
+{
+    // FIXME: Implement.
+    return true;
+}
+
+void QtPageClient::enterAcceleratedCompositingMode(const LayerTreeContext&)
+{
+    // FIXME: Implement.
+}
+
+void QtPageClient::exitAcceleratedCompositingMode()
+{
+    // FIXME: Implement.
+}
+

Added: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (0 => 101788)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2011-12-02 13:37:20 UTC (rev 101788)
@@ -0,0 +1,98 @@
+/*
+ * 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 QtPageClient_h
+#define QtPageClient_h
+
+#include "DrawingAreaProxy.h"
+#include "LayerTreeContext.h"
+#include "PageClient.h"
+#include "ShareableBitmap.h"
+#include "ViewportArguments.h"
+
+class QtWebPageEventHandler;
+
+using namespace WebKit;
+
+class QtPageClient : public WebKit::PageClient {
+public:
+    QtPageClient();
+    ~QtPageClient();
+
+    virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
+    virtual void setViewNeedsDisplay(const WebCore::IntRect&);
+    virtual void displayView();
+    virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+    virtual WebCore::IntSize viewSize();
+    virtual bool isViewWindowActive();
+    virtual bool isViewFocused();
+    virtual bool isViewVisible();
+    virtual bool isViewInWindow();
+#if USE(ACCELERATED_COMPOSITING)
+    virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+    virtual void exitAcceleratedCompositingMode();
+#endif // USE(ACCELERATED_COMPOSITING)
+    virtual void pageDidRequestScroll(const WebCore::IntPoint&);
+    virtual void processDidCrash();
+    virtual void pageClosed() { }
+    virtual void didRelaunchProcess();
+    virtual void didChangeContentsSize(const WebCore::IntSize&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
+    virtual void setCursor(const WebCore::Cursor&);
+    virtual void setCursorHiddenUntilMouseMoves(bool);
+    virtual void toolTipChanged(const String&, const String&);
+    virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
+    virtual void clearAllEditCommands();
+    virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
+    virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
+    virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
+    virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+    virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
+    virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
+    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) { }
+    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
+    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
+    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) { }
+    virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) { }
+    virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) { }
+    virtual double customRepresentationZoomFactor() { return 1; }
+    virtual void setCustomRepresentationZoomFactor(double) { }
+    virtual void didChangeScrollbarsForMainFrame() const { }
+    virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+    virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }
+    virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }
+    virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
+    virtual void didReceiveMessageFromNavigatorQtObject(const String&);
+    virtual void handleDownloadRequest(DownloadProxy*);
+
+#if ENABLE(TOUCH_EVENTS)
+    virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
+#endif
+
+    void setEventHandler(QtWebPageEventHandler* eventHandler) { m_eventHandler = eventHandler; }
+    void setPageProxy(QtWebPageProxy* pageProxy) { m_qtWebPageProxy = pageProxy; }
+
+private:
+    QtWebPageProxy* m_qtWebPageProxy;
+    QtWebPageEventHandler* m_eventHandler;
+};
+
+#endif /* QtPageClient_h */

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (101787 => 101788)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-12-02 13:37:20 UTC (rev 101788)
@@ -26,7 +26,6 @@
 #include "qquickwebview_p.h"
 #include "qquickwebview_p_p.h"
 #include "qquickwebpage_p.h"
-#include "QtWebError.h"
 #include "qwebdownloaditem_p.h"
 #include "qwebdownloaditem_p_p.h"
 #include "qwebpreferences_p.h"
@@ -36,10 +35,8 @@
 #include "DrawingAreaProxyImpl.h"
 #include "qwkhistory.h"
 #include "qwkhistory_p.h"
-#include "FindIndicator.h"
-#include "LocalizedStrings.h"
-#include "NotImplemented.h"
 #include "QtDownloadManager.h"
+#include "QtPageClient.h"
 #include "QtWebPageEventHandler.h"
 #include "QtWebUndoCommand.h"
 #include "WebBackForwardList.h"
@@ -50,16 +47,9 @@
 #include "WKStringQt.h"
 #include "WKURLQt.h"
 #include <QDrag>
-#include <QGuiApplication>
-#include <QJSEngine>
 #include <QMimeData>
-#include <QStyleHints>
 #include <QUndoStack>
-#include <QtDebug>
-#include <WebCore/Cursor.h>
 #include <WebCore/DragData.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/Region.h>
 #include <WebKit2/WKFrame.h>
 #include <WebKit2/WKPageGroup.h>
 #include <WebKit2/WKRetainPtr.h>
@@ -67,14 +57,14 @@
 using namespace WebKit;
 using namespace WebCore;
 
-QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, QtPageClient *pageClient, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
     : m_qmlWebPage(qmlWebPage)
     , m_qmlWebView(qmlWebView)
     , m_context(contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext())
     , m_undoStack(adoptPtr(new QUndoStack(this)))
     , m_navigatorQtObjectEnabled(false)
 {
-    m_webPageProxy = m_context->createWebPage(this, toImpl(pageGroupRef));
+    m_webPageProxy = m_context->createWebPage(pageClient, toImpl(pageGroupRef));
     m_history = QWKHistoryPrivate::createHistory(this, m_webPageProxy->backForwardList());
 }
 
@@ -122,43 +112,16 @@
         activeMenu->hide();
 }
 
-void QtWebPageProxy::setCursor(const WebCore::Cursor& cursor)
-{
-    // FIXME: This is a temporary fix until we get cursor support in QML items.
-    QGuiApplication::setOverrideCursor(*cursor.platformCursor());
-}
-
-void QtWebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
-{
-    notImplemented();
-}
-
 void QtWebPageProxy::setViewNeedsDisplay(const WebCore::IntRect&)
 {
     m_qmlWebPage->update();
 }
 
-void QtWebPageProxy::displayView()
-{
-    // FIXME: Implement.
-}
-
-void QtWebPageProxy::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset)
-{
-    // FIXME: Implement.
-}
-
 WebCore::IntSize QtWebPageProxy::viewSize()
 {
     return WebCore::IntSize(m_qmlWebPage->width(), m_qmlWebPage->height());
 }
 
-bool QtWebPageProxy::isViewWindowActive()
-{
-    // FIXME: The scene graph does not have the concept of being active or not when this was written.
-    return true;
-}
-
 bool QtWebPageProxy::isViewFocused()
 {
     return m_qmlWebView->hasFocus();
@@ -169,22 +132,6 @@
     return m_qmlWebView->isVisible() && m_qmlWebPage->isVisible();
 }
 
-bool QtWebPageProxy::isViewInWindow()
-{
-    // FIXME: Implement.
-    return true;
-}
-
-void QtWebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext&)
-{
-    // FIXME: Implement.
-}
-
-void QtWebPageProxy::exitAcceleratedCompositingMode()
-{
-    // FIXME: Implement.
-}
-
 void QtWebPageProxy::pageDidRequestScroll(const IntPoint& pos)
 {
     m_qmlWebView->d_func()->scrollPositionRequested(pos);
@@ -200,11 +147,6 @@
     m_qmlWebView->d_func()->didChangeViewportProperties(args);
 }
 
-void QtWebPageProxy::toolTipChanged(const String&, const String& 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)
 {
     if (undoOrRedo == WebPageProxy::Undo) {
@@ -235,72 +177,20 @@
         m_undoStack->redo();
 }
 
-FloatRect QtWebPageProxy::convertToDeviceSpace(const FloatRect& rect)
-{
-    return rect;
-}
-
-IntPoint QtWebPageProxy::screenToWindow(const IntPoint& point)
-{
-    return point;
-}
-
-IntRect QtWebPageProxy::windowToScreen(const IntRect& rect)
-{
-    return rect;
-}
-
-FloatRect QtWebPageProxy::convertToUserSpace(const FloatRect& rect)
-{
-    return rect;
-}
-
 void QtWebPageProxy::selectionChanged(bool, bool, bool, bool)
 {
 }
 
-void QtWebPageProxy::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
-{
-}
-
 PassRefPtr<WebPopupMenuProxy> QtWebPageProxy::createPopupMenuProxy(WebPageProxy*)
 {
     return WebPopupMenuProxyQtDesktop::create(m_webPageProxy.get(), m_qmlWebView);
 }
 
-PassRefPtr<WebContextMenuProxy> QtWebPageProxy::createContextMenuProxy(WebPageProxy*)
-{
-    return WebContextMenuProxyQt::create(this);
-}
-
-void QtWebPageProxy::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate)
-{
-}
-
-void QtWebPageProxy::didCommitLoadForMainFrame(bool useCustomRepresentation)
-{
-}
-
-void QtWebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&)
-{
-}
-
-void QtWebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>&)
-{
-    notImplemented();
-}
-
 WKPageRef QtWebPageProxy::pageRef() const
 {
     return toAPI(m_webPageProxy.get());;
 }
 
-void QtWebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
-{
-    ASSERT(m_eventHandler);
-    m_eventHandler->didFindZoomableArea(target, area);
-}
-
 void QtWebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& message)
 {
     QVariantMap variantMap;
@@ -536,14 +426,6 @@
         drawingArea->paintToCurrentGLContext(transform, opacity);
 }
 
-#if ENABLE(TOUCH_EVENTS)
-void QtWebPageProxy::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
-{
-    ASSERT(m_eventHandler);
-    m_eventHandler->doneWithTouchEvent(event, wasEventHandled);
-}
-#endif
-
 void QtWebPageProxy::setVisibleContentRectAndScale(const QRectF& visibleContentRect, float scale)
 {
     if (!m_webPageProxy->drawingArea())

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (101787 => 101788)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-12-02 13:32:47 UTC (rev 101787)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-12-02 13:37:20 UTC (rev 101788)
@@ -22,14 +22,11 @@
 #define QtWebPageProxy_h
 
 #include "DrawingAreaProxy.h"
-#include "LayerTreeContext.h"
-#include "PageClient.h"
 #include "QtWebContext.h"
 #include "ShareableBitmap.h"
 #include "ViewportArguments.h"
 #include "WebPageProxy.h"
 #include <wtf/RefPtr.h>
-#include <QGraphicsView>
 #include <QMenu>
 #include <QSharedPointer>
 
@@ -37,6 +34,7 @@
 class QUndoStack;
 QT_END_NAMESPACE
 
+class QtPageClient;
 class QQuickWebPage;
 class QQuickWebView;
 class QtWebError;
@@ -52,7 +50,7 @@
 using namespace WebKit;
 
 // FIXME: needs focus in/out, window activation, support through viewStateDidChange().
-class QtWebPageProxy : public QObject, WebKit::PageClient {
+class QtWebPageProxy : public QObject {
     Q_OBJECT
 
 public:
@@ -70,67 +68,34 @@
         WebActionCount
     };
 
-    QtWebPageProxy(QQuickWebPage*, QQuickWebView*, WKContextRef = 0, WKPageGroupRef = 0);
+    QtWebPageProxy(QQuickWebPage*, QQuickWebView*, QtPageClient*, WKContextRef = 0, WKPageGroupRef = 0);
     ~QtWebPageProxy();
 
-    virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
+    PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
 
-    // PageClient
-    virtual void setViewNeedsDisplay(const WebCore::IntRect&);
-    virtual void displayView();
-    virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+    void setViewNeedsDisplay(const WebCore::IntRect&);
+    WebCore::IntSize viewSize();
+    bool isViewFocused();
+    bool isViewVisible();
 
-    virtual WebCore::IntSize viewSize();
-    virtual bool isViewWindowActive();
-    virtual bool isViewFocused();
-    virtual bool isViewVisible();
-    virtual bool isViewInWindow();
+    void pageDidRequestScroll(const WebCore::IntPoint&);
+    void processDidCrash();
+    void didRelaunchProcess();
 
-#if USE(ACCELERATED_COMPOSITING)
-    virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
-    virtual void exitAcceleratedCompositingMode();
-#endif // USE(ACCELERATED_COMPOSITING)
-    virtual void pageDidRequestScroll(const WebCore::IntPoint&);
-    virtual void processDidCrash();
-    virtual void pageClosed() { }
-    virtual void didRelaunchProcess();
+    void didChangeContentsSize(const WebCore::IntSize&);
+    void didChangeViewportProperties(const WebCore::ViewportArguments&);
 
-    virtual void didChangeContentsSize(const WebCore::IntSize&);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
+    void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
+    void clearAllEditCommands();
+    bool canUndoRedo(WebPageProxy::UndoOrRedo);
+    void executeUndoRedo(WebPageProxy::UndoOrRedo);
 
-    virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
-    virtual void setCursor(const WebCore::Cursor&);
-    virtual void setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves);
-    virtual void toolTipChanged(const WTF::String&, const WTF::String&);
-    virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
-    virtual void clearAllEditCommands();
-    virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
-    virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
-    virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
-    virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
-    virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
-    virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
+    void selectionChanged(bool, bool, bool, bool);
+    PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
 
-    virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
-    virtual void selectionChanged(bool, bool, bool, bool);
-    virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
-    virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
+    void didReceiveMessageFromNavigatorQtObject(const String&);
 
-    virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut, bool animate);
-
-    virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
-    virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
-    virtual double customRepresentationZoomFactor() { return 1; }
-    virtual void setCustomRepresentationZoomFactor(double) { }
-    virtual void didChangeScrollbarsForMainFrame() const { }
-
-    virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
-    virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }
-    virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) { }
-
-    virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
-    virtual void didReceiveMessageFromNavigatorQtObject(const String&);
-
     bool canGoBack() const;
     void goBack();
     bool canGoForward() const;
@@ -202,7 +167,7 @@
 
 private:
 #if ENABLE(TOUCH_EVENTS)
-    virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
+    void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
 #endif
 
     RefPtr<QtWebContext> m_context;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to