Title: [148011] trunk/Source/WebKit2
Revision
148011
Author
michael.brun...@digia.com
Date
2013-04-09 04:53:26 -0700 (Tue, 09 Apr 2013)

Log Message

[Qt][WK2] Remove direct references to WebPageProxy from QQuickWebPage.
https://bugs.webkit.org/show_bug.cgi?id=112850

Reviewed by Andreas Kling.

Removes direct references to WebPageProxy from QQuickWebPage and prepares the
class for the move to QRawWebView. The access to the device scale factor and
CoordinatedGraphicsScene is provided through QQuickWebViewPrivate, and therefore
accessors to these properties are temporarily added. Eventually, this access will
be provided through QRawWebView when the move is complete.

This also moves the pointer to QtWebPageEventHandler from QQuickWebPagePrivate
to QQuickWebViewPrivate as it is mainly used from there.

* UIProcess/API/qt/qquickwebpage.cpp:
(QQuickWebPagePrivate::QQuickWebPagePrivate):
(QQuickWebPagePrivate::paint):
(QQuickWebPage::updatePaintNode):
* UIProcess/API/qt/qquickwebpage_p.h:
* UIProcess/API/qt/qquickwebpage_p_p.h:
(QQuickWebPagePrivate):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::handleMouseEvent):
(QQuickWebViewPrivate::processDidCrash):
(QQuickWebViewPrivate::coordinatedGraphicsScene):
(QQuickWebViewPrivate::deviceScaleFactor):
(QQuickWebViewPrivate::setIntrinsicDeviceScaleFactor):
(QQuickWebViewFlickablePrivate::onComponentComplete):
(QQuickWebView::keyPressEvent):
(QQuickWebView::keyReleaseEvent):
(QQuickWebView::inputMethodEvent):
(QQuickWebView::focusInEvent):
(QQuickWebView::itemChange):
(QQuickWebView::touchEvent):
(QQuickWebView::wheelEvent):
(QQuickWebView::hoverEnterEvent):
(QQuickWebView::hoverMoveEvent):
(QQuickWebView::hoverLeaveEvent):
(QQuickWebView::dragMoveEvent):
(QQuickWebView::dragEnterEvent):
(QQuickWebView::dragLeaveEvent):
(QQuickWebView::dropEvent):
* UIProcess/API/qt/qquickwebview_p_p.h:
(WebCore):
(WebKit):
(QQuickWebViewPrivate):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (148010 => 148011)


--- trunk/Source/WebKit2/ChangeLog	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-09 11:53:26 UTC (rev 148011)
@@ -1,5 +1,55 @@
 2013-04-09  Michael BrĂ¼ning  <michael.brun...@digia.com>
 
