summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
authorArvid Nilsson <anilsson@blackberry.com>2013-12-13 15:57:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-31 17:31:13 +0100
commita4b0e2183c23c0173167833c75f0e2970f3ab524 (patch)
tree43d60fee79115c6634991696e3db1c152eafcc4a /src/webengine
parentf55df93be18e990d6f8daf7f691c75303c57ad5f (diff)
Quick: Support reparenting
To support reparenting, we make the compositing surface independent of the window by using gfx::TEXTURE_TRANSPORT. We also need to be able to keep frame data across window changes so we can reconstruct the QSGNode tree in a new context, so extract that data into DelegatedFrameNodeData class. Any context-specific data is still stored in DelegatedFrameNode. Also hook up window changes to WebContents::WasShown/Hidden for Quick. Remove checking of Qt isVisible state, this mechanism is used to sync Chromium with Qt, not the other way around. WasShown/Hidden is orthogonal to Show/Hide, and can use different triggers. However for Widgets it probably makes sense to hook both up to widget visibility. Change-Id: I1ef4b50cd61b8e54b791e03f0b41929c42fec8bf Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp12
-rw-r--r--src/webengine/api/qquickwebengineview_p.h1
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp18
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h8
4 files changed, 25 insertions, 14 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 79210263..049e353b 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -453,6 +453,18 @@ void QQuickWebEngineView::geometryChanged(const QRectF &newGeometry, const QRect
}
}
+void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &value)
+{
+ Q_D(QQuickWebEngineView);
+ if (change == ItemSceneChange || change == ItemVisibleHasChanged) {
+ if (window() && isVisible())
+ d->adapter->wasShown();
+ else
+ d->adapter->wasHidden();
+ }
+ QQuickItem::itemChange(change, value);
+}
+
QQuickWebEngineViewHandle::QQuickWebEngineViewHandle()
{
}
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 6b7b44e6..abc46d55 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -111,6 +111,7 @@ Q_SIGNALS:
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+ void itemChange(ItemChange, const ItemChangeData &);
private:
Q_DECLARE_PRIVATE(QQuickWebEngineView)
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 8d0f5f0c..9a983a2b 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -48,21 +48,21 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW
setFlag(ItemHasContents);
}
-WId RenderWidgetHostViewQtDelegateQuick::nativeWindowIdForCompositor() const
+void RenderWidgetHostViewQtDelegateQuick::update(const QRect&)
{
- return QQuickItem::window() ? QQuickItem::window()->winId() : 0;
+ QQuickItem::update();
}
-void RenderWidgetHostViewQtDelegateQuick::update(const QRect&)
+bool RenderWidgetHostViewQtDelegateQuick::supportsHardwareAcceleration() const
{
- QQuickItem::update();
+ return true;
}
void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const ItemChangeData &value)
{
QQuickItem::itemChange(change, value);
- if (change == QQuickItem::ItemSceneChange && value.window)
- m_client->compositingSurfaceUpdated();
+ if (change == QQuickItem::ItemSceneChange)
+ m_client->windowChanged();
}
QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
@@ -76,12 +76,6 @@ RenderWidgetHostViewQtDelegateQuickPainted::RenderWidgetHostViewQtDelegateQuickP
{
}
-WId RenderWidgetHostViewQtDelegateQuickPainted::nativeWindowIdForCompositor() const
-{
- // This causes a failure of the compositor initialization which ends up disabling it completely.
- return 0;
-}
-
void RenderWidgetHostViewQtDelegateQuickPainted::update(const QRect& rect)
{
polish();
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index b31a9c87..9c7bba35 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -126,6 +126,11 @@ public:
this->setSize(QSizeF(width, height));
}
+ virtual bool supportsHardwareAcceleration() const Q_DECL_OVERRIDE
+ {
+ return false;
+ }
+
void focusInEvent(QFocusEvent *event)
{
m_client->forwardEvent(event);
@@ -214,8 +219,8 @@ class RenderWidgetHostViewQtDelegateQuick : public RenderWidgetHostViewQtDelegat
public:
RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, QQuickItem *parent = 0);
- virtual WId nativeWindowIdForCompositor() const;
virtual void update(const QRect& rect = QRect()) Q_DECL_OVERRIDE;
+ virtual bool supportsHardwareAcceleration() const Q_DECL_OVERRIDE;
virtual void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
@@ -228,7 +233,6 @@ class RenderWidgetHostViewQtDelegateQuickPainted : public RenderWidgetHostViewQt
public:
RenderWidgetHostViewQtDelegateQuickPainted(RenderWidgetHostViewQtDelegateClient *client, QQuickItem *parent = 0);
- virtual WId nativeWindowIdForCompositor() const Q_DECL_OVERRIDE;
virtual void update(const QRect& rect = QRect()) Q_DECL_OVERRIDE;
void paint(QPainter *painter);