summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-11-13 11:08:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-15 13:49:20 +0100
commitb6039e76c2ecfd6b95359d6ac1bc7ecbd6c1d9c5 (patch)
tree6db862015e15b9ad30363327c1b43b6a8657a878 /lib
parent42a4854214a7440f482f0ba613725701688a7efe (diff)
Add some QQuickWebView graphics stack tests.
This does basic sanity testing of the graphics stack for both the hardware accelerated and software codepaths. This also adds a required signal to report the CompositingSurface later on if the QWindow wasn't available yet when Chromium asked for it. Change-Id: I402ec5ade9114c78bea7960c5f0de989f54110e3 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/quick/render_widget_host_view_qt_delegate_quick.cpp9
-rw-r--r--lib/quick/render_widget_host_view_qt_delegate_quick.h4
-rw-r--r--lib/render_widget_host_view_qt.cpp9
-rw-r--r--lib/render_widget_host_view_qt.h2
-rw-r--r--lib/render_widget_host_view_qt_delegate.h1
5 files changed, 23 insertions, 2 deletions
diff --git a/lib/quick/render_widget_host_view_qt_delegate_quick.cpp b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
index dbd1ea911..8d0f5f0cc 100644
--- a/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
@@ -50,7 +50,7 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW
WId RenderWidgetHostViewQtDelegateQuick::nativeWindowIdForCompositor() const
{
- return QQuickItem::window()->winId();
+ return QQuickItem::window() ? QQuickItem::window()->winId() : 0;
}
void RenderWidgetHostViewQtDelegateQuick::update(const QRect&)
@@ -58,6 +58,13 @@ void RenderWidgetHostViewQtDelegateQuick::update(const QRect&)
QQuickItem::update();
}
+void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const ItemChangeData &value)
+{
+ QQuickItem::itemChange(change, value);
+ if (change == QQuickItem::ItemSceneChange && value.window)
+ m_client->compositingSurfaceUpdated();
+}
+
QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
return m_client->updatePaintNode(oldNode, QQuickItem::window());
diff --git a/lib/quick/render_widget_host_view_qt_delegate_quick.h b/lib/quick/render_widget_host_view_qt_delegate_quick.h
index 64e84cd44..e8e073c24 100644
--- a/lib/quick/render_widget_host_view_qt_delegate_quick.h
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.h
@@ -213,8 +213,10 @@ class RenderWidgetHostViewQtDelegateQuick : public RenderWidgetHostViewQtDelegat
public:
RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, QQuickItem *parent = 0);
- virtual WId nativeWindowIdForCompositor() const Q_DECL_OVERRIDE;
+ virtual WId nativeWindowIdForCompositor() const;
virtual void update(const QRect& rect = QRect()) Q_DECL_OVERRIDE;
+
+ virtual void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
};
#endif // QT_VERSION
diff --git a/lib/render_widget_host_view_qt.cpp b/lib/render_widget_host_view_qt.cpp
index 82d8e14bb..84192bef0 100644
--- a/lib/render_widget_host_view_qt.cpp
+++ b/lib/render_widget_host_view_qt.cpp
@@ -146,6 +146,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget
, m_anchorPositionWithinSelection(0)
, m_cursorPositionWithinSelection(0)
, m_initPending(false)
+ , m_readyForSurface(false)
{
m_host->SetView(this);
}
@@ -243,6 +244,7 @@ gfx::NativeView RenderWidgetHostViewQt::GetNativeView() const
gfx::NativeViewId RenderWidgetHostViewQt::GetNativeViewId() const
{
+ const_cast<RenderWidgetHostViewQt *>(this)->m_readyForSurface = true;
return m_delegate->nativeWindowIdForCompositor();
}
@@ -733,6 +735,13 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) co
}
}
+void RenderWidgetHostViewQt::compositingSurfaceUpdated()
+{
+ // Don't report an update until we get asked at least once.
+ if (m_readyForSurface)
+ m_host->CompositingSurfaceUpdated();
+}
+
void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) {
ScopedVector<ui::TouchEvent> events;
if (!content::MakeUITouchEventsFromWebTouchEvents(touch, &events, content::LOCAL_COORDINATES))
diff --git a/lib/render_widget_host_view_qt.h b/lib/render_widget_host_view_qt.h
index f9666f5bf..bf29938c6 100644
--- a/lib/render_widget_host_view_qt.h
+++ b/lib/render_widget_host_view_qt.h
@@ -172,6 +172,7 @@ public:
virtual void notifyResize() Q_DECL_OVERRIDE;
virtual bool forwardEvent(QEvent *) Q_DECL_OVERRIDE;
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+ virtual void compositingSurfaceUpdated() Q_DECL_OVERRIDE;
void handleMouseEvent(QMouseEvent*);
void handleKeyEvent(QKeyEvent*);
@@ -223,6 +224,7 @@ private:
size_t m_cursorPositionWithinSelection;
bool m_initPending;
+ bool m_readyForSurface;
};
#endif // RENDER_WIDGET_HOST_VIEW_QT_H
diff --git a/lib/render_widget_host_view_qt_delegate.h b/lib/render_widget_host_view_qt_delegate.h
index 2f1401b6d..d08296a8e 100644
--- a/lib/render_widget_host_view_qt_delegate.h
+++ b/lib/render_widget_host_view_qt_delegate.h
@@ -68,6 +68,7 @@ public:
virtual void notifyResize() = 0;
virtual bool forwardEvent(QEvent *) = 0;
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const = 0;
+ virtual void compositingSurfaceUpdated() = 0;
};
class QWEBENGINE_EXPORT RenderWidgetHostViewQtDelegate {