+        [Qt][WK2] Remove direct references to WebPageProxy from QQuickWebPage.
+        https://bugs.webkit.org/show_bug.cgi?id=112850
+
+        Reviewed by Andreas Kling.
+
+        Removes direct references to WebPageProxy from QQuickWebPage and prepares the
+        class for the move to QRawWebView. The access to the device scale factor and
+        CoordinatedGraphicsScene is provided through QQuickWebViewPrivate, and therefore
+        accessors to these properties are temporarily added. Eventually, this access will
+        be provided through QRawWebView when the move is complete.
+
+        This also moves the pointer to QtWebPageEventHandler from QQuickWebPagePrivate
+        to QQuickWebViewPrivate as it is mainly used from there.
+
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        (QQuickWebPagePrivate::QQuickWebPagePrivate):
+        (QQuickWebPagePrivate::paint):
+        (QQuickWebPage::updatePaintNode):
+        * UIProcess/API/qt/qquickwebpage_p.h:
+        * UIProcess/API/qt/qquickwebpage_p_p.h:
+        (QQuickWebPagePrivate):
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::initialize):
+        (QQuickWebViewPrivate::handleMouseEvent):
+        (QQuickWebViewPrivate::processDidCrash):
+        (QQuickWebViewPrivate::coordinatedGraphicsScene):
+        (QQuickWebViewPrivate::deviceScaleFactor):
+        (QQuickWebViewPrivate::setIntrinsicDeviceScaleFactor):
+        (QQuickWebViewFlickablePrivate::onComponentComplete):
+        (QQuickWebView::keyPressEvent):
+        (QQuickWebView::keyReleaseEvent):
+        (QQuickWebView::inputMethodEvent):
+        (QQuickWebView::focusInEvent):
+        (QQuickWebView::itemChange):
+        (QQuickWebView::touchEvent):
+        (QQuickWebView::wheelEvent):
+        (QQuickWebView::hoverEnterEvent):
+        (QQuickWebView::hoverMoveEvent):
+        (QQuickWebView::hoverLeaveEvent):
+        (QQuickWebView::dragMoveEvent):
+        (QQuickWebView::dragEnterEvent):
+        (QQuickWebView::dragLeaveEvent):
+        (QQuickWebView::dropEvent):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (WebCore):
+        (WebKit):
+        (QQuickWebViewPrivate):
+
+2013-04-09  Michael BrĂ¼ning  <michael.brun...@digia.com>
+
         [Qt][WK2] Use C API to enable Navigator Qt Object.
         https://bugs.webkit.org/show_bug.cgi?id=112810
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp (148010 => 148011)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2013-04-09 11:53:26 UTC (rev 148011)
@@ -21,13 +21,12 @@
 #include "config.h"
 #include "qquickwebpage_p.h"
 
-#include "CoordinatedLayerTreeHostProxy.h"
 #include "QtWebPageEventHandler.h"
 #include "QtWebPageSGNode.h"
 #include "TransformationMatrix.h"
-#include "WebPageProxy.h"
 #include "qquickwebpage_p_p.h"
 #include "qquickwebview_p.h"
+#include "qquickwebview_p_p.h"
 #include "qwebkittest_p.h"
 #include <QQuickWindow>
 #include <WebCore/CoordinatedGraphicsScene.h>
@@ -54,49 +53,33 @@
 QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem)
     : q(q)
     , viewportItem(viewportItem)
-    , webPageProxy(0)
     , paintingIsInitialized(false)
     , contentsScale(1)
 {
 }
 
-void QQuickWebPagePrivate::initialize(WebKit::WebPageProxy* webPageProxy)
-{
-    this->webPageProxy = webPageProxy;
-    eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q, viewportItem));
-}
-
 void QQuickWebPagePrivate::paint(QPainter* painter)
 {
-    if (!webPageProxy->drawingArea())
-        return;
-
-    if (coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene())
-        coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene()->paintToGraphicsContext(painter);
+    if (WebCore::CoordinatedGraphicsScene* scene = QQuickWebViewPrivate::get(viewportItem)->coordinatedGraphicsScene())
+        scene->paintToGraphicsContext(painter);
 }
 
