Skip to content
Permalink
Browse files
[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):

Canonical link: https://commits.webkit.org/132636@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Slow3000 committed Apr 9, 2013
1 parent 0f2164f commit f4a29fd9c63ea5ffe9798738a03bd57a3542ae58
Showing 6 changed files with 112 additions and 72 deletions.
@@ -1,3 +1,53 @@
2013-04-09 Michael Brüning <michael.bruning@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.bruning@digia.com>

[Qt][WK2] Use C API to enable Navigator Qt Object.
@@ -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 @@ QQuickWebPage::~QQuickWebPage()
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())
return oldNode;
QQuickWebViewPrivate* webViewPrivate = QQuickWebViewPrivate::get(d->viewportItem);

WebCore::CoordinatedGraphicsScene* scene = d->coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene();
WebCore::CoordinatedGraphicsScene* scene = webViewPrivate->coordinatedGraphicsScene();
if (!scene)
return oldNode;

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 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*)

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)
@@ -28,11 +28,6 @@

class QQuickWebPagePrivate;
class QQuickWebView;
class QWebPreferences;

namespace WebKit {
class QtWebPageEventHandler;
}

class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
Q_OBJECT
@@ -48,8 +43,6 @@ class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
QTransform transformFromItem() const;
QTransform transformToItem() const;

WebKit::QtWebPageEventHandler* eventHandler() const;

protected:
virtual QSGNode* updatePaintNode(QSGNode*, UpdatePaintNodeData*);

@@ -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;

0 comments on commit f4a29fd

Please sign in to comment.