-CoordinatedLayerTreeHostProxy* QQuickWebPagePrivate::coordinatedLayerTreeHostProxy()
-{
-    if (webPageProxy->drawingArea())
-        return webPageProxy->drawingArea()->coordinatedLayerTreeHostProxy();
 
-    return 0;
-}
-
 QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*)
 {
-    if (!d->webPageProxy->drawingArea())
+    QQuickWebViewPrivate* webViewPrivate = QQuickWebViewPrivate::get(d->viewportItem);
+
+    WebCore::CoordinatedGraphicsScene* scene = webViewPrivate->coordinatedGraphicsScene();
+    if (!scene)
         return oldNode;
 
-    WebCore::CoordinatedGraphicsScene* scene = d->coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene();
-
     QtWebPageSGNode* node = static_cast<QtWebPageSGNode*>(oldNode);
 
     const QWindow* window = this->window();
     ASSERT(window);
 
-    if (window && d->webPageProxy->deviceScaleFactor() != window->devicePixelRatio()) {
-        d->webPageProxy->setIntrinsicDeviceScaleFactor(window->devicePixelRatio());
+    if (window && webViewPrivate->deviceScaleFactor() != window->devicePixelRatio()) {
+        webViewPrivate->setIntrinsicDeviceScaleFactor(window->devicePixelRatio());
         // This signal is queued since if we are running a threaded renderer. This might cause failures
         // if tests are reading the new value between the property change and the signal emission.
         emit d->viewportItem->experimental()->test()->devicePixelRatioChanged();
@@ -109,18 +92,13 @@
 
     node->setScale(d->contentsScale);
     node->setDevicePixelRatio(window->devicePixelRatio());
-    QColor backgroundColor = d->webPageProxy->drawsTransparentBackground() ? Qt::transparent : Qt::white;
+    QColor backgroundColor = webViewPrivate->transparentBackground() ? Qt::transparent : Qt::white;
     QRectF backgroundRect(QPointF(0, 0), d->contentsSize);
     node->setBackground(backgroundRect, backgroundColor);
 
     return node;
 }
 
-QtWebPageEventHandler* QQuickWebPage::eventHandler() const
-{
-    return d->eventHandler.data();
-}
-
 void QQuickWebPage::setContentsSize(const QSizeF& size)
 {
     if (size.isEmpty() || d->contentsSize == size)

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h	2013-04-09 11:53:26 UTC (rev 148011)
@@ -28,12 +28,7 @@
 
 class QQuickWebPagePrivate;
 class QQuickWebView;
-class QWebPreferences;
 
-namespace WebKit {
-class QtWebPageEventHandler;
-}
-
 class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
     Q_OBJECT
 public:
@@ -48,8 +43,6 @@
     QTransform transformFromItem() const;
     QTransform transformToItem() const;
 
-    WebKit::QtWebPageEventHandler* eventHandler() const;
-
 protected:
     virtual QSGNode* updatePaintNode(QSGNode*, UpdatePaintNodeData*);
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h (148010 => 148011)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h	2013-04-09 11:53:26 UTC (rev 148011)
@@ -24,29 +24,19 @@
 #include "qquickwebpage_p.h"
 #include <QTransform>
 
-namespace WebKit {
-class WebPageProxy;
-class QtWebPageEventHandler;
-class CoordinatedLayerTreeHostProxy;
-}
+class QQuickWebViewPrivate;
 
 class QQuickWebPagePrivate {
 public:
     QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem);
     ~QQuickWebPagePrivate();
 
-    void initialize(WebKit::WebPageProxy*);
-
     void updateSize();
 
     void paint(QPainter*);
     void resetPaintNode();
-    WebKit::CoordinatedLayerTreeHostProxy* coordinatedLayerTreeHostProxy();
-
-    QScopedPointer<WebKit::QtWebPageEventHandler> eventHandler;
     QQuickWebPage* const q;
     QQuickWebView* const viewportItem;
-    WebKit::WebPageProxy* webPageProxy;
     bool paintingIsInitialized;
 
     QSizeF contentsSize;

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-04-09 11:53:26 UTC (rev 148011)
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "qquickwebview_p.h"
 
+#include "CoordinatedLayerTreeHostProxy.h"
 #include "DownloadProxy.h"
 #include "DrawingAreaProxyImpl.h"
 #include "PageViewportControllerClientQt.h"
@@ -74,6 +75,7 @@
 #include <WKString.h>
 #include <WKStringQt.h>
 #include <WKURLQt.h>
+#include <WebCore/CoordinatedGraphicsScene.h>
 #include <WebCore/IntPoint.h>
 #include <WebCore/IntRect.h>
 #include <limits>
@@ -333,8 +335,7 @@
     webPageProxy->fullScreenManager()->setWebView(q_ptr);
 #endif
 
-    QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    pageViewPrivate->initialize(webPageProxy.get());
+    pageEventHandler.reset(new QtWebPageEventHandler(webPage.get(), pageView.data(), q_ptr));
 
     {
         WKPageFindClient findClient;
@@ -383,7 +384,7 @@
     WKPreferencesSetWebGLEnabled(preferencesRef, true);
     webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
 
-    pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController);
+    pageClient.initialize(q_ptr, pageEventHandler.data(), &undoController);
     webPageProxy->initializeWebPage();
     webPageProxy->registerApplicationScheme(ASCIILiteral("qrc"));
 
@@ -539,13 +540,13 @@
 {
     switch (event->type()) {
     case QEvent::MouseButtonPress:
-        pageView->eventHandler()->handleMousePressEvent(event);
+        pageEventHandler->handleMousePressEvent(event);
         break;
     case QEvent::MouseMove:
-        pageView->eventHandler()->handleMouseMoveEvent(event);
+        pageEventHandler->handleMouseMoveEvent(event);
         break;
     case QEvent::MouseButtonRelease:
-        pageView->eventHandler()->handleMouseReleaseEvent(event);
+        pageEventHandler->handleMouseReleaseEvent(event);
         break;
     case QEvent::MouseButtonDblClick:
         // If a MouseButtonDblClick was received then we got a MouseButtonPress before.
@@ -588,7 +589,7 @@
     QUrl url(KURL(WebCore::ParsedURLString, webPageProxy->urlAtProcessExit()));
     qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(url.toString(QUrl::RemoveUserInfo)));
 
-    pageView->eventHandler()->resetGestureRecognizers();
+    pageEventHandler->resetGestureRecognizers();
 
     // Check if loading was ongoing, when process crashed.
     if (m_loadProgress > 0 && m_loadProgress < 100) {
@@ -936,6 +937,24 @@
     emit q_ptr->experimental()->messageReceived(variantMap);
 }
 
+CoordinatedGraphicsScene* QQuickWebViewPrivate::coordinatedGraphicsScene()
+{
+    if (webPageProxy && webPageProxy->drawingArea() && webPageProxy->drawingArea()->coordinatedLayerTreeHostProxy())
+        return webPageProxy->drawingArea()->coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene();
+
+    return 0;
+}
+
+float QQuickWebViewPrivate::deviceScaleFactor()
+{
+    return webPageProxy->deviceScaleFactor();
+}
+
+void QQuickWebViewPrivate::setIntrinsicDeviceScaleFactor(float scaleFactor)
+{
+    webPageProxy->setIntrinsicDeviceScaleFactor(scaleFactor);
+}
+
 QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport)
     : QQuickWebViewPrivate(viewport)
 {
@@ -996,7 +1015,7 @@
     Q_Q(QQuickWebView);
     m_pageViewportControllerClient.reset(new PageViewportControllerClientQt(q, pageView.data()));
     m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), m_pageViewportControllerClient.data()));
-    pageView->eventHandler()->setViewportController(m_pageViewportControllerClient.data());
+    pageEventHandler->setViewportController(m_pageViewportControllerClient.data());
 
     // Trigger setting of correct visibility flags after everything was allocated and initialized.
     _q_onVisibleChanged();
@@ -1943,25 +1962,25 @@
 void QQuickWebView::keyPressEvent(QKeyEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleKeyPressEvent(event);
+    d->pageEventHandler->handleKeyPressEvent(event);
 }
 
 void QQuickWebView::keyReleaseEvent(QKeyEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleKeyReleaseEvent(event);
+    d->pageEventHandler->handleKeyReleaseEvent(event);
 }
 
 void QQuickWebView::inputMethodEvent(QInputMethodEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleInputMethodEvent(event);
+    d->pageEventHandler->handleInputMethodEvent(event);
 }
 
 void QQuickWebView::focusInEvent(QFocusEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleFocusInEvent(event);
+    d->pageEventHandler->handleFocusInEvent(event);
 }
 
 void QQuickWebView::itemChange(ItemChange change, const ItemChangeData &value)
@@ -1970,7 +1989,7 @@
     if (change == ItemActiveFocusHasChanged) {
         bool focus = value.boolValue;
         if (!focus)
-            d->pageView->eventHandler()->handleFocusLost();
+            d->pageEventHandler->handleFocusLost();
     }
     QQuickFlickable::itemChange(change, value);
 }
@@ -1990,7 +2009,7 @@
         d->axisLocker.reset();
 
     forceActiveFocus();
-    d->pageView->eventHandler()->handleTouchEvent(event);
+    d->pageEventHandler->handleTouchEvent(event);
 }
 
 void QQuickWebView::mousePressEvent(QMouseEvent* event)
@@ -2022,50 +2041,50 @@
 void QQuickWebView::wheelEvent(QWheelEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleWheelEvent(event);
+    d->pageEventHandler->handleWheelEvent(event);
 }
 
 void QQuickWebView::hoverEnterEvent(QHoverEvent* event)
 {
     Q_D(QQuickWebView);
     // Map HoverEnter to Move, for WebKit the distinction doesn't matter.
-    d->pageView->eventHandler()->handleHoverMoveEvent(event);
+    d->pageEventHandler->handleHoverMoveEvent(event);
 }
 
 void QQuickWebView::hoverMoveEvent(QHoverEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleHoverMoveEvent(event);
+    d->pageEventHandler->handleHoverMoveEvent(event);
 }
 
 void QQuickWebView::hoverLeaveEvent(QHoverEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleHoverLeaveEvent(event);
+    d->pageEventHandler->handleHoverLeaveEvent(event);
 }
 
 void QQuickWebView::dragMoveEvent(QDragMoveEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleDragMoveEvent(event);
+    d->pageEventHandler->handleDragMoveEvent(event);
 }
 
 void QQuickWebView::dragEnterEvent(QDragEnterEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleDragEnterEvent(event);
+    d->pageEventHandler->handleDragEnterEvent(event);
 }
 
 void QQuickWebView::dragLeaveEvent(QDragLeaveEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleDragLeaveEvent(event);
+    d->pageEventHandler->handleDragLeaveEvent(event);
 }
 
 void QQuickWebView::dropEvent(QDropEvent* event)
 {
     Q_D(QQuickWebView);
-    d->pageView->eventHandler()->handleDropEvent(event);
+    d->pageEventHandler->handleDropEvent(event);
 }
 
 bool QQuickWebView::event(QEvent* ev)

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-04-09 11:51:13 UTC (rev 148010)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-04-09 11:53:26 UTC (rev 148011)
@@ -37,6 +37,10 @@
 #include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
+namespace WebCore {
+class CoordinatedGraphicsScene;
+}
+
 namespace WebKit {
 class DownloadProxy;
 class DrawingAreaProxy;
@@ -44,6 +48,7 @@
 class PageViewportControllerClientQt;
 class QtWebContext;
 class QtWebError;
+class QtWebPageEventHandler;
 class QtWebPagePolicyClient;
 class WebPageProxy;
 }
@@ -133,6 +138,10 @@
 
     void didReceiveMessageFromNavigatorQtObject(WKStringRef message);
 
+    WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene();
+    float deviceScaleFactor();
+    void setIntrinsicDeviceScaleFactor(float);
+
 protected:
     class FlickableAxisLocker {
         QQuickFlickable::FlickableDirection m_allowedDirection;
@@ -180,6 +189,7 @@
     QScopedPointer<WebKit::QtWebPageUIClient> pageUIClient;
 
     QScopedPointer<QQuickWebPage> pageView;
+    QScopedPointer<WebKit::QtWebPageEventHandler> pageEventHandler;
     QQuickWebView* q_ptr;
     QQuickWebViewExperimental* experimental;
     WebKit::QtWebContext* context;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to